YouTube on the Zipit

Soundguy has released his new Zipit userland image which is quite amazing. It keeps getting better everyday. He found a way to play YouTube videos via the command line with the help of mplayer and a python script called youtube-dl. The interface wasn't very user friendly though as you had to copy a youtube link from the browser to the command line to run it. I've come up with a way around that. You can now search and play youtube videos from the links2 browser.

It works by creating a new MIME type named 'application/zyt' which we tell links2 to open with my playtube script. Then, using the php search I created here, the youtube url you click on is sent to your zipit in a text file with the 'zyt' extension. This tells links2 to run playtube and in turn the video.

To install it, get the following required files:
youtube-dl
My "PlayTube" Script
My Links2 Config File

Copy playtube and youtube-dl to /usr/bin and make them executable with 'chmod +x /usr/bin/youtube-dl /usr/bin/playtube'. Then make sure it can be run by all users with 'chmod 755 /usr/bin/youtube-dl /usr/bin/playtube'.

Copy my Links2 config file to '~/.links2'.

Point your browser to href="http://www.mozzwald.com/ytsearch.php and do a search. Click on a thumbnail or link and wait for the video to play. It may take a bit for the video to load on the zipit, but it works.

I still need to format the video descriptions on my search page to hopefully fit on the zipit screen better. Please post any suggestions in the comments section. Happy YouTubing on your Zipit!

Playtube script modified for windows users


#!/bin/bash
#Replace gxmessage with xmessage
LINK=`cat $1`

function cleanup {
#Cleanup on entry and exit to make sure nothing died..
sleep 1
#kill -9 `ps ax | grep gxmessage | grep -v grep | awk '{ print $1}'`
killall -9 gxmessage
#Make sure we are cleaned up.
sleep 1
#kill -9 `ps ax | grep mplayer | grep -v grep | awk '{ print $1}'`
killall -9 mplayer
sleep 1
killall -9 python
#kill -9 `ps ax | grep python | grep -v grep | awk '{ print $1}'`
}

function message {
gxmessage -buttons "Cancel Loading Video.." "Loading YouTube Video
This may take a few seconds...

This window will automatically close after playing.

Loading:
$LINK
"
cleanup &
}
cleanup
#sleep 1
message &
mplayer -zoom -ao oss -framedrop -vfm ffmpeg `youtube-dl -m -g $LINK`
cleanup

Just something I noticed, the


Just something I noticed, the links.cfg, I have always called it html.cfg. I have never tested calling it links.cfg. Just wanted to make sure there was no error.

Powered by Drupal, an open source content management system