User:Stuporglue
My name is User:Stuporglue Michael Moore.
I like Linux and making stuff work. I currently have an Gateway E-2000 as my Myth Frontend, but would love something snazier.
Hulu.com
I don't have TV of any sort, but use MythTV to watch our DVDs, home videos, listen to music and look at pictures. Since we don't have cable, satellite or anything I was very interested in getting Hulu working within MythTV.
I created a Hulu.com account and what do you know, my user queue has an RSS feed. The only logical thing to do was to create a script that would download the RSS feed and do something useful with it.
This likely isn't the 'right' way to do it, but it's working for me.
The script downloads the RSS feed, and finds the shows in your queue (the title and URL). It then fetches the URL and finds out the ID number for the stand alone player. It writes out all of the information it gathered into a Myth menu XML file.
Since I shut down my frontend when I'm not using it, I just added this script to /etc/rc.local, so my Myth menu gets refreshed every time I go to watch it.
I use the Full Fullscreen plugin for Firefox to start the video in full screen : https://addons.mozilla.org/en-US/firefox/addon/1568
Problems: Videos don't auto-start Quitting Firefox from fullscreen is difficult. I have to use Alt+F4. Maybe the flash player is catching the F11 (to get Firefox out of full screen)? No video thumbnails (which the queue's RSS feed does provide).
#!/usr/bin/env ruby # === Hulu Queue to Myth Menu script === # # About: # # At Hulu.com, any shows which you are subscribed to will have new episodes added # to your queue automatically (this is configurable). The queue has an RSS feed # associated with it # # This script downloads the user's queue's Atom feed from Hulu.com and converts it # into a MythTV menu XML file. # # Each entry in the MythTV menu will be an EXEC link which will launch the # selected queued episode in the browser of your choice (Firefox, by default) # Recomended Use: # 1) Create a menu entry in the Menu theme you use which points to a huluqueue.xml # menu file. eg: # # <button> # <type>HULUQUEUE</type> # <text>Hulu Queue</text> # <action>MENU huluqueue.xml</action> # </button> # # 2) Create an account at Hulu.com. Add shows you like to your subscription there. # 3) Edit this script so that it knows where to find your personal queue. # 4) Have this script run once a day or so and regenerate your huluqueue.xml file. # # Copyright 2008 by Michael Moore <stuporglue@gmail.com> | http://stuporglue.org # Licensed under the same terms as MythTV itself # Config options # Visit http://www.hulu.com/users/profile, you should be redirected to a URL with a number on the end. That's your ID huluId = 1234567; browserCommand = "firefox" outFile = '/usr/share/mythtv/themes/DVR/huluqueue.xml' standAlonePlayer = true # Set to true if you want to go to the standalone player. False will bring you to the show's page ######################################################################################################################### # Non developers shouldn't need to edit anything down here... require 'open-uri' require 'rexml/document' include REXML # Get the source (the RSS feed XML) queueURL = "http://www.hulu.com/feed/queue/#{huluId.to_s}" rss = Document.new(open(queueURL).read) # Generate the Myth Menu XML file xml = "<mythmenu name='HULUQUEUE'>\n\n" rss.root.elements['channel'].each_element('item') do |show| # This is the thumbnail URL for this queued show # show.elements['media:thumbnail'].attributes['url'] showurl = show.elements['guid'].text xml += "<button>\n\t<type>MUSIC_PLAY</type>\n\t<text>#{show.elements['title'].text}</text>\n" if(standAlonePlayer) standAloneId = "Couldn't parse out URL!" showpage = open(showurl) # current_video_cid = "6628186"; showpage.each_line do |line| if(line =~ /current_video_cid/) line = line[/current_video_cid\s*=\s*"\d+\"/] standAloneId = line[/\d+/] end end xml += "<action>EXEC #{browserCommand} \"http://www.hulu.com/stand_alone/#{standAloneId}\"</action>\n" else xml += "<action>EXEC #{browserCommand} #{showurl}</action>\n" end xml +="</button>\n\n" end xml += "</mythmenu>" of = File.open(outFile,'w') of.write(xml) of.close File.chmod(0644,outFile)