MythSExx - A MythTV renamer tool for XBMC
#1
MythSExx a versitile library exportation tool for MythTV
---------------------------------------------------------------------------------------------
edit: Before you try MythSExx, try out mythicalLibrarian it's a much better tool.


MythSExx is a Ubuntu tool which will import your MythTV library into XBMC format. It is a versitile tool with very good logging. It will reference theTvDb.com and obtain the Series and Episode information so that your files can be imported into XBMC

I am striving to make this the best Myth interface tool available for XBMC library recognition. I am eagerly awaiting problem reports. I define problem reports as "Anything which you as the user determine to be abnormal operation"

Key features:
--------------------------
  • MythTV recordings renamed to Show name.SxxExx (episode title).ext
  • Symlinks allow MythTV to maintain your library. Symlink from new file in place of old. Symlink to original.
  • TvDb recognition of Show Name and Episode Name
  • Fuzzy logic episode name matching allows for improperly named episodes
  • User defined show name translations for improper guide data
  • User is notified at the end of each operation
  • Dynamic mount support with alternate move dir
  • Failsafe Symlink mode
  • easy to troubleshoot permission errors and other problems in debug mode
  • Can be run as MythTV job.
Code:
/home/mythtv/MythSExx/MythSExx.sh  "%TITLE%" "%SUBTITLE%" "%DIR%/%FILE%"
How to use:
-----------------------
MYthSExx will generate usable content for XBMC out of your MythTV recorded libraries by utilizing the standard Showname.SxxExx (Episode Title).ext format.

It can be configured in the following ways
  • Move your files and create symlinks in place of the original so that MythTV can manage your library
  • Leave the original in place and create symlinks to your folder
  • Move files to a NAS and if the NAS is not present, move it to a local folder
  • After extinguishing all other resources, create a symlink to the original file in a local folder

in progress:
------------------------
  • Multiple shows in single recordings (currently handled by clipping second name)
  • Movies

You can find full documentation here: http://wiki.xbmc.org/?title=MythSExx
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#2
Out of curiosity, why would anyone use this over and above the existing mythrename.pl script that is included with MythTV? Place it in a cron job (or as a user job if you wish), and it will rename, or make hard links, in pretty much any format you like.

I have a cron job that I use that does this all for me - it looks like this:
Code:
#!/bin/bash
perl /usr/local/bin/mythrename.pl --link /myth/pretty/By\ Title/ --format %T/%T\ \-\ %S
perl /usr/local/bin/mythrename.pl --link /myth/pretty/By\ Date/ --format %Y/%m/%d/%H%i\ \-\ %T\ \-\ %S
perl /usr/local/bin/mythrename.pl --link /myth/pretty/By\ Channel/ --format %c/%Y%m%d\ \-\ %H%i\ \-\ %T\ \-\ %S
perl /usr/local/bin/mythrename.pl --link /myth/pretty/By\ Genre/ --format %C/%Y%m%d\ \-\ %H%i\ \-\ %T\ \-\ %S
This makes folders that contain the shows, sorted by title, date, channel and genre. Should be more than enough, wouldn't you say? And there's no need for any extra dependencies (like curl or agrep).
Reply
#3
Anaerin Wrote:Out of curiosity, why would anyone use this over and above the existing mythrename.pl script that is included with MythTV? Place it in a cron job (or as a user job if you wish), and it will rename, or make hard links, in pretty much any format you like.

I have a cron job that I use that does this all for me - it looks like this:
Code:
#!/bin/bash
perl /usr/local/bin/mythrename.pl --link /myth/pretty/By\ Title/ --format %T/%T\ \-\ %S
perl /usr/local/bin/mythrename.pl --link /myth/pretty/By\ Date/ --format %Y/%m/%d/%H%i\ \-\ %T\ \-\ %S
perl /usr/local/bin/mythrename.pl --link /myth/pretty/By\ Channel/ --format %c/%Y%m%d\ \-\ %H%i\ \-\ %T\ \-\ %S
perl /usr/local/bin/mythrename.pl --link /myth/pretty/By\ Genre/ --format %C/%Y%m%d\ \-\ %H%i\ \-\ %T\ \-\ %S
This makes folders that contain the shows, sorted by title, date, channel and genre. Should be more than enough, wouldn't you say? And there's no need for any extra dependencies (like curl or agrep).

