TiVo Community
TiVo Community
TiVo Community
Go Back   TiVo Community > Main TiVo Forums > TiVo Home Media Features & TiVoToGo
TiVo Community
Reply
Forum Jump
 
Thread Tools
Old 07-17-2012, 06:28 PM   #1
kenney
Registered User
 
Join Date: Feb 2011
Posts: 21
Automatically renaming tvshows for processing by plex media server

Good Afternoon All,

I am using kmttg to automatically pull all recorded shows off of a TiVo Premier, and wanted to have a way to automatically rename the files for tv shows with something similiar to "tv show name - S01E01 - episode title.mpg" so that they could be brought into Plex media server for distribution through my house.

The biggest problem that I had was determining what the show actually was to rename it. I found a program called tvdb-renamer which does this by attempting to match the name to thetvdb.com's databases. This didnt completely work for me so I decided to write a program that would do if for me, and thought I would share it in case anyone is interested in doing the same.

I use kmttg and plex media server on ubuntu, and have only tried my script on linux and mac. The only requirement is to install the levenshtien distance code from google (I used this to determine the "distance" between two strings as a way to best guess the correct title)

The script takes into account show name, air date, and episode title. It will output a filename similiar to tvdb-renamer unless told otherwise and uses the same basic inputs.

I use it with a command similiar to:

./kmttg-renamer.py "kmttg showname - kmttg tittle (MM_DD_YY).mpg" /nas/TiVo -n

so that it will rename the file, and move it to a directory of /nas/TiVo/showname/showname - SYYE## - title.mpg"

Below are the options.

Usage: ./kmttg-renamer.py [options] KMTTG_FILE.EXT OUTPUT_DIRECTORY(optional)
Additional options:
-i this will place program in interactive mode
-d do NOT create directories
-t test only, do not run commands
-l value change default Levenshtein value (default=0.5)
-X value change default Levenshtein value if dates match (default=0.1)
-tvdb run against a tvdb-renamer format named file
-f do NOT include original file name in output
-n save in new format "Show - S01E01 - FileInfo.ext" vice tvdb format
-o ss,## override season name (ex -o key+and+peele,255325)
-p pause on fail, good for testing with scripts
-s show all in a series to pick from, if nothing found
-h show these help options

KMTTG_FILE.EXT must be in the format of either:
Phineas and Ferb - What a Croc (06_13_2012).mpg [kmttg format]
Phineas and Ferb.S03E48.What a Croc (06_13_2012).mpg [tvdb-renamer]
* Note you must used -tvdb flag for this format!

Again, just thought I would throw this out there in case anyone is interested.
Attached Files
File Type: txt kmttg-renamer.py.txt (23.4 KB, 20 views)
kenney is offline   Reply With Quote
Old 07-19-2012, 11:31 AM   #2
jcthorne
Registered User
 
Join Date: Jan 2002
Location: Houston
Posts: 1,934
Videoredo Auto Processor will do the lookup and rename for you. Along with a number of other tasks.
__________________
Current : Roamio Base with 2TB drive and 2 Premieres and a mini. OTA. kmttg, pyTivo, running with a 78TB Synology 1511 NAS....serving up the world.

Setup help for pytivo under windows:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
jcthorne is offline   Reply With Quote
Old 07-19-2012, 02:05 PM   #3
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,995
Quote:
Originally Posted by jcthorne View Post
Videoredo Auto Processor will do the lookup and rename for you. Along with a number of other tasks.
On windows only. I would have responded earlier but he is using linux and mac it appears.
__________________

"It must be swell to be so perfect and odor-free" -- Del Griffith


VideoReDo users: Try
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

pyTivo users: Try
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
and
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
dlfl is online now   Reply With Quote
Old 10-25-2013, 10:42 PM   #4
kenney
Registered User
 
Join Date: Feb 2011
Posts: 21
Updated

In case anyone else uses kmttg under linux. I have slowly updated my scripts to rename the files, this is the current version. I use this to take the output files and rename them and move them into my plex share.

