<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pruperting &#187; MythTV</title>
	<atom:link href="http://www.prupert.co.uk/category/mythtv/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.prupert.co.uk</link>
	<description>putting the know back in technology</description>
	<lastBuildDate>Wed, 30 Jun 2010 11:27:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>MythTV Recordings: Rename, Move and Delete From The Database</title>
		<link>http://www.prupert.co.uk/2009/11/12/mythtv-recordings-rename-move-and-delete-from-the-database/</link>
		<comments>http://www.prupert.co.uk/2009/11/12/mythtv-recordings-rename-move-and-delete-from-the-database/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 15:35:49 +0000</pubDate>
		<dc:creator>prupert</dc:creator>
				<category><![CDATA[HTPC]]></category>
		<category><![CDATA[MythTV]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.prupert.co.uk/?p=216</guid>
		<description><![CDATA[So, I have been using MythTV for a while now and it is a.w.e.s.o.m.e.. However, I had one problem, since I transcode and store all my videos on my Ubuntu server and not my MythTV box (which is off most of the time via mythwelcome) I had to manually transfer recorded files to my Ubuntu [...]]]></description>
			<content:encoded><![CDATA[<p>So, I have been using MythTV for a while now and it is a.w.e.s.o.m.e.. However, I had one problem, since I transcode and store all my videos on my Ubuntu server and not my MythTV box (which is off most of the time via mythwelcome) I had to manually transfer recorded files to my Ubuntu server via mythweb.</p>
<p>I thought this was a bit of a hokey solution, so I asked around if there was a script that allowed you to rename MythTV recordings (to a more human readable version), move them to another location and remove them from the MythTV database. There were some solutions out there, but they all involved the recorded files being kept in the MythTV database.</p>
<p><a href="http://www.prupert.co.uk/wp-content/uploads/2009/11/mythtv.png"><img class="alignleft size-full wp-image-217" title="mythtv" src="http://www.prupert.co.uk/wp-content/uploads/2009/11/mythtv.png" alt="mythtv" width="180" height="64" /></a></p>
<p>So, I wrote my own script. This script renames the MythTV files to a nice human understandable version using mythrename.pl, it then moves the recordings to a folder of your choice (in my case a mounted samba share on my server), it then uses myth.find_orphans.pl to delete the moved recordings from the mythTV database (I don&#8217;t know if it will still remember that these files were previously recorded so it doesn&#8217;t rerecord them or not, I guess time will tell).</p>
<p>So, without further ado, here is the script, in lovely Bash (the script is called mythtvremodel (mythtv REname MOve DELete, geddit?):</p>
<p><code><br />
#! /bin/sh<br />
### BEGIN INIT INFO<br />
# Provides: mythtvremodel<br />
# Required-Start:    $local_fs $syslog $remote_fs dbus<br />
# Required-Stop:     $local_fs $syslog $remote_fs<br />
# Default-Start:     2 3 4 5<br />
# Default-Stop:      0 1 6<br />
# Short-Description: rename, move delete recordings<br />
### END INIT INFO<br />
# script to rename files recorded from mythtv and then to move them and delete them<br />
#made by prupert.co.uk<br />
#creative commons licence, whichever is the most FREE (as in beer)</code><br />
<code><br />
#lets put in some variables so others can use this<br />
#location of log file, you can choose anything and any name<br />
log=/path/to/mythtvremodel.log<br />
#this is the full path to mythrename.pl<br />
mrename=/location/to/mythrename.pl<br />
#this is the full path to your recordings folder<br />
record=/var/www/mythweb/data/recordings/<br />
#this is the extension your recordings are stored as, usually mpg or nuv<br />
ext=mpg<br />
#this is the full path to where you want your files moved to<br />
dest=/path/to/folder/to/move/recordings/to/<br />
#this is the full path to myth.find_orphans.pl<br />
morphan=/path/to/myth.find_orphans.pl<br />
#mythtv database password for myth.find_orphans.pl<br />
pass=yourmythtvdatabasepassword</code><br />
<code><br />
# first, run mythtvrename to get nice names for the recordings<br />
echo starting mythtvremodel on `date "+%m/%d/%y %l:%M:%S %p"` &gt; $log<br />
perl $mrename --underscores --format %T-%S-%d%m%y &gt;&gt; $log<br />
# use find to search for all recorded files in the recording folder and move them to the TV folder<br />
find "$record" -name "*.$ext" &gt;&gt; $log<br />
find "$record" -name "*.$ext" -exec mv {} "$dest" \; &gt;&gt; $log<br />
# use mythorphan to remove the now missing recorded files from the database<br />
perl $morphan --pass=$pass --dodbdelete &gt;&gt; $log<br />
#that should be it<br />
echo stopping mythtvremodel on `date "+%m/%d/%y %l:%M:%S %p"` &gt;&gt; $log<br />
exit 0</code></p>
<p>And there you have it. Now, since I run mythbuntu, I have put this script in /etc/rc0.d (thats rc zero . d) and have named it K03mythtvremodel, thus it is run when my system shuts down, but before all the samba shares and drives are unmounted. As I said, since I use mythwelcome to shutdown my machine when idle, this seemed like the best solution.</p>
<p>Hope it helps someone!</p>
 <img src="http://www.prupert.co.uk/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=216" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.prupert.co.uk/2009/11/12/mythtv-recordings-rename-move-and-delete-from-the-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
