#1 added -r and -a flags and some date ranging
parent
331d8bf812
commit
21cb48a5e1
28
README.md
28
README.md
|
@ -13,10 +13,34 @@ ln -s /usr/local/src/gdead/gdead /usr/local/bin/gdead
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Takes year, month, and day as arguments and plays the top-rated soundboard on [archive.org](https://archive.org/details/GratefulDead). All three args are required.
|
```
|
||||||
|
gdead [-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. *
|
||||||
|
|
||||||
|
### Audience recordings
|
||||||
|
|
||||||
|
By default, `gdead` only returns soundboards and matrices. To use audience-recordings too, use the `-a` flag
|
||||||
|
|
||||||
|
### Random
|
||||||
|
|
||||||
|
To sort by random instead of rating, use the `-r` flag.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Play the top-rated version of Woodstock Festival, including audience-tapes:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
gdead 1969 08 16
|
gdead -a 1969 08 16
|
||||||
|
```
|
||||||
|
|
||||||
|
Play a random show from '72:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
gdead -r 1972
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
64
gdead
64
gdead
|
@ -21,26 +21,50 @@
|
||||||
UA="gdead/curl/bash;https://gitea.gf4.pw/ki9/gdead"
|
UA="gdead/curl/bash;https://gitea.gf4.pw/ki9/gdead"
|
||||||
START="$(date +%s)" # unix timestamp
|
START="$(date +%s)" # unix timestamp
|
||||||
|
|
||||||
# Args
|
# Parse params
|
||||||
YYYY=$1
|
SHOW_DATE=""
|
||||||
MM=$2
|
SORT="sort%5B%5D=num_favorites+asc&sort%5B%5D=avg_rating+asc&sort%5B%5D=num_reviews+asc"
|
||||||
DD=$3
|
SBD="+AND+subject%3A%28soundboard%29"
|
||||||
|
while (( "$#" )); do
|
||||||
|
case "$1" in
|
||||||
|
-a|--aud|--audience)
|
||||||
|
SBD=""; shift;;
|
||||||
|
-r|--rand|--random)
|
||||||
|
SORT="sort%5B%5D=random+asc"; shift;;
|
||||||
|
*)
|
||||||
|
SHOW_DATE="$SHOW_DATE $1"; shift;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# Initial output
|
# Parse show date
|
||||||
|
YYYY="$(echo $SHOW_DATE | awk '{print $1}')"
|
||||||
|
MM="$(echo $SHOW_DATE | awk '{print $2}')"
|
||||||
|
DD="$(echo $SHOW_DATE | awk '{print $3}')"
|
||||||
|
YYYY1="1900"; YYYY2="2020"
|
||||||
|
MM1="01"; MM2="12"
|
||||||
|
DD1="01"; DD2="31"
|
||||||
|
if [ "$YYYY" != "" ]; then
|
||||||
|
YYYY1="$YYYY"; YYYY2="$YYYY"
|
||||||
|
if [ "$MM" != "" ]; then
|
||||||
|
MM1="$MM"; MM2="$MM"
|
||||||
|
if ["$DD" != "" ]; then
|
||||||
|
DD1="$DD"; DD2="$DD"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print license
|
||||||
echo " gdead Copyright © 2021 Keith Irwin (www.ki9.us)"
|
echo " gdead Copyright © 2021 Keith Irwin (www.ki9.us)"
|
||||||
echo " This program comes with ABSOLUTELY NO WARRANTY; for details"
|
echo " This program comes with ABSOLUTELY NO WARRANTY; for details"
|
||||||
echo " see the LICENSE.md that came with it"
|
echo " see the LICENSE.md that came with it"
|
||||||
echo " This is free software, and you are welcome to redistribute it"
|
echo " This is free software, and you are welcome to redistribute it"
|
||||||
echo " under certain conditions"
|
echo " under certain conditions"
|
||||||
echo
|
|
||||||
|
|
||||||
# Metadata search URL
|
# Metadata search URL
|
||||||
URL="https://archive.org/advancedsearch.php?q=collection%3A%28GratefulDead%29+\
|
URL="https://archive.org/advancedsearch.php?q=collection%3A%28GratefulDead%29$SBD\
|
||||||
AND+subject%3A%28soundboard%29+\
|
+AND+date%3A%5B$YYYY1-$MM1-$DD1+TO+$YYYY1-$MM2-$DD2%5D\
|
||||||
AND+date%3A%5B$YYYY-$MM-$DD+TO+$YYYY-$MM-$DD%5D\
|
&fl%5B%5D=identifier\
|
||||||
&fl%5B%5D=avg_rating&fl%5B%5D=downloads&fl%5B%5D=identifier&fl%5B%5D=source&fl%5B%5D=title\
|
&$SORT&rows=1&page=1&output=json&callback=c&save=yes#raw"
|
||||||
&sort%5B%5D=num_favorites+asc&sort%5B%5D=avg_rating+asc&sort%5B%5D=num_reviews+asc\
|
|
||||||
&rows=10&page=1&output=json&callback=c&save=yes#raw"
|
|
||||||
|
|
||||||
# Prepare pipe
|
# Prepare pipe
|
||||||
PIPE="/tmp/$START.gdead.fifo"
|
PIPE="/tmp/$START.gdead.fifo"
|
||||||
|
@ -48,12 +72,18 @@ rm "$PIPE" 2>/dev/null
|
||||||
mkfifo "$PIPE"
|
mkfifo "$PIPE"
|
||||||
|
|
||||||
# Metadata search
|
# Metadata search
|
||||||
first_res=$(curl --user-agent "$UA" --silent "$URL" | cut -c 3- | head -c-2 | jq -r '.response.docs[0].identifier')
|
res=$(curl --user-agent "$UA" --silent "$URL" | cut -c 3- | head -c-2 | jq -r '.response.docs[0].identifier')
|
||||||
|
if [ "$res" == "" ]; then
|
||||||
|
echo "FATAL: Could not connect to archive.ort"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove pipe
|
# Remove pipe
|
||||||
rm $PIPE 2>/dev/null
|
rm $PIPE 2>/dev/null
|
||||||
|
|
||||||
# Stream it
|
# Stream it...
|
||||||
#vlc --http-user-agent "$UA" --qt-system-tray --qt-start-minimized \
|
stream="https://archive.org/download/$res/${res}_vbr.m3u"
|
||||||
nvlc --http-user-agent "$UA" \
|
# ...with VLC in the system tray
|
||||||
"https://archive.org/download/$first_res/${first_res}_vbr.m3u"
|
#vlc --http-user-agent "$UA" --qt-system-tray --qt-start-minimized "$stream"
|
||||||
|
# ...with ncurses VLC
|
||||||
|
nvlc --http-user-agent "$UA" "$stream"
|
||||||
|
|
Loading…
Reference in New Issue