A handy mythtv recording importer

I wanted to export all my saved recordings from my old mythbox, and import them into my new mythbox. Now, with mytharchive, exporting (to a native archive) is easy, just select all the recordings you want to export, then set it going and it exports them all.

Problem is, to import to the new machine, if you use the menu interface you can only import one file at a time, which is a bit of a PITA. So I knocked up the following script, which imports all the programs saved in the current directory. How it works should be pretty obvious, the only slightly clever bit is that it extracts and uses the same channel ID as in the original recording.


# Get all files in current directory
myXMLFiles=$(ls *.xml)
# Loop through all files
for loopFile in $myXMLFiles
  channel=$(cat $loopFile | grep "<chanid>" | sed 's:<chanid>::;s:</chanid>::')
  mytharchivehelper -f $loopFile $channel;

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: