diff --git a/README.md b/README.md index 91ebe83..bdb0a90 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,17 @@ ln -s /usr/local/src/gdead/gdead /usr/local/bin/gdead ## Usage ``` -gdead [-r|--rand|--random] [-a|--aud|--audience] [year [month [day]]] +gdead [-g|--gui] [-r|--rand|--random] [-a|--aud|--audience] [year [month [day]]] ``` Takes `year`, `month`, and `day` as arguments and plays the top-rated soundboard on [archive.org](https://archive.org/details/GratefulDead). Providing no unnamed parameters searches the entire vault. **NOTE**: *The date parsing is still pretty primitive so don't be an edge case: use 4-digit years and 2-digit months/days.* +### GUI or terminal + +By default `gdead` will open your show with `nvlc`, which uses an ncurses-based terminal interface. To open the show as a playlist in vlc's GUI, use the `-g` flag. + ### Audience recordings By default, `gdead` only returns soundboards and matrices. To use audience-recordings too, use the `-a` flag diff --git a/gdead b/gdead index 2c1b280..250dfb1 100755 --- a/gdead +++ b/gdead @@ -19,7 +19,6 @@ # Vars UA="gdead/curl/bash;https://gitea.gf4.pw/ki9/gdead" -START="$(date +%s)" # unix timestamp # Parse params SHOW_DATE="" @@ -31,6 +30,8 @@ while (( "$#" )); do SBD=""; shift;; -r|--rand|--random) SORT="sort%5B%5D=random+asc"; shift;; + -g|--gui) + GUI='true'; shift;; *) SHOW_DATE="$SHOW_DATE $1"; shift;; esac @@ -66,11 +67,6 @@ URL="https://archive.org/advancedsearch.php?q=collection%3A%28GratefulDead%29$SB &fl%5B%5D=identifier\ &$SORT&rows=1&page=1&output=json&callback=c&save=yes#raw" -# Prepare pipe -PIPE="/tmp/$START.gdead.fifo" -rm "$PIPE" 2>/dev/null -mkfifo "$PIPE" - # Metadata search res=$(curl --user-agent "$UA" --silent "$URL" | cut -c 3- | head -c-2 | jq -r '.response.docs[0].identifier') if [ "$res" == "" ]; then @@ -78,9 +74,6 @@ if [ "$res" == "" ]; then exit 4 fi -# Remove pipe -rm $PIPE 2>/dev/null - if [ "$res" == "null" ]; then echo "No shows found." exit 5 @@ -88,7 +81,8 @@ fi # Stream it... stream="https://archive.org/download/$res/${res}_vbr.m3u" -# ...with VLC in the system tray -#vlc --http-user-agent "$UA" --qt-system-tray --qt-start-minimized "$stream" -# ...with ncurses VLC -nvlc --play-and-exit --http-user-agent "$UA" "$stream" +if [ "${GUI}" == "true" ]; then + vlc --http-user-agent "$UA" --qt-system-tray "$stream" +else + nvlc --play-and-exit --http-user-agent "$UA" "$stream" +fi