SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac)

  Thread Rating:
  • 8 Vote(s) - 4.88 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #136
Capt.Insano Wrote:OK, tried networktest.pl and this is what I got:
(...)
Any further advice?

Thanks,
The Capt.

P.S. Sorry for the really long post I was just trying to fully explain all my findings!!

Yeah that is strange...

nicx76 Wrote:one more feature wish:

i just want to rename all files in one directory (including all subdirectories) without sorting them into new directories. is it possible to inclue a "sorting=no" option?

btw: the script is working great Smile

thanks!
nicx...

That sounds like a handy straightforward feature. When I get a chance I will add that. If anyone wants to have a go at implementing it let me know.

newphreak Wrote:hmm, would it be possible to change the notification sent to xbmc to only send successfull moves/symlink/copy's? Smile as i symlink from a messy incomingdir i use place-symlink. And xbmc stutters like crazy while getting those notifications, so i would like to just get the successfull ones.

Edit:
Also, i noticed the notifications have a limited length, so would be cool if they were shorted down to "showname S00E00"
Wink

Ok. I'll look into it when I get a chance. Again, let me know if anyone wants to volunteer to implement this.

George Wrote:Really like your script, works amazingly well. Thanks!

Great. Thanks Smile
find quote
nitrag Offline
Junior Member
Posts: 7
Joined: Aug 2010
Reputation: 0
Post: #137
Is there any reason why this wouldn't be able to be sorted?

LOG:
Code:
23:10:2, 3-10-2010
Sorting /home/torrents/complete/ into /home/Storage/TV/

Series
Code:
[HorribleSubs] Naruto Shippuuden

File:
Code:
[HorribleSubs] Naruto Shippuuden - 183v2 [480p]

I've added this to conf because I was getting an error (below) before
Added:
Code:
show-name-substitute:[HorribleSubs] Naruto Shippuuden-->Naruto Shippuuden
tvdb-id-substitute:[HorribleSubs] Naruto Shippuuden-->79824

was getting this error before:
Code:
22:30:2, 3-10-2010
Sorting /home/torrents/complete/ into /home/Storage/TV/
WARN: Failed to get [HorribleSubs] Naruto Shippuuden series information on the tvdb.com.
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #138
nitrag Wrote:Is there any reason why this wouldn't be able to be sorted?

LOG:
Code:
23:10:2, 3-10-2010
Sorting /home/torrents/complete/ into /home/Storage/TV/

Series
Code:
[HorribleSubs] Naruto Shippuuden

File:
Code:
[HorribleSubs] Naruto Shippuuden - 183v2 [480p]

I've added this to conf because I was getting an error (below) before
Added:
Code:
show-name-substitute:[HorribleSubs] Naruto Shippuuden-->Naruto Shippuuden
tvdb-id-substitute:[HorribleSubs] Naruto Shippuuden-->79824

was getting this error before:
Code:
22:30:2, 3-10-2010
Sorting /home/torrents/complete/ into /home/Storage/TV/
WARN: Failed to get [HorribleSubs] Naruto Shippuuden series information on the tvdb.com.

There are a few reasons for this.

If your configuration has
--match-files-named-showname-episodetitle:TRUE
Then SortTV will try to look it up to see if it can find an episode with the show "[HorribleSubs] Naruto Shippuuden", and an episode titled "183v2 [480p]". This is not what you want. (Currently that does not ignore things in square brackets, but perhaps it should.) Is this S01E83? I am a human and even I am finding it hard to parse this text to figure out which episode it is...

You are correct to include those substitutions. However, you will also need to rename the file to a format SortTV understands. For example, "[HorribleSubs] Naruto Shippuuden s1e1.avi", or "Naruto Shippuuden - Homecoming.avi".
find quote
CoinTos Offline
Member
Posts: 90
Joined: Oct 2010
Reputation: 0
Location: Canada
Post: #139
Hey cliffe,

Notice a small problem with the latest version. During episode title look up it doesn't check for a tvdb ID sub so it fails on shows that require an ID number (ie, $#*! My Dad Says only works if you pass the ID to $tvdb-->GetEpisodeName()). I wrote this quick little patch to correct it on my media server, figure you can either use it or come up with a better solution. Smile

Patch Here
find quote
nitrag Offline
Junior Member
Posts: 7
Joined: Aug 2010
Reputation: 0
Post: #140
cliffe Wrote:There are a few reasons for this.

If your configuration has
--match-files-named-showname-episodetitle:TRUE
Then SortTV will try to look it up to see if it can find an episode with the show "[HorribleSubs] Naruto Shippuuden", and an episode titled "183v2 [480p]". This is not what you want. (Currently that does not ignore things in square brackets, but perhaps it should.) Is this S01E83? I am a human and even I am finding it hard to parse this text to figure out which episode it is...

You are correct to include those substitutions. However, you will also need to rename the file to a format SortTV understands. For example, "[HorribleSubs] Naruto Shippuuden s1e1.avi", or "Naruto Shippuuden - Homecoming.avi".



Thanks, seems to be working now. Have to wait until next week and make sure my shows sort.

Great work!
find quote
nicx76 Offline
Member
Posts: 92
Joined: Feb 2010
Reputation: 0
Post: #141
nicx76 Wrote:one more feature wish:

i just want to rename all files in one directory (including all subdirectories) without sorting them into new directories. is it possible to inclue a "sorting=no" option?

btw: the script is working great Smile

thanks!
nicx...

hi,

is there anybody out there who wants to code a patch for this feature wish? its nearly christmas and this would be a great gift for me :-P

thanks!
nicx...
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #142
nicx76 Wrote:hi,

is there anybody out there who wants to code a patch for this feature wish? its nearly christmas and this would be a great gift for me :-P

thanks!
nicx...

No worries. I'll do that Smile
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Smile  New version available
Post: #143
SortTV v1.15

New features:
  • --no-network
    Disables all the network enabled features such as:
    [INDENT]Disables notifying xbmc
    Disables tvdb title formatting
    Disables fetching images
    Disables looking up files named "Show - EpTitle.ext"
    Changes rename format (if applicable) to not include episode titles
    [/INDENT]
  • --directory-to-sort-into:dir
    Where to sort episodes into (dir that will contain dirs for each show)
    This directory will contain the structure (Show)/(Seasons)/(episodes)
    Alternatively set this to "KEEP_IN_SAME_DIRECTORIES" for renaming of files in directory-to-sort and its subdirectories
    For example: "perl sorttv.pl /path/to/rename KEEP_IN_SAME_DIRECTORIES"
    or "perl sorttv.pl --directory-to-sort-into:KEEP_IN_SAME_DIRECTORIES" to sort the directory setup in the config (etc)

    This should work with all the existing sort options; for example, it can still download images, create symlinks/move/copy in the same directory, and so on
  • Shortened XBMC notification messages
  • Only notifies xbmc when new files are successfully sorted
  • TVDB ID lookups for episode titles (patch from CoinTos, Thanks Smile)
  • Other small fixes, such as allowing "-" in non-episode file names
    • If you find this script helpful then please consider making a $5 paypal donation. Click for more information:
      http://sourceforge.net/donate/index.php?group_id=330009

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

      CoinTos Wrote:Hey cliffe,

      Notice a small problem with the latest version. During episode title look up it doesn't check for a tvdb ID sub so it fails on shows that require an ID number (ie, $#*! My Dad Says only works if you pass the ID to $tvdb-->GetEpisodeName()). I wrote this quick little patch to correct it on my media server, figure you can either use it or come up with a better solution. Smile

      Patch Here

      Thanks. Applied. Thanks for your patience.

      CoinTos Wrote:Will do and thanks again for your help through this as I learn the ins and outs of perl. I, also, now have the version I need for this wednesdays launch of my dedicated media server so I can't wait to put this into production, thanks.

      How is the media server going?

      nicx76 Wrote:hi,

      is there anybody out there who wants to code a patch for this feature wish? its nearly christmas and this would be a great gift for me :-P

      thanks!
      nicx...

      Merry Christmas.

      newphreak Wrote:hmm, would it be possible to change the notification sent to xbmc to only send successfull moves/symlink/copy's? Smile as i symlink from a messy incomingdir i use place-symlink. And xbmc stutters like crazy while getting those notifications, so i would like to just get the successfull ones.

      Edit:
      Also, i noticed the notifications have a limited length, so would be cool if they were shorted down to "showname S00E00"
      Wink

      Both of these issues should be solved in the new version. Let me know how it goes.
(This post was last modified: 2010-11-09 18:49 by cliffe.)
find quote
CoinTos Offline
Member
Posts: 90
Joined: Oct 2010
Reputation: 0
Location: Canada
Post: #144
cliffe Wrote:How is the media server going?
Great, I made my wednesday deadline of installing the 6 1.5tb hard drives, setting up the raid 5 and starting the process of transfering over the 1.5tb of media. Thank god for a gigabit ethernet setup between the server and my main computer. Then on thurdays day after work, I activated your script, its been working great ever since minus a couple of hickups.

A couple of small hickups remain:

1. In my setup I had to add 3 number (101 = s01e01) naming support after I realize it didn't support it. It is understood that first number 1-9 is season and the last two number 01-99 are episode.
Code:
|| filename($file) =~ /(.*)(?:\.|\s)(\d)(\d{2}).*/


2. There is currently no support for a multi ep file. ie The Closer s02e14-e15.avi or The Closer s02e14e15.avi gets renamed to just the first ep ie. The Closer s02e14.avi. This is a very mild defect for me as I use TV Rename connected over a samba mapped drive so a couple of click and all is well. If I get the time I may try and submit a patch for it unless you see a quick solution for it first.

3. Only ran into this one once so far but maybe stripping spaces off of the end of tvdb returned episode title might be a good idea. Had an episode of The Mentalist where it had The Mentalist - S03E07 - Red Hot .avi after sort because the tvdb submitter added a space on the end by mistake.

But other than those, for my day to day shows the media server with this script works great, basically 100% automated now.
find quote
Malexx Offline
Fan
Posts: 329
Joined: Nov 2009
Reputation: 0
Location: Germany
Post: #145
A really cool feature would be to be able to put more than one path into - directory-to-sort-into -

Right now i have to start to batch scripts depending on where i want to sort my files,extern or intern.

This normaly doenst belong here but maybe someone can help.
I tried a batch script (i have no clue of this)to launch 2 instances of SortTV to avoid starting a batch script for every Source i have.

Code:
explorer.exe D:\Download\Series  (open my Download Window)
clip < D:\Dokumente\Scripts\sorttv-path.bat (Copy Download Path into Clipboard for use with Mediarenamer)
cd /D C:\Program Files\Media Renamer
MediaRenamer.exe (open Media Renamer,the Renaimg Function from SortTv Script slows down my Copys too much)
cd /D D:\XBMC Stuff\SortTV
perl sorttv.pl --directory-to-sort:D:\Download\Series --directory-to-sort-into:E:\HD Serien
perl sorttv.pl --directory-to-sort:D:\Download\Series --directory-to-sort-into:Z:\
cd /d C:\ProgramData\Ember Media Manager
EmberMediaManager.exe

This works if the Moved/Copyd Media Destination is "--directory-to-sortBig Grin:\Download\Series --directory-to-sort-into:E:\HD Serien"

If the Moved/Copyd Media Destination is in the second call of SortTV "--directory-to-sortBig Grin:\Download\Series --directory-to-sort-into:Z:\" it wont work,the script will just exit without to do anything.

As said before this maybe doesnt belong here but hopefully someone can gimme a hand on making this Batch File to work.
Thanks in Advance ...
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #146
Malexx Wrote:A really cool feature would be to be able to put more than one path into - directory-to-sort-into -

Right now i have to start to batch scripts depending on where i want to sort my files,extern or intern.

This normaly doenst belong here but maybe someone can help.
I tried a batch script (i have no clue of this)to launch 2 instances of SortTV to avoid starting a batch script for every Source i have.

Code:
explorer.exe D:\Download\Series  (open my Download Window)
clip < D:\Dokumente\Scripts\sorttv-path.bat (Copy Download Path into Clipboard for use with Mediarenamer)
cd /D C:\Program Files\Media Renamer
MediaRenamer.exe (open Media Renamer,the Renaimg Function from SortTv Script slows down my Copys too much)
cd /D D:\XBMC Stuff\SortTV
perl sorttv.pl --directory-to-sort:D:\Download\Series --directory-to-sort-into:E:\HD Serien
perl sorttv.pl --directory-to-sort:D:\Download\Series --directory-to-sort-into:Z:\
cd /d C:\ProgramData\Ember Media Manager
EmberMediaManager.exe

This works if the Moved/Copyd Media Destination is "--directory-to-sortBig Grin:\Download\Series --directory-to-sort-into:E:\HD Serien"

If the Moved/Copyd Media Destination is in the second call of SortTV "--directory-to-sortBig Grin:\Download\Series --directory-to-sort-into:Z:\" it wont work,the script will just exit without to do anything.

As said before this maybe doesnt belong here but hopefully someone can gimme a hand on making this Batch File to work.
Thanks in Advance ...

