<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xml:lang="en" xml:base="http://jeffd.org/blog/wp-atom.php">
	<title type="text">Dirty Code</title>
	<subtitle type="text">Horrible. Horrible. Code.</subtitle>

	<updated>2009-04-05T04:00:26Z</updated>
	<generator uri="http://wordpress.org/" version="2.8.5">WordPress</generator>

	<link rel="alternate" type="text/html" href="http://jeffd.org/blog" />
	<id>http://jeffd.org/blog/feed/atom/</id>
	

			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/DirtyCode" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="dirtycode" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
		<author>
			<name>Jeff Dlouhy</name>
						<uri>http://jeffd.org</uri>
					</author>
		<title type="html"><![CDATA[Fun With mythtvfs]]></title>
		<link rel="alternate" type="text/html" href="http://jeffd.org/blog/fun-with-mythtvfs/" />
		<id>http://jeffd.org/blog/?p=67</id>
		<updated>2009-04-05T04:00:26Z</updated>
		<published>2009-04-05T02:16:03Z</published>
		<category scheme="http://jeffd.org/blog" term="MythTV" /><category scheme="http://jeffd.org/blog" term="fuse" /><category scheme="http://jeffd.org/blog" term="linux" />		<summary type="html"><![CDATA[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 [...]]]></summary>
		<content type="html" xml:base="http://jeffd.org/blog/fun-with-mythtvfs/"><![CDATA[<p>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 <a href="http://www.mythtv.org/">MythTV</a> 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.</p>
<p><span id="more-67"></span>It is easy to <a href="http://en.wikipedia.org/wiki/Samba_(software)">samba</a> mount the remote video directory that is used with the <a href="http://www.mythtv.org/wiki/Mythvideo">MythVideo</a> plugin. If we have the computers livingroom and bedroom and the remote samba share is called &#8216;videos&#8217;, the command run on livingroom is:</p>
<pre class="brush: plain">
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
</pre>
<p>So we run &#8216;ls&#8217; and we get what we expect.</p>
<pre class="brush: plain">
livingroom% ls /data/media/video/remote/bedroom-videos
movies/  music/  tv/
</pre>
<p>So now lets mount the recordings directory on the remote backend on bedroom. The remote samba share is named &#8216;recordings.&#8217;</p>
<pre class="brush: plain">
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
</pre>
<p>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.</p>
<pre class="brush: plain">
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
</pre>
<p>This is where <a href="http://manpages.ubuntu.com/manpages/hardy/man1/mythtvfs.1.html">mythtvfs</a> comes in handy. mythtvfs is a <a href="http://en.wikipedia.org/wiki/Filesystem_in_Userspace">FUSE</a> <a href="http://en.wikipedia.org/wiki/Virtual_file_system">virtual file system</a> 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 <em>/proc</em>directory in Linux is another example of a virtual file system.</p>
<p>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 <a href="http://en.wikipedia.org/wiki/Mplayer">mplayer</a> or <a href="http://en.wikipedia.org/wiki/Vlc">vlc</a>.</p>
<p>mythtvfs is available <a href="http://outflux.net/software/pkgs/mythtvfs-fuse/">here</a>.</p>
<p>To install mythtvfs on Ubuntu (tested on 8.10) run:</p>
<pre class="brush: plain">
sudo apt-get install mythtvfs
</pre>
<p>With the remote recordings directory on the bedroom backend still mounted, we mount the virtual file system with mythtvfs.</p>
<pre class="brush: plain">
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
</pre>
<p>Drumroll please &#8230;</p>
<pre class="brush: plain">
livingroom% ls /data/media/video/remote/bedroom-fuse

{Life&#039;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&#039;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&#039; 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&#039; Europe}{2008-8-11}{Edinburgh}{09.00 AM Mon Aug 11, 2008}{Create}{1800}{Edinburgh Castle; the new Scottish Parliament Building; Her Majesty&#039;s Yacht Britannia.}1443_20080811090000.mpg.mpg*
</pre>
<p>From MythVideo, drill down to <em>/data/media/video/remote/bedroom-fuse</em> and select a video, then sit back and enjoy!</p>
<p>If you want this to always be connected you can add something like this to your <em>/etc/fstab</em>.</p>
<pre class="brush: plain">
//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
</pre>
]]></content>
		<link rel="replies" type="text/html" href="http://jeffd.org/blog/fun-with-mythtvfs/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://jeffd.org/blog/fun-with-mythtvfs/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	</entry>
	</feed>
