Syncing Miro with MythTV
(A work in progress)
The code is partly working, feel free to play with it. This project is on hold indefinitely until I save up for a new Myth box that can handle High def. Most of what I want from Miro is High def, and my Xbox can't do it.
It's not Miro, but you may be interested in elisa a cross-platform media center from the folks over at Fluendo. Mathieu Leplatre has created a plugin for it which allows it to sync with Miro. You can access the miro_db.py file directly if you prefer. (link updated June 8, 2008).
- Current Code (Updated Feb 2, 2008)
- Database Layout
- Background / What's this
- Progress (as of Feb 2,2008)
- Expected Outcomes
- Other
Background / What's this?
Miro is a combined RSS / Bittorrent / Video playing program with 2500+ channels. It's open source and does a good job of making it easy to find content. MythTV is a PVR (Personal Video Recorder) / multimedia station for your TV. You typically have one or more apture cards for your Myth box, and record TV to your hard disk, then play it on your TV or computer later.
We don't have cable at the moment, but we wanted to download good quality content to watch at home. The quality of channels on Miro is really a mixed bag, but with 2500 channels and the flexibility it has, we were able to find enough feeds to make us happy.
Well, mostly happy. You see, even though we could play the videos downloaded with Miro through the MythTV interface, all we could see in MythTV was the file names. Names like "sbemail166.m4v" or "aanq_2008-01-23-000303-3.mp4". Miro had more data on the videos, including the titles, synopses, icons, video length, play count and more.
Progress (as of Feb 2,2008)
OK, I figured out a way to link the critical parts of the database. Maybe not the best way, but it seems to be true across various feeds, so I'm posting it here, and will post a correction when something breaks. The script is now pulling the different parts of the database together and creating an array of metadata objects.
item['enclosures']['href'] == remote-downloader['origURL'] item['feed_id'] --> feed
With those links, I'll be able to recreate links between the various bits of information and insert it into the Myth DB.
Disclaimer: I don't know Python. Miro is written in Python, and so I'm stumbling through this. Expect bugs, poorly written code, non-optimal methods, etc. Use at your own risk. This script could delete your Miro videos, wreck the Miro database, hose your MythTV install, who knows. It might not though, so it's your call
You can look at a little bit of the database layout information if you want.
Thanks to the incredible help from several people in #miro-hackers and #utahpython I am now able to read data out of the Miro database. I haven't actually tracked down the values I need yet, or figured out all the places to stuff them in the MythTV database, but we'll get there eventually.
Grab the code as it stands right now. You will need to set your LD_LIBRARY_PATH to point at a directory with libgtkembedmoz.so in it for the code to work. For Ubuntu, you can add this to your ~/.bashrc
export LD_LIBRARY_PATH=/usr/lib/firefoxThe script right now just prints out information about the saved data for each row in your Miro database. It is currently hard coded to open the database named 'sqlitedb' from the current directory.
Expected Outcomes
Within the next several weeks I expect to be transfering data from the Miro database to the MythTV database. I plan on having the script determine the user's sqlitedb location from their Miro settings. The end result script could have 3 possible outcomes. They are:
- A script that could be set to run by Cron every day or so
- A plugin for MythTV which is called when the Mythvideo plugin is first loaded
- A plugin for Miro which is called each time something new is done downloading
- Miro doesn't yet have a plugin infrastructure, so this would actually be more like a patch to Miro
Other
I'm making this on Ubuntu 7.10 and against Miro 1.1. It may or may not work on your system! (ok, technically it doesn't work on my system yet either). My Myth backend is on this machine and is where the script will run from.