It's been a while since I've looked at mythrename.pl (kind of forgot it existed), but does it create links rather than copy the entire file so that you can leave the default in the regular myth directory?
Reply
#4
robweber Wrote:It's been a while since I've looked at mythrename.pl (kind of forgot it existed), but does it create links rather than copy the entire file so that you can leave the default in the regular myth directory?

It has the option to do both. If you pass in the "--link" parameter (as I do above), it does indeed create hard links, if you leave it out, it moves the files (and updates the database to reflect their new location, so Myth still knows how to get to the files).
Reply
#5
Anaerin Wrote:Out of curiosity, why would anyone use this over and above the existing mythrename.pl script that is included with MythTV? Place it in a cron job (or as a user job if you wish), and it will rename, or make hard links, in pretty much any format you like.

This tool will reference TheTvDb.com to obtain the Season and Episode information so the file can be imported into the XBMC library. Without Season and Episode, XBMC is clueless.

Another bonus is proper naming of all shows. Sometimes your cable guide will have errors and they can be corrected with MythSExx.
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#6
well done outleradam!
this is just what I wanted, and as you say it offers much more than the mythrename script when using XBMC.

I'd started a similar solution using perl & the TVDB::API module, but wasn't so far. I've processed a few recordings manually using BashSExx with no problems (after fixing a couple of typos). Next step is to run it as a post-recording job.

A question - on Sourceforge there are several files with the same name/size/date, & I see that there's also a copy on the XBMC Wiki referred to as MythSExx- which is the right one? I only noticed the MythSExx version this morning

I downloaded one of the sourceforge files and there were 2 syntax errors (missing ] on an if, and missing $ on a variable reference) but it worked after I'd fixed them

Thanks
John
Reply
#7
Thank you for pointing that out John. I will be closing the sourceforge version soon and BashSExx will be superceeded by MythSExx. Please keep in mind that this is also my first bash program. It is still in development and will not be complete until all avenues are traveled thoroughly.

The name change denotes the compatability introduced by utiliziation of SymLinks. I'm very glad this progam could help someone.

Please, let me know if there are any other problems with this program. I will go ahead and fix those errors you mentioned
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#8
Ahh, now if only you had posted this about a month ago Wink

I was looking for a script like this, to take stuff from mythTV and put it into XBMC, so I ended up doing it myself, it is no where near as cool as your though, but I thought I'd share it with you in case it uses something you like (its called mythtvremodel (REnameMOveDELete)):

Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: mythtvremodel
# Required-Start:    $local_fs $syslog $remote_fs dbus
# Required-Stop:     $local_fs $syslog $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: rename, move delete recordings
### END INIT INFO
# script to rename files recorded from mythtv and then to move them and delete them
#made by prupert.co.uk
#creative commons licence, whichever is the most FREE (as in beer)

#lets put in some variables so others can use this
#location of log file
log=/home/rupert/stv/mythtvremodel.log
#this is the full path to mythtvrename.pl
mrename=/home/rupert/mythrename.pl
#this is the full path to your recordings folder
record=/var/www/mythweb/data/recordings/
#this is the extension your recordings are stored as
ext=mpg
#this is the full path to where you want your files moved to
dest=/home/rupert/stv/
#this is the full path to myth.find_orphans.pl
morphan=/home/rupert/myth.find_orphans.pl
#mythtv database password for myth.find_orphans.pl
pass=YOUPASSWORDHERE

# first, run mythtvrename to get nice names for the recordings
echo starting mythtvremodel on `date "+%m/%d/%y %l:%M:%S %p"` > $log
perl $mrename --format %T-%S >> $log

