RSS

Errors with MiroBridge

0 Comments | This entry was posted on May 30 2010

For a while in MythTV 0.22 I was getting an error with MiroBridge saying Miro was not set up properly even though Miro worked just fine and I triple checked all my config files. I waited until upgrading to MythTV 0.23 to fix it because there was a much easier one button install option in Mythbuntu Control Centre. MiroBridge ran successfully once but I started getting files added to my recordings screen that didn’t exist. Once I manually cleared out the files MiroBridge automatically ran again but caused even more problems by having the two non-recordings show up 44 times.

Once I got all of those recordings removed MiroBridge would never successfully run for me again. I could run MiroBridge manually but every time I would get an error

AttributeError: ‘NoneType’ object has no attribute ‘lower’

and MiroBridge would just hang. I would have to force quit the script and never got past that point. I figured out how to fix this issue with a lot of Googling. The problem happens because all of those files that didn’t exist from before were referenced in my database and MiroBridge was trying to remove them. Because they weren’t cleanly removed from the recordings screen (or Miro) MiroBridge couldn’t delete the listings. So what we have to do is clean up these erroneous database references manually. If you have phpMyAdmin installed on your machine you can easily delete these referenced recordings through there but I didn’t want to have something else installed on my MythTV box so I did it through the terminal. Before you go on this is a great chance to learn how to use screen because we are going to want to reference a lot of information from a bunch of different terminal windows. You can either do this with multiple terminals or you can be cool and do it with screen.

Here are the steps you need to take to fix this error.

Step 1. Troubleshoot and Backup
Close out of MythTV and open a terminal. From the terminal run MiroBridge with the simulate option (-s) and redirect the output to a file (>). In MythBuntu 10.04 the command is
/usr/share/doc/mythtv-backend/contrib/imports/mirobridge/mirobridge.py -s > mirobridge.log
BTW this command needs to be run from the local machine and not through ssh because I believe the $DISPLAY variable isn’t set to :0 so MiroBridge gets confused when you are remote. We could change that variable but it is just as easy to work from the local machine.
Now we need to make sure you are having the same error I was having. To do this we are going to read that file you just created and check for any lines that tell MiroBridge to delete old recordings from the database.
cat mirobridge.log | grep oldrecorded
If you don’t have any output from this then you probably have a different error than what I was getting. If you have a bunch of lines outputted that look like this

Simulation: Remove orphaned oldrecorded record (None – ?????)

Then you have the exact same error and should continue on to the next step. Make note of the ????? value cause we will need it later. It should be the name of the video file that was giving us errors.
It is a good idea to always backup your mythconverg database so you may want to run this before continuing
/usr/share/mythtv/mythconverg_backup.pl

Step 2. Close Miro
ps aux | grep miro
Find each line that says something like /usr/bin/miro or mirobridge.py and then get the number at the front of that line and type kill *number* If you have more than 1 line just put each number and it will kill all of the running instances.
Now that Miro and MiroBridge have been killed move on to manually removing the recordings information form the database.

Step 3. Remove old data
First thing you will need is your database username and password. The easiest way to get this is just to use
cat /etc/mythtv/mysql.txt
At the begining of the output you should have DBUserName and DBName. You will need both of those but it is probably mythtv and mythconverg so make sure you also get the DBPassword near the bottom of that output.
Once you have that information connect to your mysql server. Replace ‘password’ with your actual password from the /etc/mythtv/mysql.txt file.
mysql --user=mythtv --password='password'
Then we just want to make sure we have the right mysql server (just because it is better to be safe than sorry).

SHOW DATABASES;
You should see your mythconverg table here so go ahead and use it.

USE mythconverg;
SHOW TABLES;

You should then see a whole lot of tables but the one we want is the oldrecorded table. Just to make sure we have the right information you are going to view all the erroneous database entries before you delete them. For the ????? you need to use the recording name that you got from step 1. Make sure you use the correct case when searching for the information.
SELECT * FROM oldrecorded WHERE subtitle = "?????";
If there were more than one different entry names simply put OR subtitle = “?????” with your next value. In my case I had two different recordings that caused the problem so I used
SELECT * FROM oldrecorded WHERE subtitle = "STALKER_REPORTER_ITUNES.mp4" OR "tekzilla--tzdaily--0464--2009-10-16gmaps--hd.h264.mp4";
This should list all of the entries so now you just need to delete them from the database.

DELETE FROM oldrecorded WHERE subtitle = "?????";
Just like above you can use the OR command to delete multiple entries at once.
Once the entries are deleted just type exit; to leave mysql and go back to the normal shell prompt.

Step 4. Test
Now that the the entries have been deleted repeat step 1 again and you shouldn’t have any lines returned that say
Simulation: Remove orphaned oldrecorded record (None - ?????)
You should then be able to run MiroBridge without the simulation option and get your Miro videos imported into your recordings. It is a good idea to still use the verbose (-V) option just to make sure everything goes smoothly.
/usr/share/doc/mythtv-backend/contrib/imports/mirobridge/mirobridge.py -V

That is all you need to do. Just make sure you set up your cron job to automatically run MiroBridge however often you want and you should be all set.

I hop this helps and leave a comment below if you have any questions.

Buying a NAS part III

0 Comments | This entry was posted on Oct 22 2008

Ok, it has been quite a while since my first two articles on this (Part 1 and Part 2) and I wanted to post a little update on my situation. I haven’t worked on my linkstation hard drive because I decided to go a slightly different route. Ultimately, I want something that has some sort of RAID set up for backup purposes but at this time I don’t have the time, money, or space for such a device. Instead I decided to use my MythTV computer as my network storage device on top of its current PVR functions. Because MythTV will be a full computer it will have a lot more features and options I can use to configure and set up the NAS exactly as I want. This will also mean that I only have to have one device on at all times instead of my originally planned 2 devices which will save a bit of money in power bills. I finally have a computer that is going to work for my new MythTV setup (more on that to come) so as I get that configured I hope to post some more how-to’s on my quest for the perfect cheap NAS solution.
Just so I get some of my goals in place here are my current needs for the NAS setup.

    1. Separate users to allow read only access to certain folders and write permissions to others.
    2. At least 500 GB.
    3. Upnp server to allow easy playback on my PS3, XBMC, WMP, etc.
    4. Under $300. While this is still a goal it is going to be quite skewed with my budget for my MythTV computer. I will try to add all the cost up correctly though.

Two more items were on my list from my first posting so I will echo them here as well.

    5. Be able to connect to a ethernet network without adapters. This won’t be a problem at all because my MythTV computer will be plugged into the network at all times.
    6. Low power consumption. While the MythTV computer will draw more power than my original Linkstation, the ability to get rid of the Linkstation in favor for just having one device will defiantly save power over having both devices turned on at all times.

So I haven’t given up on getting my NAS up and running but my plans changed a little. For now the Linkstation still gets used every day and it is helping a lot with temporary storage. I will keep the site update with my install notes and what has worked for me.

Buying a Nas part II

3 Comments | This entry was posted on Apr 12 2008

The Linkstation was not satifying what I needed. So I turned to the internet to see what I could do about the problems I was having. I found a site called Nas-central which happened to have a ton of info about hacking the Buffalo NAS devices. The site had so much information it wasn’t well organized so I spent a good amount of time just figuring out what I could do with the Linkstation. I started my search by finding out more about what the Linkstation has out of the box, and then what I could do with it. It turns out the Linkstation runs a Buffalo modified version of Linux and because of that it is pretty easily hacked with a few utilities.

The first thing was to figure out what operating system I wanted to run on the Linkstation. I found a few main options. Most people would either hack the standard firmware, install a modified buffalo firmware called jtymod, install a more open version of the buffalo firmware called openlink, or install a full replacement with a build of debian linux called freelink. All three options had very good merits, but for my needs I tried to just wanted to get a better DLNA server installed so I decided to modify the current buffalo firmware using acp_commander.

The next thing I needed to decide was what DLNA server I was going to install. I had no idea there were so many DLNA servers out there. The main options I found were mediatomb, ushare, FUPPES, and twonky. I was already pretty familiar with mediatomb because I was using that on my desktop for sharing media. I was familiar enough with it to know I wanted to look for something else. While ushare and FUPPES seemed pretty limited in their options they had one big advantage over twonky.  They are free whereas twonky costs $30. I really liked the features of twonky 4.4.4 so I installed the 30 day trial and gave it a test drive with my PS3. I was very impressed. Not only did twonky have a great web interface to configure everything you could want, but it also worked right away in Windows Media player 11. As soon as twonky scanned all of my media I was able to play almost everything on my PS3 without problems.  I had a couple of problems with videos cutting out but quickly realized that the wireless network was not able to keep up with the high bit rates of some of my videos. It turns out that with twonky installed and the default DLNA server turned off a lot of the hard drive noise was gone as well.

