• 1
  • 2
  • 3
  • 4(current)
  • 5
  • 6
  • 49
SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac)
#46
Would it be possible to set naming parameters in sorttv.conf. to choose the format of episode naming?

ie:
My sorttv.conf has:
Code:
rename-format:INCLUDE-EPISODE-TITLE

Episodes get named as follows:
Code:
[Series] [Ep #] - [Ep Name]

eg: 30 Rock S05E04 - Live Show (East Coast Taping)

but all the episodes on my Media Server are naming using the following naming convention:
Code:
[Series].[Ep #].[Ep Name]

eg: 30 Rock.S05E03.Let's Stay Together

Could I set how these "Variables" appear in episode names? It would prob suit people to have custom naming conventions.

P.S: The .conf option
Code:
use-dots-instead-of-spaces:FALSE
does not fit the purpose as the above example would be
"30.Rock.S05E03.-.Let's.Stay.Together"

I hope this post made sense!!

The Capt
Reply
#47
Smile 
A new version of SortTV is now available (v1.3).
  • New feature: Show name substitution
  • Pattern matching improvements: ignores and, &, +

The new sample configuration file contains:
Code:
show-name-substitute:CSI-->CSI: Crime Scene Investigation
show-name-substitute:Sanctuary US-->Sanctuary
If you come up with any others that might be helpful, then please let me know and I will add them to the sample conf file.

You can get the new version from:
https://sourceforge.net/projects/sorttv/files/

If you find this script helpful then please consider making a $5 paypal donation
http://sourceforge.net/donate/index.php?group_id=330009


CoinTos Wrote:Hi cliffe,

First off really great script. I am just wondering if this script can help me in my migration. I currently have my media on my windows computer, I want to move it my linux raid server I am setting up. Now, correct me if I am wrong but currently you script just sorts to file show title/Season number, which great for most of my shows. An example of a problem for my migration is with new CSI eps I would like it to be sorted to CSI Crime Scene Investigator. Is there a way a custom title support can be added, sort of a extra option in the config or a extra file where I could tell if it find CSI (not Miami/NY) make it CSI Crime Scene Investigator in the sort.

Thanks again for the script.

Edit: Also another example with the current script in my testing, it fails to get the ep title for Mike & Molly since they name the torrented version Mike and Molly. Finally, is there a way to get it to rename Show - S00E00 - Ep Title.avi? Again, sorry to pester and thanks for development on this script, these are just some migration thoughts so I can continue to use tvrename for name changes when needed over samba. I can always adapt if needed. :-)

Done, grab the new version Smile

Currently the renaming does not create that specific style (however, it is almost identical without the first '-'). Adding the option will be easy. I am trying not to have regex in the conf file for simplicity, but I have to think about the best way to implement the different styles that people might want.
Reply
#48
Capt.Insano Wrote:Would it be possible to set naming parameters in sorttv.conf. to choose the format of episode naming?

ie:
My sorttv.conf has:
Code:
rename-format:INCLUDE-EPISODE-TITLE

Episodes get named as follows:
Code:
[Series] [Ep #] - [Ep Name]

eg: 30 Rock S05E04 - Live Show (East Coast Taping)

but all the episodes on my Media Server are naming using the following naming convention:
Code:
[Series].[Ep #].[Ep Name]

eg: 30 Rock.S05E03.Let's Stay Together

Could I set how these "Variables" appear in episode names? It would prob suit people to have custom naming conventions.

P.S: The .conf option
Code:
use-dots-instead-of-spaces:FALSE
does not fit the purpose as the above example would be
"30.Rock.S05E03.-.Let's.Stay.Together"

I hope this post made sense!!

The Capt

Ok, stay tuned. I'll implement something soon... Maybe tomorrow.

In the mean time, feel free to hack around line ~479 of sorttv.pl to make your copy output to your desired format.
Eg:

if you change (line 474):
$title = " - $name";
to
$title = " $name";
and turn on use-dots-instead-of-spaces, you get your desired format

Update: Almost... Change it to $title = ".$name"; and also change 479 to put a "." rather than a space between show name and episode.
Reply
#49
Big Grin 
Capt.Insano Wrote:Really looking forward to setting this up, when I'm home from work!!

$10 donation sent, seriously fast development on requests so very well deserved!!

Thanks Cliffe,
The Capt.

Thanks Smile
Reply
#50
Smile 
Ok, you asked for it and here it is.

A new version of SortTV is now available (v1.4).

The new version now allows custom file renaming, and a number of examples are provided in the sorttv.conf file, so just choose the one that matches the format you want.

--rename-format:{formatstring}
Hint: including the Episode Title as part of the name slows the process down a bit since titles are retrieved from thetvdb.com
The formatstring can be made up of:
  • [SHOW_NAME]: "My Show"
  • [EP1]: "S01E01"
  • [EP2]: "1x1"
  • [EP3]: "1x01"
  • [EP_NAME1] " - Episode Title"
  • [EP_NAME2] ".Episode Title"
If not specified the format is "[SHOW_NAME] - [EP1][EP_NAME1]"
For example:
for "My Show S01E01 - Episode Title" (this is the default)
--rename-format:[SHOW_NAME] - [EP1][EP_NAME1]
for "My Show.S01E01.Episode Title"
--rename-format:[SHOW_NAME].[EP1][EP_NAME2]

You can get the new version from:
https://sourceforge.net/projects/sorttv/files/

If you find this script helpful then please consider making a $5 paypal donation
http://sourceforge.net/donate/index.php?group_id=330009
Reply
#51
Started using 1.4 and it is working really well, Thanks a million Cliffe.

Just wondering if there is a way to use this script recursively?
Sometimes my Sort Folder contains torrented episodes in folders.

So instead of file being in my "directory-to-sort";

"/Torrents/Complete/TV Shows/"

it is in some sub-folder;

"Torrents/Complete/TV Shows/QI.XL.S08E04.WS.PDTV.XviD-W4F/

Again, Many Thanks!

The Capt.
Reply
#52
I've tried this and it works like a charm - thanks so much. i'm running windows, and i did have to have to grab the extra files from cpan for it to work.

few questions though, i have more than one location where my tv shows are archived, but one location where they are downloaded to. how would i go about sorting from an incoming folder to 3 different locations if all the files to be moved are stored in one location? should i be separating the incoming files into folders based on where they will end up when this script has been run?

also, just to be sure, is there a files exists rule?

aaaand one more question.... is it possible to keep the file name intact? i like to keep track of the encoder
Reply
#53
Smile 
Once again, a new version of SortTV is now available (v1.5).
(5th release this week!)

New feature:
--treat-directories:[AS_FILES_TO_SORT|RECURSIVELY_SORT_CONTENTS|IGNORE]
How to treat directories.
AS_FILES_TO_SORT - sorts directories, moving entire directories that represents an episode, also detects and moves directories of entire seasons
RECURSIVELY_SORT_CONTENTS - doesn't move directories, just their contents, including subdirectories
AS_FILES_TO_SORT/RECURSIVELY_SORT_CONTENTS/IGNORE
If not specified, RECURSIVELY_SORT_CONTENTS

With recursive sort, if sub directories end up empty, then they are removed. If you have a non-episodes directory set, then anything that is not an episode will be MOVED into your non-episode directory, if this not what you want then don't specify a non-episode directory.

Enjoy.

You can get the new version from:
https://sourceforge.net/projects/sorttv/files/

Capt.Insano Wrote:Started using 1.4 and it is working really well, Thanks a million Cliffe.

Just wondering if there is a way to use this script recursively?
Sometimes my Sort Folder contains torrented episodes in folders.

There is now Smile
Reply
#54
distracto Wrote:I've tried this and it works like a charm - thanks so much. i'm running windows, and i did have to have to grab the extra files from cpan for it to work.
Great. I did some early testing on Windows, but mostly use Linux.
distracto Wrote:few questions though, i have more than one location where my tv shows are archived, but one location where they are downloaded to. how would i go about sorting from an incoming folder to 3 different locations if all the files to be moved are stored in one location? should i be separating the incoming files into folders based on where they will end up when this script has been run?
Currently you would have to have the file separated into 3 directories to sort. I guess I could add a feature later to optionally require the show directory exist in the sort-to directory. That way you could just create the show directories in the destination directories, and it would only move if you were sorting into the appropriate directory. Is this a feature you want?

The script is getting pretty feature-rich. Only problem with that is it may seem complicated. It would be nice to build a graphical interface to edit the config file. If I find time...

By the way, everyone should feel free to contribute code Smile
distracto Wrote:also, just to be sure, is there a files exists rule?
Yep. If moving, it won't move, an error message will be generated. If copying or placing a symlink it will silently fail, leaving the files as is (assuming it has already copied).
distracto Wrote:aaaand one more question.... is it possible to keep the file name intact? i like to keep track of the encoder
Yep! Just set
rename-episodes:FALSE
and leave
use-dots-instead-of-spaces:FALSE

Cheers.
Reply
#55
Hi
Anybody wanna help a noob with a guide to do this on windows? I've downloaded perl and the sortTV files. No i'm not sure what to do. What I want is to copy(because of seeding) my episodes to my episodes directory. I don't need to rename the episodes or anything. So what do I have to type, and were do I have to type it for it to work.
Reply
#56
Just wondering;

Anyone having permission probs with Symlinks created by SortTV?

When I try to delete any Symlinks created by SortTV over Samba I get permission denied error.

Any Ideas?

Thanks

The Capt.

P.S: BTW: The recursive option works PERFECTLY Cliffe!!
Reply
#57
Thanks for the great script cliffe, but I noticed one problem when I was trying to run it this morning. I'm running this in windows and the script fails when it tries to rename and move an episode that has an illegal character in the tvdb title. In my case it was a : (colon).
Reply
#58
symlinks worked locally and on samba for me, but glftpd couldnt use it which doesnt matter to me. so great work and thanks again, great work! Smile
Reply
#59
palmsquadler Wrote:Thanks for the great script cliffe, but I noticed one problem when I was trying to run it this morning. I'm running this in windows and the script fails when it tries to rename and move an episode that has an illegal character in the tvdb title. In my case it was a : (colon).

Thanks for letting me know!

Linux doesn't mind ":" etc. Version 1.6 is now available. SortTV now does some illegal character filtering, depending on the platform. (So Linux users can still have ":" in file names, but on Windows the script will remove ":")

Cheers,

Cliffe.
Reply
#60
lompelurt Wrote:Hi
Anybody wanna help a noob with a guide to do this on windows? I've downloaded perl and the sortTV files. No i'm not sure what to do. What I want is to copy(because of seeding) my episodes to my episodes directory. I don't need to rename the episodes or anything. So what do I have to type, and were do I have to type it for it to work.

1. Install Perl (as you have done)

2. Install the Perl modules that SortTV uses:

On Windows, open a command prompt (Run->"cmd")
Type:
Code:
cpan File::Copy::Recursive File::Glob LWP::Simple TVDB::API

Then keep pressing enter until finished.

3. Save the SortTV files somewhere.
Extract the contents of the .zip file, for example to your home directory.

4. Edit the sorttv.conf file
The sorttv.conf file tells SortTV what to do.
The lines starting with "#" simply explain things

Change the directories, to the ones you want "to-sort" and to "sort-to"
For example, change
Code:
directory-to-sort:/home/cliffe/Files/Downloads/Unsorted
to
Code:
directory-to-sort:C:\MyDownloads
If that is the directory you want to sort

Since you want to copy rather than move, change the line
Code:
sort-by:MOVE
to
Code:
sort-by:COPY

5. Run the script
In the command prompt, get the the directory containing SortTV.
Use the "cd" command to change to that directory

Then type
Code:
perl sorttv.pl

This will sort your files according to the config file.

Alternatively you can tell it to sort from C:\FROM to C:\TO by typing
Code:
perl sorttv.pl C:\FROM C:\TO

6. Automate
Once that is set up you can schedule it to sort every hour
Use Windows scheduler and tell it to run
"perl [full/path/to/SortTV]sorttv.pl"
(where [full/path/to/SortTV] is where you extracted SortTV)
Reply
  • 1
  • 2
  • 3
  • 4(current)
  • 5
  • 6
  • 49

Logout Mark Read Team Forum Stats Members Help
SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac)8