Browse Source

Initial commit

Matteo Zeccoli Marazzini 4 years ago
parent
commit
f89929cdd1
2 changed files with 24 additions and 1 deletions
  1. 6 1
      README.md
  2. 18 0
      vaporget

+ 6 - 1
README.md

@@ -1,3 +1,8 @@
 # vaporget
 
-vaporget allows to easily retrieve and listen to vaporwave music stored in the Vaporwave Library Project (specifically, in the clone at https://vaporwave.ivan.moe/).
+`vaporget` allows to easily retrieve and listen to vaporwave music stored in the Vaporwave Library Project (specifically, in the clone at https://vaporwave.ivan.moe/).
+
+## Required software
+`vaporget` requires that the following software is installed on the user's computer:
+* [`wget`](https://www.gnu.org/software/wget/)
+* [`mpv`](https://mpv.io/)

+ 18 - 0
vaporget

@@ -0,0 +1,18 @@
+#!/bin/bash
+
+WEBSITE="https://vaporwave.ivan.moe/list/"
+wget -qO- $WEBSITE 2>/dev/null \		# Retrieve artist list
+	| grep "^<a href" \			# Search for anchor tags
+	| sed -e 's/<a href="//' \		# Remove <a href="
+	      -e 's/">/\n/' \			# Remove > (at the end of <a> tag) and substitute with \n
+	      -e 's/&gt;<\/a>.*/\noff/' \	# Remove &gt;</a> and everything after it (&gt; is used by the website to indicate long names which don't fit on the page)
+	      -e 's/\/<\/a>.*/\noff/' \		# Remove /</a> and everything after it
+	| xargs -d '\n' dialog --title "Test" --checklist "Menu" 0 0 0 3>&1 1>&2 2>&3 3>&- \	# Produce dialog menu to let the user choose artists
+	| sed -e 's/ /\n/g' -e '$a\' \		# Substitute spaces with newlines in the url list and add a newline at the end ot the list (dialog doesn't put if for us)
+	| sed -e 's,^,'"${WEBSITE}"',' \	# Insert base url at the beginning of each line
+	| wget -i - --spider -r -l inf --no-parent --no-directories 2>&1 \	# Get url for all songs of the selected artists
+	| grep --line-buffered '^--' \
+	| stdbuf -oL cut -d' ' -f4 \
+	| grep --line-buffered '\.\(flac\|mp3\|wav\)$' \	# Select audio file types
+	| tee /dev/stderr \
+	| mpv --no-video --playlist=- "$@"	# Start the party