Tuesday, May 15, 2012

Setting Up the MythTV Pretty Filenames Script

MythTV recording file names look like this: 1320_20120515120000.mpg. You can use a contributed perl script to create a symbolic link that looks like this: House_2012-05-14_9-00_PM_Holding_On.mpg

On my system, Ubuntu 12.04 MythTV 0.25, the perl script created by Chris Peterson is located here: /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl

You can set the script to rename your recordings after they are written with a MythTV user job but I prefer to run the script every hour.

This is the method I use. I setup my directory to hold the symbolic links and put my script in the /etc/cron.hourly directory. Below are the commands to set up the directory (your directory names will be different):

  • sudo mkdir /mnt/disk0/mythtv/pretty
  • sudo chown mythtv /mnt/disk0/mythtv pretty
  • sudo chgrp mythtv /mnt/disk0/mythtv pretty
  • sudo chmod g+w /mnt/disk0/mythtv/pretty

Create the script using nano text editor.

sudo nano /etc/cron.hourly/mythpretty

The script is just a one liner.

#!/bin/sh 
/usr/bin/perl /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --underscores --link /mnt/disk0/mythtv/pretty  --format %T_%Y-%m-%d_%g-%i_%A_%S

Make the script executable.

sudo chmod +x /etc/cron.hourly/mythpretty

Mythlink.pl has many format options. You can read about Mythlink.pl here: http://www.mythtv.org/wiki/Mythlink.pl

Post a Comment