Fun With mythtvfs

Saturday, April 4, 2009 at 11:16 pm

When you live with three other computer science majors, you tend to have weird requirements for your software. The situation we have is that two of us run MythTV but only one of our backends is connected to the television in our living room. We wanted to be able to watch the movies off of the second backend as well as the TV recordings.

It is easy to samba mount the remote video directory that is used with the MythVideo plugin. If we have the computers livingroom and bedroom and the remote samba share is called ‘videos’, the command run on livingroom is:

livingroom% mkdir /data/media/video/remote/bedroom-videos

livingroom% sudo smbmount //bedroom/videos /data/media/video/remote/bedroom-videos -o username=mythtv,password=wafflecopter,uid=1000,mask=000

So we run ‘ls’ and we get what we expect.

livingroom% ls /data/media/video/remote/bedroom-videos
movies/  music/  tv/

So now lets mount the recordings directory on the remote backend on bedroom. The remote samba share is named ‘recordings.’

livingroom% mkdir /data/media/video/remote/bedroom-recordings

livingroom% sudo smbmount //bedroom/recordings /data/media/video/remote/bedroom-recordings -o username=mythtv,password=wafflecopter,uid=1000,mask=000

Now when we look at the directory, we get the videos and can play them. The problem is that the filenames are not too user friendly.

livingroom% ls /data/media/video/remote/bedroom-recordings

1035_20090327173000.nuv             1046_20090319230000.nuv.png
1035_20090327173000.nuv.png         1046_20090319230000.nuv.png
1035_20090328140000.nuv             1046_20090330230000.nuv
1035_20090328140000.nuv.png         1046_20090330230000.nuv.png
1035_20090328173000.nuv             1046_20090401013000.nuv

This is where mythtvfs comes in handy. mythtvfs is a FUSE virtual file system that displays the show name, date, and description on the filename. This does not actually change any file on disk, hence it being virtual. You can however interact with it like any other directory on your hard drive and use your favorite UNIX tools on it. The /procdirectory in Linux is another example of a virtual file system.

The nice thing about mythtvfs is that in addition to showing us all the show information in the directory, it also allows us to play the file with things like mplayer or vlc.

mythtvfs is available here.

To install mythtvfs on Ubuntu (tested on 8.10) run:

sudo apt-get install mythtvfs

With the remote recordings directory on the bedroom backend still mounted, we mount the virtual file system with mythtvfs.

livingroom% mkdir /data/media/video/remote/bedroom-fuse

livingroom% mythtvfs -o host=bedroom /data/media/video/Remote/bedroom-recordings /data/media/video/Remote/bedroom-fuse

Drumroll please …

livingroom% ls /data/media/video/remote/bedroom-fuse

{Life's a Trip}{2008-6-2}{Scotland: Golf: Fall in Love}{11.30 PM Mon Jun 02, 2008}{#3053}{1800}{Andrew Anthony travels to Scotland hoping to re-ignite his passion for the game of golf.}3053_20080602233000.mpg.mpg*
{Life's a Trip}{2008-5-26}{Turks and Caicos: Flee Humanity}{11.30 PM Mon May 26, 2008}{#3053}{1800}{Andrew Anthony travels to the white sands of Turks and Caicos.}3053_20080526233000.mpg.mpg*
{Rick Steves' Europe}{2008-6-30}{Eastern Turkey}{09.00 AM Mon Jun 30, 2008}{Create}{1800}{Turkey; sunrise; dam; grease wrestlers; Mount Nemrut; dancing.}1443_20080630090000.mpg.mpg*
{Rick Steves' Europe}{2008-8-11}{Edinburgh}{09.00 AM Mon Aug 11, 2008}{Create}{1800}{Edinburgh Castle; the new Scottish Parliament Building; Her Majesty's Yacht Britannia.}1443_20080811090000.mpg.mpg*

From MythVideo, drill down to /data/media/video/remote/bedroom-fuse and select a video, then sit back and enjoy!

If you want this to always be connected you can add something like this to your /etc/fstab.

//bedroom/recordings /data/media/video/remote/bedroom-recordings smbfs username=mythtv,password=wafflecopter 0 0
/data/media/video/remote/bedroom-fuse /data/media/video/remote/bedroom-recordings fuse noauto,host=bedroom 0 0

Leave a Reply