gdead/gdead

38 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# gdead
# Get shows from archive.org
# Vars
UA="Curl on bash/linux; Keith Irwin (www.ki9.us); Just testing the API"
START="$(date +%s)" # unix timestamp
# Args
YYYY=$1
MM=$2
DD=$3
# Metadata search URL
URL="https://archive.org/advancedsearch.php?q=collection%3A%28GratefulDead%29+\
AND+subject%3A%28soundboard%29+\
AND+date%3A%5B$YYYY-$MM-$DD+TO+$YYYY-$MM-$DD%5D\
&fl%5B%5D=avg_rating&fl%5B%5D=downloads&fl%5B%5D=identifier&fl%5B%5D=source&fl%5B%5D=title\
&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
PIPE="/tmp/$START.gdead.fifo"
rm "$PIPE" 2>/dev/null
mkfifo "$PIPE"
# Metadata search
first_res=$(curl --user-agent "$UA" --silent "$URL" | cut -c 3- | head -c-2 | jq -r '.response.docs[0].identifier')
# Remove pipe
rm $PIPE 2>/dev/null
# Stream it
#vlc --http-user-agent "$UA" --qt-system-tray --qt-start-minimized \
nvlc --http-user-agent "$UA" \
"https://archive.org/download/$first_res/${first_res}_vbr.m3u"