[mythtv-users] An companion script for jamu.py

Epinephrine Junky epinephrine_junky at beadon.ca
Wed Aug 10 19:58:06 UTC 2011

I'm a big fan of jamu, especially since I found the -MF command to fiX
sTupId caSE issuES and make the naming consistent. But there is one missing
feature that was driving me nuts. So I decided to brush off my python and
take a stab at it. 

I think this code really belongs somewhere in the body
of jamu.py but I don't presume to know what the author thinks about it. I'm
hoping that devs will read this and comment. 

The case that jamu doesn't

I have an incoming folder where new episodes of shows are put on
my drive. Sadly the different series and seasons are all mixed together in
that folder. That required me to run: 

jamu.py -MF

jamu.py -MF

... etc for each file that landed
in the incoming folder. 

Rather than typing all of that I wrote the
following python script to parse out the name of the series and deduce the
output path. I may tweak this to automatically put the season number in the
destination directory path but at the moment I like this because I don't
keep more than one season at a time. 

Now that I have this script running
in a cron job hourly my new shows are automagically showing up in mythtv. =
happy MythTV/jamu family. :) 

Hope this is useful to others out


# preSort4jamu.py
# This script takes
a directory full of loosely formatted video files and
# uses jamu.py's "-MF
" syntax to sort the
# files and insert into the MythTV database.

# Functioning MythTV install with jamu. This was developed
on ubuntu 10.04
# and may require some tweaks to the paths below on other

import re,string,os,subprocess

# Set the following dictionary to
show the paths for your system
SystemPaths =


# You shouldn't
need to modify anything below here.

for root, dirs, files in
 for name in files:
 sourceFilename =
os.path.join(root, name)
 directoryPattern =
 filenameMatch =
 if filenameMatch:
 #convert any period
delimited names into space separated ones and
 #remove leading and trailing
 spaceyName = string.strip(filenameMatch.group(1).replace('.',' '))


 print "no match on: "+name

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-users/attachments/20110810/406baa51/attachment.html 

More information about the mythtv-users mailing list