Uncategorized
How to update Mythvideo file titles
by james on Sep.13, 2010, under Uncategorized
The title of the post is a little confusing, I’ll admit that straight away. Here is the problem. I had a bunch of series AVI files name as such: 101.avi 102.avi 103.avi … ad nauseum. This was great, but episode titles make it easier to pick out which one I really want to watch. Especially when I’m using UPNP. So I renamed all my files to be like 101.Rose.avi. Great, super easy to tell what the episode is about!
Good thing mythtv is smart and made hashes of all the files. Now it knows that 101.Rose.avi might as well be 101.avi. Awesome! If I had trailers, poster-art, and other metadata it would be right there with the files with new names. Unfortunately, what it didn’t change was the title. So when I look at my videos in mythfrontend 101.Rose.avi is called 101. The titles didn’t update. Well, this is good behavior. If we’re going to track which file is which by hashes, then we don’t want to change the title just because the filename changed (or path I’m presuming).
This is not the behavior I wanted though. I searched a little bit, but couldn’t find anything. I did find out the structure of videometadata though. That gave me the clue to just write a script to update the titles based on the filenames. Here we go, in glorious PHP:
//replace master_IP with your MySQL IP address and password with whatever your password is
$con = mysql_connect("master_IP","mythtv","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mythconverg", $con);
//if you want all the files the next line is good. Otherwise see line after that
$myquery = "SELECT intid,title,filename FROM videometadata";
//I did it for a subset of files which is why I used LIKE to match part of the path in the filename field
//$myquery = "SELECT intid,title,filename FROM videometadata WHERE filename ". 'LIKE "%who%"';
$myquery_rows = mysql_query($myquery);
while ($myrow = mysql_fetch_array($myquery_rows)) {
//update query
$new_title = substr(basename($myrow['filename']), 0, strrpos(basename($myrow['filename']), '.'));
$up_query = "UPDATE videometadata SET title = '" . $new_title . "' WHERE intid = '" . $myrow['intid'] . "'";
print $up_query;
//mysql_query($up_query); //uncomment this after you're satisfied with the output
}
mysql_close($con);
To protect the innocent I have it just print what it would change the titles to. All you have to do is uncomment the mysql_query line. Sorry the code plugin I have squashed my tabs. Not a deal breaker, but it would be easier to read. Also, the code plugin doesn’t like php tags you’ll have to add them. The next script is probably the one you want to run first. It just prints the intid, title, and filename (which in my case included path) for each file. This is handy to see if the filenames/titles match. Also, to see if your update went well.
$con = mysql_connect("master_IP","mythtv","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mythconverg", $con);
//if you want all the files the next line is good. Otherwise see line after that
$myquery = "SELECT intid,title,filename FROM videometadata";
//I did it for a subset of files which is why I used LIKE to match part of the path in the filename field
//$myquery = "SELECT intid,title,filename FROM videometadata WHERE filename ". 'LIKE "%who%"';
$myquery_rows = mysql_query($myquery);
while ($myrow = mysql_fetch_array($myquery_rows)) {
print $myrow['intid'] . " | " . $myrow['title'] . " | " . $myrow['filename'] ."\n";
}
mysql_close($con);
Please don’t go running amok in your database and blame me for it getting screwed. Use mysqldump before running the update script. Although it should be pretty innocuous because you can always use mythfrontend to rebuild the videometadata database. Though you would lose any metadata you had input for your files. Happy hunting! Maybe I’ll port this to a proper scripting language like PERL or python. Or maybe someone’s nice enough to do it for the rest of us???
Western Digital Elements
by james on Jul.11, 2010, under Uncategorized
So I bought a Western Digital Elements 1TB drive last week. For some reason it’s a mystery what’s inside these devices. I decided to disassemble, open up, take apart, dismantle, autopsy or whatever you call it so that I can document what’s inside. Mine which has the model number “wdbaau001hbk-01″ on the bottom has a “wd10ears-00y5b1″ drive in it, WD Caviar Green SATA/64MB cache 5400RPM. I think it’s a pretty enclosure, but not at all necessary. I apologize, I can’t find where I found instructions to open it. It’s pretty straight forward. Use a knife or something with a good edge to pry it open a little. Then I used a guitar pick to go around the edge and pry the clips along the inside. I’m going to do some crazy stuff to it, more to come. Maybe some pictures!
Mythvideo now compiled
by james on Mar.14, 2010, under Uncategorized
So, I switched to myth-0.22 awhile back because I finally got a sane database. No thanks to the mythtv guys, many thanks to the Gentoo guys for pointing out the bad behavior of mythtv not checking encoding formats and just assuming. I had been trying out the SVN version because 0.22 was broken in Portage. Long story short I haven’t been able to build mythvideo for months. Today I finally tried looking at the build log and internet searching. For reference here are the first few errors in the log file:
In file included from metadata.cpp:8:
/usr/local/include/mythtv/mythcontext.h:9:22: error: qptrlist.h: No such file or directory
In file included from main.cpp:18:
/usr/local/include/mythtv/mythcontext.h:9:22: error: qptrlist.h: No such file or directory
/usr/local/include/mythtv/mythcontext.h:13:23: error: qnetwork.h: No such file or directory
/usr/local/include/mythtv/mythcontext.h:13:23: error: qnetwork.h: No such file or directory
I stumbled upon someone else who couldn’t build that was getting similar errors to mine http://mythtv.org/pipermail/mythtv-users/2008-November/238546.html The problem was that the prefix for SVN is /usr/local/ whereas the ebuild prefix is /usr/ The quick and dirty solution:
mv /usr/local/include/mythtv /usr/local/include/mythtv-old
ln -snf /usr/include/mythtv /usr/local/include/mythtv
That solved the problem immediately, but I think the real problem is the ebuild. I checked the mythtv ebuild and the prefix is defined as /usr/, but the mythvideo ebuild does not have a prefix defined. I believe the solution is to define the prefix in the ebuild or make the symlink in the ebuild for mythtv.
Either way, I’m super-stoked! Now I can get back to encoding everything to something besides MPEG2 and watching it with mythtv instead of xine or mplayer.
Chromium OS uses Gentoo?
by james on Feb.27, 2010, under Uncategorized
Just poking around Chromium pages (you know “Google ChromeOS”) and found some interesting stuff. They have a page about building the OS http://dev.chromium.org/chromium-os/building-chromium-os/portage-based-build First the URL says it all Portage based build. Later in the page they have emerge-<board_name>. Then about ebuilds and their chromium-overlay.
Does it actually use Gentoo? I’m not sure what their overlay has, but it seems like they are using Portage to build and maybe some Gentoo patches along the way. Check out the part about dependencies. It clearly has eselect ebuilds and gentoo-syntax for vim. Also, core-utils with -vanilla USE flag (as in include Gentoo patches). Why use Portage though? Especially since the user already has a working system and can install missing dependencies. Why not use Paludis? Well Google isn’t the only ones to ever use Portage in their project. I believe Openembedded’s bitbake is Portage based also.
Anyways, way to go Gentoo! Helping the world reach a brighter tomorrow!
Live TV Working
by james on Jul.20, 2009, under Uncategorized
Searching continued for watching Live TV with Hauppauge HVR950Q and mythtv… Found mythtv mail-list post, from yesterday, about xc5000 and not being able to watch Live TV. My initial suspicions were correct. Firmware was taking way too long to load, supposedly about 7 seconds! That causes time-out and Live TV fails. I guess the timeout for recording is high enough that recordings work. When I set up the card initially I ticked the box to “Open DVB card on demand”. This means that when the backend isn’t using it the card is in “power off”, the tuner is not on, amber light is off, device is free for any program to grab it. Sounds great then if I want I can use mplayer to watch streams and the card will be off most of the time. So the solution is to untick the box. This loads the firmware when mythbackend starts and the card is left “power on” so that the firmware is only loaded once and not every time the backend wants to use the card. Good fix for now, but I might try tweaking the timeout settings so that I can retick the box. I’ll add an update for what I find out. Other good news, I successfully recorded 2 streams on the one device the other day. It seems like comcast has a large amount (over 10) of streams at 83.X so I should be able to record a lot of streams at once. Awesome!
On a separate note I was doing some updates and my xorg got screwy. At first it wasn’t working at all, after reinstalling ati-drivers and rebuilding xorg, banging my head on the wall, it worked. QT is messed up though, when I start mythfrontend fullscreen the screen is totally corrupted video playback is corrupted. Tried rebuilding mythtv to no avail. If I “mythfrontend –geometry 1438×898″ it is almost fullscreen and not corrupted at all. Again, I’ll update when I find something out.