<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.linuxmce.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Toddbailey</id>
	<title>LinuxMCE - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.linuxmce.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Toddbailey"/>
	<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php/Special:Contributions/Toddbailey"/>
	<updated>2026-05-11T05:28:55Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=MythPretty&amp;diff=17839</id>
		<title>MythPretty</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=MythPretty&amp;diff=17839"/>
		<updated>2009-03-01T17:20:54Z</updated>

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