gdead/gdead

60 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
#
# gdead - Stream shows from archive.org
# Copyright © 2021 Keith Irwin (www.ki9.us)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Vars
UA="gdead/curl/bash;https://gitea.gf4.pw/ki9/gdead"
START="$(date +%s)" # unix timestamp
# Args
YYYY=$1
MM=$2
DD=$3
# Initial output
echo " gdead Copyright © 2021 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"
echo
# 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"