View Single Post
Old 11th March 2014
drm drm is offline
New User
 
Join Date: Sep 2012
Posts: 8
Default

Quote:
Originally Posted by yei0K View Post
I have the "youtube-dl", "zenity" and "vlc" packages installed and I am using a keyboard shortcut, "Mod4-y", that runs the following script:

Code:
#!/bin/sh

xterm -e 'youtube-dl --no-part -f 18/0/h264-sd -o $HOME/video.vid `zenity --entry` & \
sleep 8 && vlc -f $HOME/video.vid vlc://quit; \
mv $HOME/video.vid $HOME/video.vid.old; \
pkill -n xterm & ksh'
Just for the archives, i improved the script a bit, so that it deletes video files after watching, and in case i quit playing the video before it is completely downloaded, i stop the download before deleting.

drm

Code:
#!/bin/sh
# needs zenity, youtube-dl and vlc installed

URL=$(zenity --entry --text "Enter Video URL:")
if [ "$URL" = "" ]; then
    echo "You must enter a url."
    exit
fi
TMPFILE=$(mktemp /tmp/youtube-vid.XXXXXX)
youtube-dl --no-part -f 18/0/h264-sd -o $TMPFILE "$URL" & 
DL_PID=$!
sleep 5
cvlc -f $TMPFILE vlc://quit
kill $DL_PID
rm $TMPFILE
Reply With Quote