# use find to search for all mpgs files in the recording folder and move them to the TV folder
find "$record" -name "*.$ext" >> $log
find "$record" -name "*.$ext" -exec mv {} /home/rupert/stv/ \; >> $log

# use mythorphan to remove the now missing recorded files from the database
perl $morphan --pass=$pass --dodbdelete >> $log

#that should be it
echo stopping mythtvremodel on `date "+%m/%d/%y %l:%M:%S %p"` >> $log

exit 0

As you can see, it is SO basic, it basically calls mythrename to create nice names for the recorded files (renaming the actual files, not links), then it moves all the recordings (based on file extension) to a special folder. Then it deletes the references to these files in the mythtv database using myth_find_orphans.

The cool thing is, that I put in under /etc/rc0.d, so it runs as the machine is shutting down. I can't remember why I did it this way, rather than as a job that mythtv runs at the end of the recording. Oh yeah, I remember, I didn't want it to be run as a job if two programs were recording one after the other, since it would end up moving the currently recording file, which would be BAD. I guess I did that because of my mega hacky way of moving the file in the first place Wink

Anyway, thought I would share it with you in case it is of interest.

I guess it probably isn't, since I wrote it for my very specific case:

-mythtv box only used to record TV, it doesn't do anything else (probably a waste, but I found it so hard to get mythtv up and running in conjunction with mythwelcome so it starts up and shuts down automatically that I didn't want to risk messing up the set up),
-all recordings moved to a shared drive on my ubuntu server (not the mythtv box) where they are transcoded by an ffmpeg script and analysed using comskip into an MKV file with chapters as commercial markers,
-I manually use ember media manager to ID each recording and move them to the necessary folder on my a special Video drive,
-when I turn on the XBMC box, it uses rsync to mirror the Video drive to its own local drive and then XBMC updates its library based on those new files (that way I have a back-up of all my media on the XBMC box).

Kinda a crazy way of doing it all I know, but it was great fun learning how to get it all running.

Anyway, use and abuse if you feel so inclined, though clearly yours is WAY better than mine...
Reply
#9
^^ I started this project almost a month ago because I could not find anything which would do the job.
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#10
Comming Soon:
  • Alternate move dir. useful if you transfer to a NAS which can be disconnected
  • Failsafe mode: Symlinks are created in failsafe dir if all other methods are exhausted
  • Better recognition of duplicate series
  • increased logging
  • full "dummy proof" installation instructions
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#11
Features added in latest release:
  • * Notification in Ubuntu notification area when job is completed!
    * Alternate move dir. useful if you transfer to a NAS which can be disconnected
    * Failsafe mode: Symlinks are created in failsafe dir if all other methods are exhausted
    * Better recognition of duplicate series
    * increased logging
    * full "dummy proof" installation instructions

Comming soon:
  • * Movies
    * Multiple episode in single block recording support
http://wiki.xbmc.org/?title=MythSExx
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#12
As of this release, I would like to start receiving bug reports. Please cut-n-paste a MythSExx output.log debug log here if you have problems.
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#13
There is currently a problem with free space handling on multiple drives. A 0 length file will be created even if the file is not moved. I am working to correct this problem so that the job can just be rerun. Origininal files are not affected, however, the alternate move dir is not currently functional. This problem will be corrected today.
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#14
problem corrected.
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#15
Hi-
below is output from debug enabled log...

my setup was to move to a 2nd directory on the same drive as my myth recordings... which is a 2nd drive in the myth backend... /media/datadrive/tv-recordings is the normal myth recording directory, and my movedir in your script is set to be /media/datadrive/TVShows

but when executed from myth or mythweb, the script only moves the files to my alternate directory - /jay/home/Shared

However, if I run the script interactively from my login account, jay, it works fine.

I downloaded the script on Saturday pm or Sunday am - before your updated version from last night...

output log:

Code:
@@@@@@@@@@NEW SEARCH INITIATED AT Mon Dec 14 07:28:14 MST 2009@@@@@@@@@@@@@
SEARCHING: [url]www.TheTvDb.com[/url] SHOW NAME: Criminal Minds EPISODE: Zoes Reprise
FILE NAME: /media/datadrive/tv-recordings/3071_20091213210000.mpg
SEARCH FOUND:Criminal Minds ID#: 75710
DEFINED ABSOLOUTE EPISODE NUMBER: 80
#########################################################
###################DEBUG MODE ENABLED####################
#########################################################
LISTING INTERNAL VARIABLES USED BY MythSExx. VERIFY THESE ARE NOT EFFECTED BY GLOBAL VARIABLES
INTERNET TIMEOUT:50- TvDb API KEY:6DF511BB2A64E0E9- MythSExx WORKING DIR:/home/mythtv/MythSExx-
MOVE DIR:/media/datadrive/TVShows- USING SHOWNAME AS FOLDER:UseShowNameAsDir-
USE ORIGINAL DIR:Disabled NOTIFICATIONS:Enabled DEBUG MODE:Enabled-
INPUT SHOW NAME:Criminal Minds- LOCAL SHOW NAME TRANSLATION:- SENT TVDB SHOW NAME:Criminal%20Minds-
RESOLVED SERIES ID:75710- RESOVED SHOW NAME:Criminal Minds-
INPUT EPISODE NAME:Zoe's Reprise- ABSOLOUTE EPISODE NUMBER:80- RESOLVED EPISODE NAME:Zoe's Reprise-
SEASON:S04- EPISODE:E15-
##############LISTING FOLDER PERMISSIONS#################
ORIGIONAL FILE>ls -l /media/datadrive/tv-recordings/3071_20091213210000.mpg
-rw-r--r-- 1 jay jay 6283404244 2009-12-14 07:27 /media/datadrive/tv-recordings/3071_20091213210000.mpg
MythSExx WORKING DIR>lsmod -l /home/mythtv/MythSExx/Criminal Minds/
total 132
-rw-r--r-- 1 mythtv mythtv   1408 2009-12-14 07:28 Criminal Minds.Ename.txt
-rw-r--r-- 1 mythtv mythtv    267 2009-12-14 07:28 Criminal Minds.E.txt
-rw-r--r-- 1 mythtv mythtv    208 2009-12-14 07:28 Criminal Minds.S.txt
-rw-r--r-- 1 mythtv mythtv 119445 2009-12-14 07:28 Criminal Minds.xml
MOVE DIR>lsmod -l /media/datadrive/TVShows/
total 32
drwxr-xr-x 2 jay jay 4096 2009-12-12 23:22 Bones
drwxr-xr-x 2 jay jay 4096 2009-12-13 07:40 Castle (2009)
drwxr-xr-x 2 jay jay 4096 2009-12-12 16:42 Criminal Minds
drwxr-xr-x 2 jay jay 4096 2009-12-12 15:18 Desperate Housewives
drwxr-xr-x 2 jay jay 4096 2009-12-12 23:24 Dollhouse
drwxr-xr-x 2 jay jay 4096 2009-12-12 14:37 Fringe
drwxr-xr-x 2 jay jay 4096 2009-12-12 23:21 Glee
drwxr-xr-x 2 jay jay 4096 2009-12-12 23:17 The Mentalist
ALTERNATE MOVE DIR> ls -l /home/jay/Shared
total 6136164
-rw-r--r-- 1 mythtv mythtv 6283404244 2009-12-13 21:59 Criminal Minds.S04E15 (Zoe's Reprise).mpg
-rw-r--r-- 1 jay    jay         16809 2009-12-12 16:31 MythSExx.sh
#########################################################
####################END OF DEBUG LOG#####################
#########################################################
RESOLVED EPISODE INFORMATION: Criminal Minds: Zoe's Reprise = S04E15
VERIFIED FOLDER: /media/datadrive/TVShows/Criminal Minds
@@@@@@@@@@@@@OPERATION COMPLETE Mon Dec 14 07:30:00 MST 2009 @@@@@@@@@@@@@@@


-thanks, jay
Reply

Logout Mark Read Team Forum Stats Members Help
MythSExx - A MythTV renamer tool for XBMC0