Saving the occasional youtube stream

Once in a while I like to save a youtube stream.
On linux I’ve noticed that streams are placed in /tmp with file names like Flash*.

Copying it would work. Using firefox add ons are serious stuff.

Wanted a one touch solution came up with this, bound the executable to the useless win key+s.
Works like a charm.

Gnome-notifications with pynotify is the icing

#!/bin/bash
name=$(/usr/bin/zenity --entry --title="Name your Video"  \
--height=100 --width=300 --text="Please name your video ")
cp /tmp/Fla* ~/Videos/"$name"

if [[ $? -eq 0 ]]; then
STAT="\"File $name copied to ~/Videos/\""
else
STAT="\"Couldn't copy $name \" "
fi

python <<STUFF
import pynotify

pynotify.init("Save Flash ")

msg = pynotify.Notification("SaveFlash", ${STAT}, "dialog-alert")
msg.set_timeout(pynotify.EXPIRES_DEFAULT)
msg.show()

STUFF
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: