GENERAL INFO
MythFeed is a MythTV module (see
http://www.mythtv.org) that
allows you to play internet feeds or streams. Stream information is
harvested to an .xml file. This plugin is derived from the MythVideo
plugin and still carries some major unused baggage in the source.
BUILD/CONFIGURATION INSTRUCTIONS
RUNNING MYTHFEED
HULU & CBS INFORMATION
MYTHFEED_PLAY.PY INFORMATION
PANDORA INFORMATION
PARENTAL LEVEL INFORMATION
LIRC INTEGRATION
NEXT STEPS
FURTHER INFORMATION
Contact email: mythfeed (at) gmail.com
BUILD/CONFIGURATION INSTRUCTIONS
Download MythFeed from SourceForge.
Requirements: MythTV 0.22 or higher
installed and working, QT4
Compiling note: If you get an error on
building this, that says something about 'mkspecs', then you don't
have the QTDIR environment variable set. On Debian, this should be
set to /usr/share/qt. I hear on mandrake, it's /usr/lib/qt3 (4?).
You'll need to figure out what it should be on your system, set the
variable, and attempt to compile again.
In addition to MythTV's prerequisites,
you'll have to have the following software packages installed for
Hulu and Pandora to work:
- Firefox - default Ubuntu
installation is fine. Otherwise get Firefox and the Adobe Flash
plugin
- flashplayer (can be used for
Pandora and whatever other swf files you want) - get this binary
from Adobe. Go to
http://www.adobe.com/support/flashplayer/downloads.html
and look for the "Linux Debugger and Standalone Players for
Flash Developers." Extract flashplayer from the
standalone/release directory to somewhere in your path.
- xdotool - used to simulate mouse clicks in the firefox
window
- Python 2.5 - most of the
scripts are written in python.
Extract the archive in your mythplugins
source directoryafter
configuring mythplugins. From the mythfeed directory, run:
qmake-qt4 mythfeed.pro
make -j6
make install
The -j6 parameter allows make to use multiple processors. You should probably have root access for the 'make install.'
To get the plugin to show up on your
menus, copy media_settings.xml from your mythtv install directory
(under path_to_install/share/mythtv) to your home folder ~/.mythtv
and add the following button where appropriate:
<button>
<type>SETTINGS_STREAM</type>
<text>MythFeed Settings</text>
<action>CONFIGPLUGIN mythfeed</action>
<depends>mythfeed</depends>
</button>
Copy over library.xml from the same
place to your home .mythtv directory and add the following button
where appropriate:
<button>
<type>STREAM</type>
<text>MythFeed</text>
<action>PLUGIN mythfeed</action>
<depends>mythfeed</depends>
</button>
RUNNING MYTHFEED
All the configuration is done within
the program.
HULU & CBS INFORMATION
MythFeed scrapes the Hulu and CBS web
pages for show information. Run the gethulu.py or getcbs.py script to
create an .xml file. You may need to edit the script and modify the
play command variable if mythfeed_play.py is not in your $PATH.
In order to keep data up to date, set
up a cron job to run the gethulu.py script. For example, put the
following script in /etc/cron.daily/get_mythfeed
#!/bin/bash
/path/to/mythtv/bin/gethulu.py /path/to/feed/hulu.xml > /dev/null
/path/to/mythtv/bin/getcbs.py /path/to/feed/cbs.xml > /dev/null
and make it executable (sudo chmod 755 /etc/cron.daily/get_hulu). The
exported path tells the scripts where mythfeed_play.py reside (will be
where mythtv binaries are installed). The next path is to the
gethulu.py or getcbs.py executable and will also be the directory
where mythtv binaries are installed. The last path is the output
file. Under MythFeed settings, put the full output file path in "List
of files with feed information."
The first time you run MythFeed, push 'm' for menu, and choose 'Scan
For Changes'. The first run will take a while as it downloads images
for each show. Subsequent runs should only take a few moments. Rerun
whenever you want to update the list of shows. TODO: add option to
automatically scan once a day.
In order to speed up the scanning process (and make the selection of
shows more useful), it's possible to permanently remove feeds so that
they won't be rescanned in the future. Just select the show name (not
the individual episode), push INFO button and choose "Remove Feed."
This will remove the feed and add the name to a list of shows that can
be edited in the settings area. If you accidently add a show to the
list, just go to settings and remove it from the list. If you remove
an episode (not an entire show), it will disappear, but come back next
time you scan for changes.
When you scan for changes, new entries show up under "New" at the
provider level. Shows deleted under "New" will be added to the removed
shows list (they won't be added again when you scan for changes). Move
the cursor over "New" and do "Remove Feed" to delete the entire "New"
list when you're done looking through it if you'd like. Rescanning
will replace (or remove) the old "New" list.
Note: CBS lists some shows as being present, but then they are marked
"expired" if you try to watch them. The current script does not
validate these videos, so if just a black screen comes up for a CBS
show, that's probably what is wrong.
MYTHFEED_PLAY.PY INFORMATION
Playing a stream through
mythfeed_play.py should open a firefox window and then click on the
"Fullscreen" button in the Hulu or CBS player. If it
doesn't you'll need to figure out why the script can't find the
button. There are a number of .ppm (image) files in the
'scripts/images' directory. These images are what the script looks
for on the screen. If the whole image is not on the screen (Firefox
isn't scrolled down enough, or too much, or the icon or resolution of
the icon has changed) then it will not be able to click it
automatically.
If the icon has changed, you can
replace the .ppm file with one that matches. The easiest way to do
that is to capture the screen with the icon on it with PrtScr key,
and copy that into the GIMP. Select and copy the icon of interest and
paste it into a new file, and save it off as a .ppm file, using the
same name the image was before (so hulu_fullscreen.ppm, for example).
Overwrite the image in the scripts/images directory (either in the
installed directory, or in the source and then reinstall MythFeed).
The smallest the picture you can capture and still be unique, the
better, because that will help the script find the picture more
quickly.
If the script is not scrolling the
Firefox window far enough, or scrolling too far, you can change the
number of keypresses in the script. Look at the "Script
variables" section of the script to change as necessary.
PANDORA INFORMATION
Unfortunately Pandora is not as slick.
Pandora keeps track of which user and station you want through .sol
files in the .macromedia directory. To add Pandora stations to
MythFeed, you must visit Pandora in a web browser, log in, and select
the station you want. At this point, you need to make copies of the
"cookies" that Pandora has left, so that MythFeed can copy
them back in the future.
For example, if I want to add two
stations for two different users,
- log in as User1 and select his
"Dave Matthews" station. While that's playing,
- look in the
~/.macromedia/Flash_Player/#SharedObjects/[USERNUMBER?]/pandora.com/
folder and copy v4_UserCredentials.sol to User1.sol and
- copy v3_Machine.sol to
davematthews.sol.
- Then switch to Cranberries in the
web interface and
- copy v3_Machine.sol to
cranberries.sol.
- Next log out and back in as User2,
select User2's first station (Bach) and
- copy v4_UserCredentials.sol to
User2.sol and
- copy v3_Machine.sol to bach.sol.
- Finally I'd select the Phish
station, and
- copy v3_Machine.sol to phish.sol.
Next step is to (unfortunately for now)
hand-craft the .xml file. Create a pandora.xml file in your feed
directory (probably where ever hulu.xml is) and fill it in as follows
(with your own info, of course. This is how the example above would
fill it in). The final variable "browser" tells whether you
want to open Pandora in Firefox or flashplayer. Firefox will make all
the other features work ("About this music", buying music,
etc), but flashplayer will let you maximize the player to fill the
screen. Opening in Firefox should be more robust, so if flashplayer
starts failing, try switching to Firefox.
<MediaStreams>
<Feed><Name>Pandora</Name><Provider>Pandora</Provider>
<FeedImage>http://www.pandora.com/images/logo_pandora.jpg</FeedImage>
<Streams></Streams></Feed>
<Feed><Name>User1's Stations</Name><Provider>Pandora</Provider>
<Synopsis>Listen to music you might like</Synopsis>
<FeedImage>http://www.pandora.com/images/logo_pandora.jpg</FeedImage>
<Streams>
<Stream>
<Name>Cranberries</Name>
<Url>http://www.pandora.com/?user=User1.sol&station=cranberries.sol&browser=true</Url>
<Subtitle></Subtitle>
<Synopsis>Listen to Cranberries</Synopsis>
<StreamImage>http://www.schwarz-wie-ebenholz.de/weiss-wie-schnee/WasIchHoere/cranberries-logo.jpg</StreamImage>
<ContentRating>G</ContentRating>
<PlayCommand>mythfeed_play.py %s</PlayCommand>
</Stream>
<Stream>
<Name>Dave Matthews</Name>
<Url>http://www.pandora.com/?user=User1.sol&station=davematthews.sol&browser=true</Url>
<Subtitle></Subtitle>
<Synopsis>Listen to Dave Matthews</Synopsis>
<StreamImage>http://www.brandsoftheworld.com/brands/0011/5113/brand.gif</StreamImage>
<ContentRating>G</ContentRating>
<PlayCommand>mythfeed_play.py %s</PlayCommand>
</Stream>
</Streams></Feed>
<Feed><Name>User2's Stations</Name><Provider>Pandora</Provider>
<Synopsis>Listen to music you might like</Synopsis>
<FeedImage>http://www.pandora.com/images/logo_pandora.jpg</FeedImage>
<Streams>
<Stream>
<Name>Bach Music</Name>
<Url>http://www.pandora.com/?user=User2.sol&station=bach.sol&browser=true</Url>
<Subtitle></Subtitle>
<Synopsis>Rockin' oldies</Synopsis>
<StreamImage>http://www.findapicture...</StreamImage>
<ContentRating>G</ContentRating>
<PlayCommand>mythfeed_play.py %s</PlayCommand>
</Stream>
<Stream>
<Name>Phish Music</Name>
<Url>http://www.pandora.com/?user=User2.sol&station=phish.sol&browser=true</Url>
<Subtitle></Subtitle>
<Synopsis>Phish</Synopsis>
<StreamImage>http://www.findapicture...</StreamImage>
<ContentRating>G</ContentRating>
<PlayCommand>mythfeed_play.py %s</PlayCommand>
</Stream>
</Streams></Feed>
</MediaStreams>
This is what I was able to come up with in
one night, if anyone can automate it please let me know
(mythfeed (at) gmail.com). The python script copies the named user and
station files over the v4_UserCredentials files and v3_Machine.sol,
and then runs flashplayer (or Firefox) with the address in the url
(minus everything after the '?').
PARENTAL LEVEL INFORMATION
MythFeed supports the ability to limit
what can be viewed without a password/pin. There are 4 different
levels that a feed/file can be set at. From within the configuration
you can select a default level. Any feeds/files at or below that
level will show up in the list.
MythFeed will only stay at that level
until you try to change the level (by hitting keys 1-4 in the Browse
or List screens).
Note: A feed that is set to level 0
will not be seen in any lists other than the feed manager. The Feed
Manager has complete control over the parental levels of each feed.
For this reason, if the level 4 password is set, you will be prompted
upon entering the Feed Manager for the level 4 password.
In addition you can enter a list of
ratings that should never be added to the library on the parental
control screen (this will also speed up scanning), as well as set
options for automatic level marking based on content rating. The
default settings illustrate how to do this. You must enable the
automatic marking before it takes effect.
LIRC INTEGRATION
Obviously lirc can't tie directly into flashplayer, nor the flash plugin in Firefox, but mythfeed_play.py tries to simulate mouse presses or
keystrokes for the different players. You'll need xdotool (Ubuntu:
sudo apt-get install xdotool) to send the signals. Your .lircrc file
will execute mythfeed_send.py with irexec and the appropriate
command. Make sure to put the correct path to mythfeed_send.py in
your .lircrc. ThumbUp, ThumbDown, and Skip only apply to Pandora.
.lircrc entries:
begin
prog = irexec
button = play
config = /usr/local/mythtv/bin/mythfeed_send.py Play
repeat = 1
delay = 30
end
begin
prog = irexec
button = pause
config = /usr/local/mythtv/bin/mythfeed_send.py Play
repeat = 1
delay = 30
end
begin
prog = irexec
button = display
config = /usr/local/mythtv/bin/mythfeed_send.py Fullscreen
repeat = 1
delay = 30
end
begin
prog = irexec
button = up
config = /usr/local/mythtv/bin/mythfeed_send.py ThumbUp
repeat = 1
delay = 30
end
begin
prog = irexec
button = down
config = /usr/local/mythtv/bin/mythfeed_send.py ThumbDown
repeat = 1
delay = 30
end
begin
prog = irexec
button = Ch+
config = /usr/local/mythtv/bin/mythfeed_send.py Skip
repeat = 1
delay = 30
end
begin
prog = irexec
button = ff
config = /usr/local/mythtv/bin/mythfeed_send.py Skip
repeat = 1
delay = 30
end
begin
prog = irexec
button = recall
config = /usr/local/mythtv/bin/mythfeed_send.py Escape
repeat = 1
delay = 30
end
NEXT STEPS
The more correct way for this plugin to work would be for the backend
to update the database with video entries in the background without a
cron job. Ideally someone will figure out the API that Hulu Desktop
uses and it could take advantage of that for communication with
Hulu. Maybe Hulu will get wise and allow users to create efficient
interfaces rather than scraping HTML. It would be nice if they stopped
forbidding redistribution of content lists as well.
As far as playing Flash links, it should not be too hard to use
MythUIBrowser and bring up a fullscreen Flash window instead of
calling Firefox. Even better would be to write something that calls
the Flash plugin directly.
FURTHER INFORMATION
Feel free to subscribe to the
development mailing list at:
http://www.mythtv.org/mailman/listinfo/mythtv-dev
A list that's restricted to the svn
commit messages is available at:
http://www.mythtv.org/mailman/listinfo/mythtv-commits