knoppies

Watch youtube on the RPi.

Oct 27th, 2012
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.97 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ "$#" -lt 1 ] ; then
  4.     echo "\t\tUsage: $0 \"YouTubeURL\"";
  5.     exit 0;
  6. fi
  7.  
  8.  
  9. # This next line is for if you have hdmi audio out:
  10. #plparams="-o hdmi" # uncomment if you are using hdmi audio out.
  11.  
  12. #python youtube-dl.py --format 38/37/46/22/35/34/18/6/5/17/13 -c -t $1 # this gives filename-id.mp4
  13. python youtube-dl.py --format 38/37/46/22/35/34/18/6/5/17/13 -c -o "%(stitle)s.%(ext)s" $1 # Cleaner filename.mp4
  14.  
  15. # the reason I only allow for one argument (above) is because having more than one will confuse my fname (below).
  16.  
  17. fname="`python youtube-dl.py --get-filename --format 38/37/46/22/35/34/18/6/5/17/13 -c -o "%(stitle)s.%(ext)s" $1`"
  18.  
  19. #echo $fname # this just prints out the filename
  20.  
  21. omxplayer $plparams "$fname"
  22.  
  23. #rm "$fname" # uncomment this if you want it to delete the video once you have finished watching it.
  24.  
  25.  
  26. # Instead of using youtube-dl you could just use get_flash_videos:
  27. #get_flash_videos --play --player "omxplayer $plparams" $*
Add Comment
Please, Sign In to add comment