Code:
KMTTG File Renamer (Version 2.3)
 Invalid Input File
 Usage: /bin/renamer INPUT_FILE1 INPUT_FILE2 ... <options>
 Options:    -dir:dir      Directory to move file to (default=current)
             -log:file     File to log information to
             -db:dir       Where to save database files
             -odb:file     File to store show override values
          -s -show         Do not create show subdirectory undir destination dir
          -q -quiet        Show no information
          -p -parse        print out parsable information
          -i -interactive  If more than one possible episode, user will choose
          -t -test         Test Mode - Make no changes
          -d -debug        Show debuging information
 Example: renamer.py -db:/kmttg/renamer.sav -log:/kmttg/renamer.sav/renamer.log -dir:/share/TiVo -odb:/kmttg/renamer.odb /kmttg/*.mkv -debug -p

Attached Files
File Type: txt renamer.py.txt (23.0 KB, 6 views)
kenney is offline   Reply With Quote
Old 03-22-2014, 04:29 PM   #5
jimfaria
Registered User
 
Join Date: Dec 2013
Posts: 2
Any updates to this script? It works most of the time but occasionally doesn't work.. noreason given.. I've tried using the debug option but I don't get any indication of why it fails to work.
jimfaria is offline   Reply With Quote
Old 03-23-2014, 06:34 AM   #6
kenney
Registered User
 
Join Date: Feb 2011
Posts: 21
Attached is the updated version, I haven't uploaded here in a while, sorry about that. This version has been very stable for me.

Code:
KMTTG File Renamer (Version 2.51)
 Usage: /usr/bin/renamer INPUT_FILE1 INPUT_FILE2 ... <options>
 Options:    -dir:dir      Directory to move file to (default=current)
             -log:file     File to log information to
             -db:dir       Where to save database files
             -odb:file     File to store show override values
             -csv:file     Create a results file capable of opening in excel
             -val:###      Minimum Match Value (default=60)
             -lev:###      Minimum Levenshtein distance (default=0.4999)
             -tvdb:file    TVDB Show database (a .sav file)
             -tvid:###     TVDB Show ID (the tvdb show number)
             -time:###     Minimum time length to be valid (default=400)
             -select:input Advanced - used to script renamer for other purposes
             -script:file  Advanced - create a database file of the matches (used with -select)
             -failepi      Advanced - do not extract episode name use filename
             -simple       Advanced - verify selection only, not all choices
             -dupe         Advanced - if file already exists copy anyway and lable as duplicate
          -s -show         Do not create show subdirectory under destination dir
          -q -quiet        Show no information
          -p -parse        print out parsable information
          -i -interactive  If more than one possible episode, user will choose
          -t -test         Test Mode - Make no changes
          -d -debug        Show debuging information
          -e -extend       Show extended debuging (show each episodes value)
          -n -noreload     Do not requery thetvdb (use existing data)
 Example: /usr/bin/renamer -db:/kmttg/renamer.sav -log:/kmttg/renamer.log -dir:/share/TiVo -odb:/kmttg/renamer.odb /kmttg/*.mkv -debug -p
Also, within the script is a option to allow it to take the season and episode number from the TiVo created metadata vice the filename for a specific series (as example a lot of BBC shows just come up as the show name like primeval as the filename).

Code:
OVERRIDE_SEASON_EPISODE = {'mi-5': '78890', 'spooks': '78890', 'primeval':'79809'}

Attached Files
File Type: txt renamer.py.2_51.txt (38.5 KB, 9 views)
__________________
---------

Tivo Roamio
Tivo Roamio Pro
Tivo Premiere XL (sold)
kenney is offline   Reply With Quote
Old 04-01-2014, 10:39 AM   #7
jimfaria
Registered User
 
Join Date: Dec 2013
Posts: 2
Thanks.
jimfaria is offline   Reply With Quote
Old 07-14-2014, 06:17 AM   #8
kenney
Registered User
 
Join Date: Feb 2011
Posts: 21
Updated version attached. This has been very stable so I have not updated it for months. Version 2.58.
Attached Files
File Type: txt renamer.py.txt (44.7 KB, 7 views)
__________________
---------

Tivo Roamio
Tivo Roamio Pro
Tivo Premiere XL (sold)
kenney is offline   Reply With Quote
Reply
Forum Jump




Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Advertisements

TiVo Community
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
vBulletin Skins by: Relivo Media

(C) 2013 Magenium Solutions - All Rights Reserved. No information may be posted elsewhere without written permission.
TiVoŽ is a registered trademark of TiVo Inc. This site is not owned or operated by TiVo Inc.
All times are GMT -5. The time now is 03:51 PM.
OUR NETWORK: MyOpenRouter | TechLore | SansaCommunity | RoboCommunity | MediaSmart Home | Explore3DTV | Dijit Community | DVR Playground |