PDA

View Full Version : Mac geeks: script for GeekToool to put "Now Playing" on your desktop



tivoboi
10-03-2005, 03:50 AM
For those of you with vserver running on your Tivo and vstream running on your Mac, here's a short script I've written that -- when used with GeekTool (http://projects.tynsoe.org/en/geektool/) (click here (http://www.jaw.it/pages/en/x_misc.html) for a Tiger-compatible version) -- allows you to put the "Now Playing" list from your TiVo on to your desktop.

The script uses the vstream client to gather the list of programs from your "Now Playing" list, sorts them, and then groups them together ala Tivo's "folders" feature. The output is formatted so that single programs are shown on one line with the program name, episode title, and record date. Shows with multiple episodes are shown on two lines: the first line contains the name of the program and the total number of episodes, and the second line contains the episode name and date and time of the last episode recorded.

I've attached a screenshot so you can see an example.

In order to use this program, you need to have vserver running on your (hacked) Tivo and you must also have the "vstream-client" executable located on your Macintosh in /usr/local/bin. You'll also need to alter the following code and change the IP address so that it matches the IP address of your Tivo.

Here's the code. You can cut and past this directly into GeekTool.



/usr/local/bin/vstream-client tivo://192.168.1.3/llist | awk -v FS="\|" '{print substr($2,7,2) "/" substr($2,1,5) " " substr($2,10,5) "|" $5 "|" $6 "|"}' | grep -v "|Live||" | grep -v "/ |||" | sort | uniq | awk -v FS="\|" '{q[$2]++;ld[$2]=$1;le[$2]=$3 } END { { for (i in q) print i "\|" q[i] "\|" ld[i] "\|" le[i] } }' | sort | awk -v FS="\|" 'BEGIN {print "\"Now Playing\" on your Tivo:\n"} {e=$4; if (length(e)>47) e=substr(e,1,46) "..."; d=substr($3,4,5) "/" substr($3,1,2) " " substr($3,10,5); if (int($2)==1) {if (length(e)>1) e=", \"" e "\""; print ">" $1 e " recorded on " d;} else {if (length(e)==0) e="[No Episode Name]"; else e="\"" e "\""; printf ">" $1 " (" $2 " episodes)\n Last: " e " recorded on " d "\n";}} END {if (NR==0) print "[Your Tivo could not be found, or vserver is not running.]"}'


I would recommend you set a 360-second refresh interval, so that the list only updates once an hour.

For those of you who are just curious to see the output that this script produces, I've also included a screenshot (attached). The image quality is slightly reduced in order to make the file a little smaller.

Cheers!
-tivoboi

[Edit: added "uniq" command to filter out the duplicate listings that vserver sometimes returns as part of the llist]