Compare commits

...

2 Commits

Author SHA1 Message Date
Keith Irwin 9fa79c16e6
Don't print license on every invocation 2024-04-16 10:41:26 -06:00
Keith Irwin 9699596be8
Added curly braces 2024-04-16 10:40:56 -06:00
1 changed files with 18 additions and 25 deletions

43
gdead
View File

@ -38,51 +38,44 @@ while (( "$#" )); do
done
# Parse show date
YYYY="$(echo $SHOW_DATE | awk '{print $1}')"
MM="$(echo $SHOW_DATE | awk '{print $2}')"
DD="$(echo $SHOW_DATE | awk '{print $3}')"
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"
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-2022 Keith Irwin (www.ki9.us)"
echo " This program comes with ABSOLUTELY NO WARRANTY; for details"
echo " see the LICENSE.md that came with it"
echo " This is free software, and you are welcome to redistribute it"
echo " under certain conditions"
# Metadata search URL
URL="https://archive.org/advancedsearch.php?q=collection%3A%28GratefulDead%29$SBD\
+AND+date%3A%5B$YYYY1-$MM1-$DD1+TO+$YYYY1-$MM2-$DD2%5D\
URL="https://archive.org/advancedsearch.php?q=collection%3A%28GratefulDead%29${SBD}\
+AND+date%3A%5B${YYYY1}-${MM1}-${DD1}+TO+${YYYY1}-${MM2}-${DD2}%5D\
&fl%5B%5D=identifier\
&$SORT&rows=1&page=1&output=json&callback=c&save=yes#raw"
&${SORT}&rows=1&page=1&output=json&callback=c&save=yes#raw"
# Metadata search
res=$(curl --user-agent "$UA" --silent "$URL" | cut -c 3- | head -c-2 | jq -r '.response.docs[0].identifier')
if [ "$res" == "" ]; then
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.org"
exit 4
fi
if [ "$res" == "null" ]; then
if [ "${res}" == "null" ]; then
echo "No shows found."
exit 5
fi
# Stream it...
stream="https://archive.org/download/$res/${res}_vbr.m3u"
stream="https://archive.org/download/${res}/${res}_vbr.m3u"
if [ "${GUI}" == "true" ]; then
vlc --http-user-agent "$UA" --qt-system-tray "$stream"
vlc --http-user-agent "${UA}" --qt-system-tray "${stream}"
else
nvlc --play-and-exit --http-user-agent "$UA" "$stream"
nvlc --play-and-exit --http-user-agent "${UA}" "${stream}"
fi