diff --git a/gdead b/gdead index 250dfb1..5b6b760 100755 --- a/gdead +++ b/gdead @@ -38,18 +38,18 @@ 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 @@ -62,27 +62,27 @@ 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