- 1 Making MythTV recordings more Share Friendly
- 2 Locating and Enabling the mythrename.pl file
- 3 Mythrename.pl Usage
- 4 Creating your own version of the script (the one I use)
- 5 Schedule the job as cron
- 6 Run it as a User Job after recording
- 7 Method 1 - Using MythTV-Setup
- 8 Method 2 - Using Mythweb (Easiest)
- 9 Conclusion
- 10 Warnings
So, you have your LMCE system happily recording all your favorite shows, and you have a linux/windows/mac box that you wish to use to watch these shows, with XBMC or whatever your poison. Here is the issue. LMCE happily shares out /home for all systems connected to the LMCE internal network. So you browse over to /home/public/data/videos/tv_shows_1 and what do you see?
1108_20080902080022.mpg 1124_20080829205855.mpg 1131_20080831230000.mpg 1131_20080831233000.mpg 1135_20080901010000.mpg 1135_20080903002000.mpg 1136_20080902220000.mpg 1136_20080903070216.mpg 1136_20080903073000.mpg 1136_20080903080000.mpg 1169_20080830160000.mpg 1169_20080830163000.mpg 1169_20080831160000.mpg 1169_20080831163000.mpg 1169_20080902163000.mpg 1169_20080902213038.mpg
But what you want to see is :
Lost Boys- The Tribe - 2008-08-02, 1-00 AM.mpg Not Going Out - 2008-08-12, 11-40 PM.mpg Not Going Out - 2008-08-19, 11-40 PM.mpg Primeval - 2008-08-23, 9-00 PM.mpg Radio - 2008-08-11, 8-14 PM.nuv Skins - 2008-08-24, 10-00 PM - Jal.mpg Skins - 2008-08-24, 9-00 PM - Cassie.mpg Skins - 2008-09-01, 1-00 AM - Chris.mpg South Park - 2008-07-26, 10-00 PM - Simpsons Already Did It.mpg South Park - 2008-07-26, 10-30 PM - Make Love, Not Warcraft.mpg South Park - 2008-07-26, 11-00 PM - Good Times With Weapons.mpg South Park - 2008-07-26, 11-30 PM - Cartoon Wars.mpg South Park - 2008-07-27, 0-30 AM - It Hits the Fan.mpg Stargate Atlantis - 2008-08-01, 10-00 PM - The Daedalus Variations.mpg Stargate Atlantis - 2008-08-15, 10-00 PM - The Ghost in the Machine.mpg Stargate Atlantis - 2008-08-22, 10-00 PM - The Shrine.mpg The Shield - 2008-09-02, 10-00 PM - Coefficient of Drag.mpg Z Rock - 2008-08-31, 11-00 PM.nuv Z Rock - 2008-08-31, 11-30 PM.mpg
So what magic force causes this to happen? mythrename.pl . This script replaces or creates symlinks from the source recording to a "Human Readable" format. WARNING!!!! Do not run this inside your recordings directory, create a new one. See below!!!!!
I first saw this being used in a script called mythpretty.sh from my former KnoppMyth platform, and it is still a part of mythtv, but you have to unearth it. This procedure is how to do that.
Locating and Enabling the mythrename.pl file
By default the file is stored in
In fedora, the file is located at /usr/share/doc/mythtv-docs-X.XX/contrib, where X.XX is current mythtv verson. ex 0.21
The file is called
In Fedora, file is not GZ'd so just copy and set to executable, actually there is no need to copy, it's fine where it is.
The first thing you do is copy the file over to /usr/local/bin and gunzip it:
cp /usr/share/doc/mythtv-backend/contrib/mythrename.pl.gz /usr/local/bin gunzip /usr/local/bin/mythrename.pl.gz chmod a+x /usr/local/bin/mythrename.pl
The script has the following usage switches:
mythrename.pl --verbose --format "%c_%Y%m%d%H%i%s"
All options: options: --link [destination directory] If you would like mythrename.pl to work like the old mythlink.pl, specify --link and an optional pathname. If no pathname is given, links will be created in the show_names directory inside of the current mythtv data directory on this machine. eg: /var/video/show_names/ WARNING: ALL symlinks within the destination directory and its subdirectories (recursive) will be removed when using the --link option. --live Include live tv recordings, affects both linking and renaming. default: do not link/rename live tv recordings --format default: %T %- %Y-%m-%d, %g-%i %A %- %S %T = title (aka show name) %S = subtitle (aka episode name) %R = description %C = category (as reported by grabber) %c = chanid %U = recording group %y = year, 2 digits %Y = year, 4 digits %n = month %m = month, leading zero %j = day of month %d = day of month, leading zero %g = 12-hour hour %G = 24-hour hour %h = 12-hour hour, with leading zero %H = 24-hour hour, with leading zero %i = minutes %s = seconds %a = am/pm %A = AM/PM %- = separator character / = directory/folder (path separator) * For end time, prepend an "e" to the appropriate time/date format code above; i.e. "%eG" gives the 24-hour hour for the end time. * For original airdate, prepend an "o" to the year, month, or day format codes above; i.e. "%oY" gives the year in which the episode was first aired. * A suffix of .mpg or .nuv will be added where appropriate. * To separate links into subdirectories, include the / format specifier between the appropriate fields. For example, "%T/%S" would create a directory for each title containing links for each recording named by subtitle. You may use any number of subdirectories in your format specifier. If used without the --link option, "/" will be replaced with the "%-" separator character. --separator The string used to separate sections of the link name. Specifying the separator allows trailing separators to be removed from the link name and multiple separators caused by missing data to be consolidated. Indicate the separator character in the format string using either a literal character or the %- specifier. default: '-' --replacement Characters in the link name which are not legal on some filesystems will be replaced with the given character illegal characters: \ : * ? < > | " default: '-' --underscores Replace whitespace in filenames with underscore characters. default: No underscores --verbose Print debug info. default: No info printed to console --help Show this help text.
Creating your own version of the script (the one I use)
This will have to be done on a per tuner/recording directory basis. There is also one caveat, you do not want to run the script on the recordings directory, you want a different directory for your "exported" symlinks. For example I create /export/tv.
So for the core (/home/public/data/videos/tv_shows_1)
sudo mkdir /export/tv
Add them to samba's smb.conf
sudo vi /etc/samba/smb.conf
Add: (I put this between the [public] and [home] entries
[export] comment = mythtv pretty files browseable = yes writeable = yes path = /export public = no guest ok = no force user = root force group = public create mask = 0774 directory mask = 0775 inherit acls = yes inherit uid = yes inherit owner = yes inherit permissions = yes
Restart samba services:
And the script: /usr/local/bin/mythpretty
#!/bin/bash cd /home/public/data/videos/tv_shows_1 mythrename.pl --link /export/tv --format %T/%S%-%Y-%m-%d
This new update creates a Sub-Directory by show name, and then lists the episodes/date underneath.
chmod a+x /usr/local/bin/mythpretty.sh
For my case I also added to the core's /etc/exports file
And to the MD's /etc/fstab file
192.168.80.1:/export /export nfs intr,udp,rsize=32768,wsize=32768,retrans=10,timeo=50 1 1
Restart nfs server
Schedule the job as cron
On Core: (Runs every day at midnight to keep it sync'd up)
sudo crontab -e
0 0 * * * /usr/local/bin/mythpretty.sh
Run it as a User Job after recording
This can be done easily in 2 ways
1. Use the "Computing" LMCE menu item and run mythtv-setup (or from the cli if you prefer as root)
2. Use MythWeb (The Easiest)
Method 1 - Using MythTV-Setup
Now from the mythtv-setup option, Go to:
General > and navigate to the User Jobs portion.
Insure to 'tick' 'Allow User Job 3", and in the line for User Job 3 add the following:
Replace "User Job 3" with "Export To Network Share" (No quotes of course) Job line "/usr/local/bin/mythpretty.sh %DIR% %FILE%" (No quotes of course)
This should be located directly below the Save Recording to Pluto DB job (User Job 1)
NOTE!!! It is very important to add this job as Job 3, as Job 1 is always overwritten by LMCE to the Save Recording Job. Also I use User Job 3 here because I am using the Remove Commercials script as user job 2. Mythtv:Remove_Commercials. That being said, if you are not using this job (and you should :P) then of course you will be using the "User Job 2" slot for this new job. :)
Method 2 - Using Mythweb (Easiest)
Go to MythWeb
Move your mouse to "Settings" and click "MythTV Settings Table"
Scroll to the bottom, to where you can see the User Job Entries
Under "UserJob3" enter the line
/usr/local/bin/mythpretty.sh %DIR% %FILE%
Under "UserJobDesc3" enter the text
Export To Network Share
Now at the bottom click "Save"
That's it your done!
Now when using another non-LMCE system to view your MythTV recordings, when setting up video shares, point them to /export/tvX where X is your paticular setup.
If you run this inside your recordings directory i.e not specifying a different directory w/out the --link switch, it will replace all of your 1122_blahblah.mpg files with the renamed file, this will cause LMCE's database to get out of sync, and may hose things up. So, that said, don't do it! :)
If you create a directory under the /home diretory, things will start showing up twice in the LMCE menu. SO the need to create a different directory OUTSIDE of /home, is also very IMPORTANT. So make sure you keep it out of /home. :)
Best of luck, and Happy viewing!