So I got a replacement DLNA server installed and fixed the problem with the drive being loud. But I wasn’t finished. The default firmware still gave me very limited samba settings and required all of my folders to be ordered in a fassion that only my grandma would do if she had 200 GB of divx files. So next I need to installed Freelink.

Buying a NAS Part I

1 Comment | This entry was posted on Apr 12 2008

I have been looking for a network attached storage (NAS) device for some time because keeping everything on my desktop was not the best solution. Here is what I needed my NAS to do:

  1. Connect to the wired network without adapters. Wireless would be nice but lets face it.  With media files you really want it on a wired network no matter what.
  2. Be quiet and use low power.  Not silent desktop kinda quiet (see refrigerator), more like the wife will forget it is behind the couch kinda quiet. I have free computers that I could easly put FreeNAS on and just have it sit somewhere but that would not be quiet enough and would draw more power than a dedicated device.
  3. Lots of storage! 400 gb of usable storage was my minimum and having expandability through USB would be a plus.  RAID 1 was also a desire but was out of the question for my price range.  Manual backups would have to suffice for now.
  4. SAMBA server and DLNA server built in. I have used XBMC for about four years to stream my media to my TV and it uses samba to stream all of it’s content.  I have just recently started using my PS3 for these tasks because it plays all the codecs I need and it is easy!! I don’t have to explain to someone how to search the network or share a folder on their computer. This has been a life saver for my setup because I don’t need to worry when a folder changes.  The DLNA server just scans it and shares the media exactly the same as it was.
  5. This was probably my biggest opsticle…I needed the solution to be under $300. I know that this may seem like a lot, and when I was first looking I thought I wouldn’t have any problems finding what I needed. It turns out there wern’t as many available options as I first thought.

I had been looking at the Buffalo Terrastation for a little while because it came with 4 drives and had everything I wanted, minus quietness, but the system started at $700 and quickly climbed in price from there. I had also been looking at the Terrastations lower priced cousin the Linkstation Pro‘s but they did not support DLNA and were quite expensive when I was looking.

I was at Fry’s one weekend and saw the Netgear Sc101 for $40. Wow, $40 for a two drive NAS enclosure how could I go wrong? The device only supported IDE drives but I wasn’t too worried because I had a few 200 GB IDE drives that I could use in this to get the storage I wanted.  I also figured that I could find some way to mod it, or follow directions online to mod it, to get some of the missing features to work. I brought the Netgear home and put in my two drives. I open up the manual to see how I can map the drive in Ubuntu and quickly find that the hard drive can only be used in Windows because it loads a proprietary driver into windows to mount the drive locally. So back in the box it goes and sits for another week until I am able to go back to Fry’s to return it.

I returned the Netgear and waited for the next weekend to see what new deals would spring up the following weekend. I went back the next Saturday and saw that they had the Linkstation Live 500 for $170. There was only 1 left on the shelf and I didn’t know much about it but I saw on the box that it supported DLNA so I bought it on the spot and brought it home with much anticipation of how awsome it was going to be. I open up the box and plug it into a local switch and start a disk format.  The drive already showed it was formatted but if this is going to be my main storage device I want to make sure everything is as clean as can be. The format seemed to be taking a little while (hours) so I just let it run through the night.  In the morning the format was still not done and I was getting worried. I let the format run while I was at work and when I got home I was greated with a nice “the drive is not formatted error” in the web interface.  I upgraded the firmware to the current one on Buffalo’s website, 2.10, and started another format.  This time it went much faster ~30 min. and I was ready to transfer everything over.  I started with everything on my desktop because my hard drive had 20mb left of free space and ubuntu was starting to complain.

Once I got most everything copied over from my desktop, 1 day of transfering, I enabled the DLNA sever and tested it with my PS3. I was very disapointed! I could see the server but couldn’t see/play any of the files. The drive also seemed pretty loud. So far this was not a good solution for what I wanted…