Advertisement
v1ral_ITS

easy zenity youtube-dl GUI { from terminal }

Jul 14th, 2018
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.36 KB | None | 0 0
  1. #!/bin/sh
  2. # Download from youtube mp4 end mp3
  3. # need:
  4. #   - youtube-dl
  5. #   - ffmpeg
  6.  
  7. # Check if youtube-dl commands are found
  8. for command in youtube-dl
  9. do
  10.     if [ ! $(which $command) ]
  11.     then
  12.         zenity --error --text "Could not find \"$command\" application.\n
  13. Make sure youtube-dl is installed and \"$command\" is executable."
  14.         exit 1
  15.     fi
  16. done
  17.  
  18. # Check if ffmpeg commands are found
  19. for command in ffmpeg
  20. do
  21.     if [ ! $(which $command) ]
  22.     then
  23.         zenity --error --text "Could not find \"$command\" application.\n
  24. Make sure ffmpeg is installed and \"$command\" is executable."
  25.         exit 1
  26.     fi
  27. done
  28.  
  29. var=`zenity --entry --title="Download From Youtube" --text="Enter address youtube video:                              "`
  30.  
  31. if [ $? = 0 ] ; then
  32.  
  33.     filetype=`zenity  --list  --text "mp3 or mp4" --radiolist  --column "select" --column "type" TRUE "mp3" FALSE "mp4"`
  34.  
  35.     if [ $? = 0 ] ; then
  36.    
  37.         if [ $filetype = "mp3" ]; then
  38.             youtube-dl "$var" --extract-audio --audio-format=mp3 | zenity --progress --pulsate --auto-close --auto-kill --title="Download From Youtube" --text="downloading..."
  39.         else
  40.             youtube-dl "$var" | zenity --progress --pulsate --auto-close --auto-kill --title="Download From Youtube" --text="downloading..."        
  41.         fi
  42.    
  43.     fi
  44.  
  45. fi
  46.  
  47. zenity --info --text="ImPerial TeK. Solutions"
  48.  
  49. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement