Created
April 3, 2020 20:06
-
-
Save rien333/5d2973f7b0517056b05a012bb1b3bcc0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
echo "message-info 'Opening $QUTE_URL with mpv'" >> "$QUTE_FIFO" & | |
if echo "$QUTE_URL" | grep -q 'youtube'; then | |
youtube-viewer -A --quiet --no-video-info --no-interactive --no-get-captions --append-arg="--osc yes " --player "mpv" "$QUTE_URL" | |
elif echo "$QUTE_URL" | grep -q 'bandcamp\.com'; then | |
d="bandcamp-"$(date +%s) | |
mkdir -p /tmp/$d | |
bandcamp-dl --base-dir /tmp/$d --template='%{track}' "$QUTE_URL" > /dev/null 2> /dev/null & | |
echo "01.mp3.tmp" > /tmp/$d/playlist.txt | |
seq -f "%02g.mp3" 2 20 >> /tmp/$d/playlist.txt | |
file=/tmp/$d/01.mp3.tmp | |
while [ ! -f "$file" ] | |
do | |
inotifywait -qqt 5 -e create -e moved_to "$(dirname $file)" | |
done | |
touch /tmp/$d/cover.jpg | |
sleep 0.7 | |
ls /tmp/$d/ | |
cat /tmp/$d/playlist.txt | |
mpv --vid=1 --external-file=/tmp/$d/cover.jpg --osc=yes --playlist=/tmp/$d/playlist.txt | |
exit 0 | |
else | |
streamlink -a "--no-terminal --osc=yes --force-window=immediate {filename}" "$QUTE_URL" || mpv --no-terminal --osc=yes --force-window=immediate $QUTE_URL | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment