Kodi Community Forum
SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116)
+--- Thread: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) (/showthread.php?tid=75949)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49


- CoinTos - 2010-11-14

Here the patch as it stands now, I am looking forward to any comments on changes to my temp solution. If get more time today, as I am currently watching my buddy's 6 week old pup for the day so I can only code on 'naps', I will work on it some more.

New patch:

Bug fixes:
- utf8 filename handling
--- fixes character issues ie. NCIS - S02E12 - Doppelgänger.avi
-xbmc display issue and excessive update
--- will launch update command once per script run and display popup saying what it has done.

Features added:
- sort by airdate
--- now support YYYY.MM.DD, YYYY-MM-DD or YYYY.M.D, YYYY-M-D
--- support for episode number over 50 in season episode function
---- temporary solution applied, changes welcome
- sort 3 digit season episode
--- will now sort the.closer.203.avi etc. not configurable at the moment.

Patch


- nicx76 - 2010-11-14

cliffe Wrote:Please try:
Code:
perl sorttv.pl "--directory-to-sort:D:\videos\serien\desperate housewives" --directory-to-sort-into:KEEP_IN_SAME_DIRECTORIES --match-files-named-showname-episodetitle:TRUE --xbmc-web-server: --fetch-images:FALSE --verbose:TRUE

one step further, files ar still not renamed but now i get:

D:\Software\HTPC\SortTV\sorttv>perl sorttv.pl "--directory-to-sortBig Grin:\videos\ser
ien\desperate housewives" --directory-to-sort-into:KEEP_IN_SAME_DIRECTORIES --ma
tch-files-named-showname-episodetitle:TRUE --xbmc-web-server: --fetch-images:FAL
SE --verbose:TRUE
SortTV
~~~~~~
19:16:8, 14-10-2010
Sorting D:\videos\serien\desperate housewives/ into KEEP_IN_SAME_DIRECTORIES
INFO: trying to rename Desperate Housewives season 6 episode 16
INFO: trying to rename Desperate Housewives season 6 episode 16

nicx...


- newphreak - 2010-11-15

cliffe: i sent a mail with my error to the adress you posted. hopefully it will be sorted. seems it's only burn notice it's having trouble with.

Btw, can you include these in default config?
And others: please post your fixes so we can make default config better.


Code:
show-name-substitute:Its Always Sunny in Philadelphia-->It's always sunny in philadelphia
show-name-substitute:American Dad-->American Dad!

havent found any shows needing substitute-id yet. but please post if you have found any.

Edit:
It's still trying to rewrite proper/repacks if already linked with --place-symlink. would it be possible to make it see that it's already linked and get rid of that unnecessary "spam" too? Smile


New version available - cliffe - 2010-11-18

SortTV v1.16

New features:
  • Sorting into the same directory (using --directory-to-sort-into:KEEP_IN_SAME_DIRECTORIES) should be working correctly now.
  • --match-files-based-on-tvdb-lookups:[TRUE|FALSE]
    Attempt to sort files that are named after the episode title or air date.
    For example, "My show - My episode title.avi" or "My show - 2010-12-12.avi" could become "My Show - S01E01 - My episode title.avi"
    Attempts to lookup the season and episode number based on the episodes in thetvdb.com database.
    Since this involves downloading the list of episodes from the Internet, this will cause a slower sort.
    If not specified, TRUE
  • Three number episode matching, eg "My Show 102" matches season 1 episode 2.
  • Various fixes.

Thanks to CoinTos for much of the new code.

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

CoinTos Wrote:Here the patch as it stands now, I am looking forward to any comments on changes to my temp solution. If get more time today, as I am currently watching my buddy's 6 week old pup for the day so I can only code on 'naps', I will work on it some more.

New patch:

Bug fixes:
- utf8 filename handling
--- fixes character issues ie. NCIS - S02E12 - Doppelgänger.avi
-xbmc display issue and excessive update
--- will launch update command once per script run and display popup saying what it has done.

Features added:
- sort by airdate
--- now support YYYY.MM.DD, YYYY-MM-DD or YYYY.M.D, YYYY-M-D
--- support for episode number over 50 in season episode function
---- temporary solution applied, changes welcome
- sort 3 digit season episode
--- will now sort the.closer.203.avi etc. not configurable at the moment.

Patch

Thanks! Applied with some small changes.

TravellingGuy Wrote:Hey Cliffe.

Awesome program, it works on almost all of my files.

But I do have one problem/request. Daily shows like "The Daily Show with Jon Stewart" and "The Colbert Report" that I'm getting are often not in an S##E## format, instead of a 2010.11.10 format (i.e. The.Colbert.Report.2010.11.09.Cee-Lo.Green.HDTV.Xvid.avi ). As a result, tvsort isn't recognizing them and dumps them into the non-episode-dir location. I tried match-type:LIBERAL hoping it might figure it out, but didn't.

