Files
zymp3/zymp3~
2013-02-24 01:48:24 -06:00

105 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
MUSICDIR="/home/$USER/Music"
backend()
{
t=~/.youtube-dl-$RANDOM-$RANDOM.flv
youtube-dl --output=$t --format=18 "$1" | zenity --progress --pulsate --title="Downloading..." --text="Downloading video, please wait.." --auto-close
ffmpeg -i $t -acodec libmp3lame -ac 2 -ab 128k -vn -y "$2" | zenity --progress --pulsate --title="Converting..." --text="Converting video to mp3.." --auto-close
rm $t
}
gui()
{
x=$(zenity --title="Zymp3 0.1-1" --entry --text "Paste youtube link here: ")
if [[ $? == 0 ]] ; then
gui2
else
exit 0;
fi
}
gui2()
{
y=$(zenity --title="Filename" --entry --text "Name your file: ")
if [[ $? == 0 ]] ; then
dconvert
else
exit 0;
fi
}
open()
{
zenity --question --title="Hey!" --text="I moved $y.mp3 to $MUSICDIR, do you want to play it now?"
if [[ $? == 0 ]] ; then
vlc "/home/$USER/Music/$y.mp3"
else
exit 0;
fi
}
move()
{
mkdir /home/$USER/Music
mv "$y.mp3" /home/$USER/Music
}
dconvert()
{
backend "$x" "$y.mp3"
move
if [ -f "/home/$USER/Music/$y.mp3" ]
then notify-send "$y.mp3 was saved in $MUSICDIR}"
else
zenity --error --text "Oh no! Something fucked up! fuck.."
fi
open
}
gui