|
@@ -16,19 +16,30 @@
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
WEBSITE="https://vaporwave.ivan.moe/list/"
|
|
|
-# Save current virtual terminal for later
|
|
|
-TTY=$(tty)
|
|
|
|
|
|
# Fetch the artist list from the website and let the user select from a menu
|
|
|
-wget -qO- $WEBSITE 2>/dev/null \
|
|
|
+CHOICES=$(wget -qO- $WEBSITE 2>/dev/null \
|
|
|
| grep "^<a href" \
|
|
|
| sed -e 's/<a href="//' \
|
|
|
-e 's/">/\n/' \
|
|
|
-e 's/><\/a>.*/\noff/' \
|
|
|
-e 's/\/<\/a>.*/\noff/' \
|
|
|
- | xargs -d '\n' dialog --title "VAPORGET" --checklist "Please, select an artist:" 0 0 0 3>&1 1>&2 2>&3 3>&- \
|
|
|
+ | xargs -d '\n' dialog --title "VAPORGET" --checklist "Please, select an artist:" 0 0 0 3>&1 1>&2 2>&3 3>&-)
|
|
|
+
|
|
|
+if [ $? != 0 ]; then # User selected cancel, therefore we exit
|
|
|
+ clear
|
|
|
+ exit 0
|
|
|
+fi
|
|
|
+
|
|
|
+clear
|
|
|
+if [ -z "${CHOICES}" ]; then # User didn't select any artist
|
|
|
+ echo "Please, select at least one artist." >&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+echo "${CHOICES}" \
|
|
|
| sed -e 's/ /\n/g' -e '$a\' \
|
|
|
- | { sed -e 's,^,'"${WEBSITE}"','; clear > $TTY; } \
|
|
|
+ | sed -e 's,^,'"${WEBSITE}"',' \
|
|
|
| wget -i - --spider -r -l inf --no-parent --no-directories 2>&1 \
|
|
|
| grep --line-buffered '^--' \
|
|
|
| stdbuf -oL cut -d' ' -f4 \
|