-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScrMpv-full-leitourgiko.sh
51 lines (49 loc) · 1.89 KB
/
ScrMpv-full-leitourgiko.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
#P2016099
FirstOpt="video noVideo exit"
SecondOpt="record No"
select option in $FirstOpt; do
if [ "$option" == "video" ]; then
echo -n "search: "
read -r search
id="$(youtube-dl ytsearch:"$search" --get-id)"
link="https://www.youtube.com/watch?v=${id}"
select opt in $SecondOpt; do
if [ "$opt" == "record" ]; then
echo -n "Name file: "
read -r name
echo "Now playing "$(youtube-dl "$link" --get-title)""
mpv --cache=yes --stream-record="$name".mp4 --ytdl-format=bestvideo[height "$link" <=?1080]+bestaudio/best
mpv $name.mp4 -o $name.mp3
rm $name.mp4
break
elif [ "$opt" == "No" ]; then
echo " Now playing "$(youtube-dl "$link" --get-title)""
mpv --cache=yes --ytdl-format=bestvideo[height "$link" <=?1080]+bestaudio/best
break
fi
done
elif [ "$option" == "noVideo" ]; then
echo -n "search: "
read -r search
id="$(youtube-dl ytsearch:"$search" --get-id)"
link="https://www.youtube.com/watch?v=${id}"
select opt in $SecondOpt; do
if [ "$opt" == "record" ]; then
echo -n "Name file: "
read -r name
echo "Now playing "$(youtube-dl "$link" --get-title)""
mpv --cache=yes --video=no --stream-record="$name".mp4 --ytdl-format=bestaudio/best "$link"
mpv $name.mp4 -o $name.mp3 --no-video
rm $name.mp4
break
elif [ "$opt" == "No" ]; then
echo "Now playing "$(youtube-dl "$link" --get-title)""
mpv --cache=yes --video=no --ytdl-format=bestaudio/best "$link"
break
fi
done
elif [ "$option" == "exit" ]; then
break
fi
done