Do you have
Code:
require-show-directories-already-exist:TRUE
in your config? (So that it doesn't sort them all into your first destination.)
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #147
CoinTos Wrote:Great, I made my wednesday deadline of installing the 6 1.5tb hard drives, setting up the raid 5 and starting the process of transfering over the 1.5tb of media. Thank god for a gigabit ethernet setup between the server and my main computer. Then on thurdays day after work, I activated your script, its been working great ever since minus a couple of hickups.

A couple of small hickups remain:

1. In my setup I had to add 3 number (101 = s01e01) naming support after I realize it didn't support it. It is understood that first number 1-9 is season and the last two number 01-99 are episode.
Code:
|| filename($file) =~ /(.*)(?:\.|\s)(\d)(\d{2}).*/

Just add an option for that and you’ve got a patch Smile
If you feel like doing that then please have it disabled by default and add it to the config file. If you don't feel like it I'll add it myself later.

CoinTos Wrote:2. There is currently no support for a multi ep file. ie The Closer s02e14-e15.avi or The Closer s02e14e15.avi gets renamed to just the first ep ie. The Closer s02e14.avi. This is a very mild defect for me as I use TV Rename connected over a samba mapped drive so a couple of click and all is well. If I get the time I may try and submit a patch for it unless you see a quick solution for it first.

Yeah, I am aware of that. The easiest way to add that feature would be to keep both in $episode (maybe just as "1-2-3") and handle it specially when renaming. Could lookup all the episode names, just the first one, or skip episode titles in this case. Either way I won't have time to do this for a while, feel free to have a go at it.

CoinTos Wrote:3. Only ran into this one once so far but maybe stripping spaces off of the end of tvdb returned episode title might be a good idea. Had an episode of The Mentalist where it had The Mentalist - S03E07 - Red Hot .avi after sort because the tvdb submitter added a space on the end by mistake.

But other than those, for my day to day shows the media server with this script works great, basically 100% automated now.

That is an easy one line addition, feel free to send in a patch if you want, otherwise I will do it later.

I won't be able to apply any patches you send before next week, but if you feel the urge to do some Perl hacking then go for it Smile

Thanks again for all the code you have already sent.
find quote
CoinTos Offline
Member
Posts: 90
Joined: Oct 2010
Reputation: 0
Location: Canada
Post: #148
cliffe Wrote:Yeah, I am aware of that. The easiest way to add that feature would be to keep both in $episode (maybe just as "1-2-3") and handle it specially when renaming. Could lookup all the episode names, just the first one, or skip episode titles in this case. Either way I won't have time to do this for a while, feel free to have a go at it.

Yeah, I figured you knew and like me it's one of those if I have time deals but if I find the time before you I will have a go at it. Besides, I wouldn't rank it as a major problem anyways.

Quote:I won't be able to apply any patches you send before next week, but if you feel the urge to do some Perl hacking then go for it Smile

That's fine, I am having the same problem with free time as well at the moment.

Quote:Thanks again for all the code you have already sent.
No problem, just happy to help (and learn). Smile
find quote
nicx76 Offline
Member
Posts: 92
Joined: Feb 2010
Reputation: 0
Post: #149
cliffe Wrote:SortTV v1.15

Merry Christmas.

wow, thanks a lot! Smile

nicx...

EDIT: just tested it, but its not working... if i start it with option "treat-directories:RECURSIVELY_SORT_CONTENTS" its running for hours without exeptions or renaming actions, if i use "treat-directories:IGNORE" its immedeately ending without renaming any file. so what does this parameter do that it affects the script even if i choose "directory-to-sort-into:KEEP_IN_SAME_DIRECTORIES"?

my folder structure is:
D:\videos\series\<series title>\<series title - episode name>.ts and i want to rename all files recursevly in D:\videos\series\

should this work?

nicx...
(This post was last modified: 2010-11-10 20:02 by nicx76.)
find quote
Malexx Offline
Fan
Posts: 329
Joined: Nov 2009
Reputation: 0
Location: Germany
Post: #150
Quote:Do you have
Code:

require-show-directories-already-exist:TRUE

in your config? (So that it doesn't sort them all into your first destination.)

Yes i have this.
Is this batch script otherwise correct?
So if there is
Code:
perl sorttv.pl --directory-to-sort:D:\Download\Series --directory-to-sort-into:E:\HD Serien
perl sorttv.pl --directory-to-sort:D:\Download\Series --directory-to-sort-into:Z:\
it should start the second call if it found nothing in the first?
find quote
Post Reply