Skip to content

Commit

Permalink
mp3 download
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisGrigoropoulosP2016099 committed Jan 19, 2022
0 parents commit d0af10e
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions scrMpv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/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".mkv --ytdl-format=bestvideo[height "$link" <=?1080]+bestaudio/best
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".mkv --ytdl-format=bestaudio/best "$link"
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

0 comments on commit d0af10e

Please sign in to comment.