shell-scripte-code/youtube-pi.sh

61 lines
1.5 KiB
Bash
Raw Normal View History

2017-10-24 18:04:08 +02:00
#!/bin/bash
set -ex
if [ "$1" == "--help" ] || [[ -z "$1" ]]
then
2018-03-24 02:41:06 +01:00
echo "bitte alles kleinschreiben"
2018-11-11 04:24:37 +01:00
echo "bash ./youtube-dl.sh SUCHE/NOSUCHE URL/SUCHE FORMAT OUTPUT DISPLAY"
2018-03-24 03:33:14 +01:00
echo "Formate: [VERYLOW/LOW/MEDIUM/HIGH]"
2018-11-11 04:24:37 +01:00
echo "Displays: [VGA=4;HDMI=0,1,2,3,5]"
2018-03-24 02:41:06 +01:00
exit 0
2017-10-24 18:04:08 +02:00
fi
2018-03-24 02:41:06 +01:00
if [ "$1" == "suche" ] || [ "$1" == "nosuche" ]; then
suche="$1"
url="$2"
format="$3"
output="$4"
else
url="$1"
format="$2"
output="$3"
fi
2017-10-24 18:04:08 +02:00
2018-03-24 02:41:06 +01:00
if [ -z ${output} ]; then
2018-11-11 04:24:37 +01:00
output="local"
2017-10-24 18:04:08 +02:00
fi
2018-03-24 03:33:14 +01:00
if [ "$format" == "verylow" ]
2017-10-24 18:04:08 +02:00
then
2018-03-24 03:33:14 +01:00
format="-f 17"
elif [ "$format" == "low" ]
2017-10-24 18:04:08 +02:00
then
2018-03-24 03:33:14 +01:00
format="-f 36"
elif [ "$format" == "medium" ]
2017-10-24 18:04:08 +02:00
then
2018-03-24 03:33:14 +01:00
format="-f 18"
2018-11-11 04:24:37 +01:00
#elif [ "$format" == "high" ]
2018-03-24 03:33:14 +01:00
else
2018-11-11 04:24:37 +01:00
#then
2018-03-24 03:33:14 +01:00
format="-f 22"
2017-10-24 18:04:08 +02:00
fi
2018-11-11 04:24:37 +01:00
if [ -n "${display}" ]; then
display="device=${display}"
fi
2018-03-24 03:33:14 +01:00
#read -p "Wie ist die URL? : " url
#read -p "Wo sollen die Dateien heruntergeladen werden? : " pfad
#read -p "Soll ein Video heruntergeladen werden oder Audio? [opus/m4a/video/hd/fullhd/4k] : " format
2017-10-24 18:04:08 +02:00
if [ "$suche" == "suche" ]
then
2018-11-11 04:24:37 +01:00
#omxplayer -p -o ${output} `youtube-dl -g "ytsearch:$url" -q --force-ipv4 $format`
/usr/bin/omxplayer.bin ${device} -I -s -o ${output} --vol -800 --aspect-mode letterbox --no-osd `youtube-dl -g "ytsearch:$url" -q --force-ipv4 ${format}`
2017-10-24 18:04:08 +02:00
else
2018-11-11 04:24:37 +01:00
#omxplayer -p -o ${output} `youtube-dl -g $url -q --force-ipv4 $format`
/usr/bin/omxplayer.bin ${device} -I -s -o ${output} --vol -800 --aspect-mode letterbox --no-osd `youtube-dl -g $url -q --force-ipv4 ${format}`
2017-10-24 18:04:08 +02:00
fi