Can you please add support for daily shows that use a year.month.day format?

This feature is now included. Thanks to CoinTos for coding it.

TravellingGuy Wrote:Also, any thoughts of adding support for figuring out and properly parsing movies? :-)
(Ok, so I had two requests!)

Thanks
TravellingGuy

I don't have any objections if someone is willing to code this Smile
If there was/is a perl module for querying themoviedb.org then that would be perfect.

nicx76 Wrote:one step further, files ar still not renamed but now i get:

D:\Software\HTPC\SortTV\sorttv>perl sorttv.pl "--directory-to-sortBig Grin:\videos\ser
ien\desperate housewives" --directory-to-sort-into:KEEP_IN_SAME_DIRECTORIES --ma
tch-files-named-showname-episodetitle:TRUE --xbmc-web-server: --fetch-images:FAL
SE --verbose:TRUE
SortTV
~~~~~~
19:16:8, 14-10-2010
Sorting D:\videos\serien\desperate housewives/ into KEEP_IN_SAME_DIRECTORIES
INFO: trying to rename Desperate Housewives season 6 episode 16
INFO: trying to rename Desperate Housewives season 6 episode 16

nicx...

Try with the new version, this should be working now.

newphreak Wrote:cliffe: i sent a mail with my error to the adress you posted. hopefully it will be sorted. seems it's only burn notice it's having trouble with.

Btw, can you include these in default config?
And others: please post your fixes so we can make default config better.


Code:
show-name-substitute:Its Always Sunny in Philadelphia-->It's always sunny in philadelphia
show-name-substitute:American Dad-->American Dad!

havent found any shows needing substitute-id yet. but please post if you have found any.

Edit:
It's still trying to rewrite proper/repacks if already linked with --place-symlink. would it be possible to make it see that it's already linked and get rid of that unnecessary "spam" too? Smile

Thanks, name substitutions added.

Now, when copying, repacks are still overwritten, but no message is displayed or sent to xbmc unless verbose is TRUE. Please test and confirm that this works Smile


- newphreak - 2010-11-18

It doesnt show any messages on repack/proper anymore, thanks.

But it does however take 3-4minutes to finish now compared to a few seconds on 1.15


Code:
./sorttv.pl
SortTV
~~~~~~
could not find ParserDetails.ini in /usr/local/share/perl/5.10.0/XML/SAX
DBM::Deep: Cannot write to a readonly filehandle at /usr/local/share/perl/5.10.0/TVDB/API.pm line 519
could be tvdb api hanging, cause that's what it spits out right before it completes, seems that api needs some work done. I did contact him on email as you said, but he didnt really reply anything helpfull.


New version available - cliffe - 2010-11-18

SortTV v1.17

Removes the TVDB update that was introduced in 1.16. If you want to re-lookup the episode titles you can always delete the .cache directory.

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

newphreak Wrote:It doesnt show any messages on repack/proper anymore, thanks.

But it does however take 3-4minutes to finish now compared to a few seconds on 1.15


Code:
./sorttv.pl
SortTV
~~~~~~
could not find ParserDetails.ini in /usr/local/share/perl/5.10.0/XML/SAX
DBM::Deep: Cannot write to a readonly filehandle at /usr/local/share/perl/5.10.0/TVDB/API.pm line 519
could be tvdb api hanging, cause that's what it spits out right before it completes, seems that api needs some work done. I did contact him on email as you said, but he didnt really reply anything helpfull.

This should fix the slowness issue. Thanks for reporting this so quickly.

Cheers.


- CoinTos - 2010-11-18

cliffe Wrote:I don't have any objections if someone is willing to code this Smile
If there was/is a perl module for querying themoviedb.org then that would be perfect
Already looked into this, here is the Perl API if some body is interested. At the moment, this doesn't interest me as I have other things I want for the tv sort ie. multi ep naming support.

Edit:
Just a note about this notification code:
Code:
get "http://$xbmcwebserver/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(,NEW EPISODES NOW AVAILABLE TO WATCH\n$newshows, 7000))";
When $newshows list is real long, like adding a season with recursive sort on, it doesn't fit the popup notification box in xbmc at all and can be intrusive with the 7 sec delay. I have some ideas to fix it, just no time at the moment.


- newphreak - 2010-11-23

Would it be possible to get season replacement aswell? No
thetvdb.com all of the sudden decided to go with the least userfriendly seasoncleanup they could on dirty jobs, so that serie wont work with xbmc anymore. Stare
Rippers has come to S08, but thetvdb decided we only were on s06 now.
Cleaning up as this just seems stupid and not userfriendly at all to me, so i actually feel stupid for asking you to make a fix.

Something like this:
season-substituteBig Grinirty Jobs Season 8-->Dirty Jobs Season 6
not really sure how to note it down, as you would need showname, season, and season to replace with.


- cliffe - 2010-11-23

newphreak Wrote:Would it be possible to get season replacement aswell? No
thetvdb.com all of the sudden decided to go with the least userfriendly seasoncleanup they could on dirty jobs, so that serie wont work with xbmc anymore. Stare
Rippers has come to S08, but thetvdb decided we only were on s06 now.
Cleaning up as this just seems stupid and not userfriendly at all to me, so i actually feel stupid for asking you to make a fix.

Something like this:
season-substituteBig Grinirty Jobs Season 8-->Dirty Jobs Season 6
not really sure how to note it down, as you would need showname, season, and season to replace with.

If the season wasn't locked you could "fix it" on thetvdb. Maybe try discussing the reason it is locked that way on http://forums.thetvdb.com/

Let me know how that goes.

Update: Also check out the forum rules regarding locked content. http://forums.thetvdb.com/viewtopic.php?f=7&t=4076


- newphreak - 2010-11-24

I did check that and they have locked it all, so im quite furious and it does not seem likely that it'll go back the way it was, which was working perfectly for me.


- CoinTos - 2010-11-25

newphreak Wrote:I did check that and they have locked it all, so im quite furious and it does not seem likely that it'll go back the way it was, which was working perfectly for me.

It looks like your show took the Mythbusters path which basically means after much arguement and user changes, they finally decided to lock it the way they figure it should be. It sucks I know but there isn't much you can do about it. In my case, if Mythbusters had normal season and not so many wasted clipshows and filler episodes (aka. specials) I would be a lot happier because the scene episode numbers would match up for the whole season. My solution for Mythbusters is when it does stray, I set my rss downloader config to tell deluge to download it to a different folder and I will manually rename and put it in my sort folder at a time convinent to me. Not ideal but it works for me.


- newphreak - 2010-11-25

oh dear lord, seems i'll have to find dirt jobs manually and watch it indeed, they didnt just change season, they changed the whole episode order Sad i really hate thetvdb now. open database for fans my ass.
edit: can we atleast get an option to ignore shows then? Smile


- slybas - 2011-01-06

I like the tool very much although I am only using it for the initial sorting of my torrent downloads into movie or tv dirs. After that Sickbeard or Couchpotato will finish the job. Sorttv checks the download folder and everything that is recognized as tv series is moved to the tv dir the rest by default to movies. And here comes my question is it possible to add a positive movie recognision? There is no need for a very fancy renaming but it would be nice if you could actively sort movies. (And to make it complete jpg and mp3 sorting).

I have got a slight problem with this option:
PHP Code:
# OPTIONAL - where to put things that are not episodes
# If this is supplied then files and directories that SortTV does not believe are episodes will be moved here
# If not specified, non-episodes are not moved
non-episode-dir:/home/cliffe/Files/Downloads/Non-episodes 

The Dirs and files which are none episodes get moved to (in my case movie) but it strips them of the directory structure. This is a problem for movies with subtitles etc.


- cliffe - 2011-01-09

slybas Wrote:I like the tool very much although I am only using it for the initial sorting of my torrent downloads into movie or tv dirs. After that Sickbeard or Couchpotato will finish the job. Sorttv checks the download folder and everything that is recognized as tv series is moved to the tv dir the rest by default to movies. And here comes my question is it possible to add a positive movie recognision? There is no need for a very fancy renaming but it would be nice if you could actively sort movies. (And to make it complete jpg and mp3 sorting).

I have got a slight problem with this option:
PHP Code:
# OPTIONAL - where to put things that are not episodes
# If this is supplied then files and directories that SortTV does not believe are episodes will be moved here
# If not specified, non-episodes are not moved
non-episode-dir:/home/cliffe/Files/Downloads/Non-episodes 

The Dirs and files which are none episodes get moved to (in my case movie) but it strips them of the directory structure. This is a problem for movies with subtitles etc.

The next version (in a few days) will maintain the directory structure of non-episode files. Movie detection and sorting is a future possibility, let me know if you want to code it Smile


Square braces causes issues - TravellingGuy - 2011-01-12

Hi Cliffe.

I'm using sorttv, which does much of what I like. However, sometimes the torrents I download have square braces in the directory (i.e. [ and ]). sorttv doesn't like that very much, and just completely skips those directories when doing the sort.

For example,torrents distributed by Torrent Day always come in this type of format:
Quote:The.Vampire.Diaries.S02E07.720p.HDTV.x264-CTU [NO-RAR] - [ http://www.torrentday.com ]/the.​vampire.​diaries.​s02e07.​720p.​hdtv.​x264-ctu.​mkv

Running sorttv on that, sorttv will just skip right over it.