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


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Helioy - 2012-09-20

Getting better and better!

However it still doesn't like foreign letters in --show-name-substitute=Bonderoeven-->Bonderøven . Weird symbols show up when trying to create that directory on windows. Could this be fixed?


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - arthedain - 2012-09-26

Itachi,

I am moving the file, the problem is the RAR files and such that is left there afterwards. I'd like the original release directory with RAR files and everything wiped after move is done.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Fox - 2012-09-26

Arthedain what you could do (and what I do) is to use the delete option in the config file for all the rar files.



RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - arthedain - 2012-09-26

Fox,

Yes - but if i read that right it will always run whenever it -attempts- to extract the files. If that is the case, then it will cause quite a bit of mess if the script triggers when only half the files are present. The extraction will be attempted, it will fail (not all files available), and then it will delete the RAR files (?).

You are still left with the problem that you then will have empty directories (with /sample dir inside).


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Fox - 2012-09-26

Ah sorry didn't know you had it running like that, ya then it's a bit more troublesome. Sad
For the sample dir you can add sample to the delete too...


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - gborri - 2012-10-13

(2012-08-28, 09:02)gborri Wrote: hello Cliffe,

in Italy some broadcaster name the series as follow: "Angelina ballerina [St.1] Ep. 13.mkv". Is it possible that sorttv recognize the series and episode number from this convention?

thanks
Giovanni

hello Cliffe,

i have found a regexp to make sorttv work for series named as follow:
- Angelina ballerina [St.1] Ep. 13.mkv
- Angelina ballerina S1 -12- Title.mkv

follow the patch to sorttv.pl.

--------------------------------------------------------------------------------------------------------------

--- sorttv.pl.orig 2012-10-12 18:46:17.751225633 +0200
+++ sorttv.pl 2012-10-12 18:53:59.617515907 +0200
@@ -531,6 +531,10 @@
$dirsandfile =~ s/\Q$sortdir\E//;

if($filename =~ /(.*?)(?:\.|\s|-|_|\[)+[Ss]0*(\d+)(?:\.|\s|-|_)*[Ee]0*(\d+).*/
+ # "[St.1] Ep. 13"
+ || $filename =~ /(.*?)(?:|\s|-|_|)+\[St\.0*(\d+)\](?:|\s|-|_)*Ep\.\s0*(\d+).*/
+ # "S1 -02- "
+ || $filename =~ /(.*?)(?:\.|\s|-|_|\[)+[Ss]0*(\d+)(?:\.|\s|-|_)*0*(\d+).*/
# "Show/Season 1/S1E1.avi" or "Show/Season 1/1.avi" or "Show Season 1/101.avi" or "Show/Season 1/1x1.avi" or "Show Series 1 Episode 1.avi" etc
|| $dirsandfile =~ /(.*?)(?:\.|\s|\/|\\|-|\1)*(?:Season|Series|\Q$seasontitle\E)\D?0*(\d+)(?:\.|\s|\/|\\|-|\1)+[Ss]0*\2(?:\.|\s|-|_)*[Ee]0*(\d+).*/i
|| $dirsandfile =~ /(.*?)(?:\.|\s|\/|\\|-|\1)*(?:Season|Series|\Q$seasontitle\E)\D?0*(\d+)(?:\.|\s|\/|\\|-|\1)+\[?0*\2?\s*[xX-]?\s*0*(\d{1,2}).*/i

---------------------------------------------------------------------------------------------------------------------------------

If you plan to add to sorttv develop will be great.

thanks
Giovanni


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - StealMySoda - 2012-10-19

I'm having a bit of a strange issue. If I run the script directly it works great. But if I set up a schedule (on windows btw) then it finds the file, runs but doesn't do any sorting.

Anybody got any ideas?


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - famewolf - 2012-10-28

I downloaded sorttv, installed strawberry perl and then cut/pasted the cpan line into a dos shell....the compile is failing on the moviedb search module. Anyone tried a clean install recently?

Win 7 - 64 bit, Strawberry Perl 5.16.1.1 (64bit)

Error Code 129 while making 'test_dynamic'






RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - cliffe - 2012-10-29

(2012-10-13, 00:26)gborri Wrote:
(2012-08-28, 09:02)gborri Wrote: hello Cliffe,

in Italy some broadcaster name the series as follow: "Angelina ballerina [St.1] Ep. 13.mkv". Is it possible that sorttv recognize the series and episode number from this convention?

thanks
Giovanni

hello Cliffe,

i have found a regexp to make sorttv work for series named as follow:
- Angelina ballerina [St.1] Ep. 13.mkv
- Angelina ballerina S1 -12- Title.mkv

follow the patch to sorttv.pl.

--------------------------------------------------------------------------------------------------------------

--- sorttv.pl.orig 2012-10-12 18:46:17.751225633 +0200
+++ sorttv.pl 2012-10-12 18:53:59.617515907 +0200
@@ -531,6 +531,10 @@
$dirsandfile =~ s/\Q$sortdir\E//;

if($filename =~ /(.*?)(?:\.|\s|-|_|\[)+[Ss]0*(\d+)(?:\.|\s|-|_)*[Ee]0*(\d+).*/
+ # "[St.1] Ep. 13"
+ || $filename =~ /(.*?)(?:|\s|-|_|)+\[St\.0*(\d+)\](?:|\s|-|_)*Ep\.\s0*(\d+).*/
+ # "S1 -02- "
+ || $filename =~ /(.*?)(?:\.|\s|-|_|\[)+[Ss]0*(\d+)(?:\.|\s|-|_)*0*(\d+).*/
# "Show/Season 1/S1E1.avi" or "Show/Season 1/1.avi" or "Show Season 1/101.avi" or "Show/Season 1/1x1.avi" or "Show Series 1 Episode 1.avi" etc
|| $dirsandfile =~ /(.*?)(?:\.|\s|\/|\\|-|\1)*(?:Season|Series|\Q$seasontitle\E)\D?0*(\d+)(?:\.|\s|\/|\\|-|\1)+[Ss]0*\2(?:\.|\s|-|_)*[Ee]0*(\d+).*/i
|| $dirsandfile =~ /(.*?)(?:\.|\s|\/|\\|-|\1)*(?:Season|Series|\Q$seasontitle\E)\D?0*(\d+)(?:\.|\s|\/|\\|-|\1)+\[?0*\2?\s*[xX-]?\s*0*(\d{1,2}).*/i

---------------------------------------------------------------------------------------------------------------------------------

If you plan to add to sorttv develop will be great.

thanks
Giovanni

Great, thanks! I will include that in the next release.

(2012-10-28, 20:50)famewolf Wrote: I downloaded sorttv, installed strawberry perl and then cut/pasted the cpan line into a dos shell....the compile is failing on the moviedb search module. Anyone tried a clean install recently?

Win 7 - 64 bit, Strawberry Perl 5.16.1.1 (64bit)

Error Code 129 while making 'test_dynamic'

Please see the FAQ in the README regarding force installing modules.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - famewolf - 2012-10-29

(2012-10-29, 00:19)cliffe Wrote:
(2012-10-28, 20:50)famewolf Wrote: I downloaded sorttv, installed strawberry perl and then cut/pasted the cpan line into a dos shell....the compile is failing on the moviedb search module. Anyone tried a clean install recently?

Win 7 - 64 bit, Strawberry Perl 5.16.1.1 (64bit)

Error Code 129 while making 'test_dynamic'

Please see the FAQ in the README regarding force installing modules.

I had already read the section and I'm familiar with the process as all my other machines runs opensuse linux however my concern was that the test for the movie db module only had 1 test total and that failed so I was uncertain if I would be able to look up movies which I certainly wish to do....I'll try forcing it and see what it does. Thanks!




RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - gborri - 2012-10-29

(2012-10-29, 00:19)cliffe Wrote:
(2012-10-13, 00:26)gborri Wrote:
(2012-08-28, 09:02)gborri Wrote: hello Cliffe,

in Italy some broadcaster name the series as follow: "Angelina ballerina [St.1] Ep. 13.mkv". Is it possible that sorttv recognize the series and episode number from this convention?

thanks
Giovanni

hello Cliffe,

i have found a regexp to make sorttv work for series named as follow:
- Angelina ballerina [St.1] Ep. 13.mkv
- Angelina ballerina S1 -12- Title.mkv

follow the patch to sorttv.pl.

--------------------------------------------------------------------------------------------------------------

--- sorttv.pl.orig 2012-10-12 18:46:17.751225633 +0200
+++ sorttv.pl 2012-10-12 18:53:59.617515907 +0200
@@ -531,6 +531,10 @@
$dirsandfile =~ s/\Q$sortdir\E//;

if($filename =~ /(.*?)(?:\.|\s|-|_|\[)+[Ss]0*(\d+)(?:\.|\s|-|_)*[Ee]0*(\d+).*/
+ # "[St.1] Ep. 13"
+ || $filename =~ /(.*?)(?:|\s|-|_|)+\[St\.0*(\d+)\](?:|\s|-|_)*Ep\.\s0*(\d+).*/
+ # "S1 -02- "
+ || $filename =~ /(.*?)(?:\.|\s|-|_|\[)+[Ss]0*(\d+)(?:\.|\s|-|_)*0*(\d+).*/
# "Show/Season 1/S1E1.avi" or "Show/Season 1/1.avi" or "Show Season 1/101.avi" or "Show/Season 1/1x1.avi" or "Show Series 1 Episode 1.avi" etc
|| $dirsandfile =~ /(.*?)(?:\.|\s|\/|\\|-|\1)*(?:Season|Series|\Q$seasontitle\E)\D?0*(\d+)(?:\.|\s|\/|\\|-|\1)+[Ss]0*\2(?:\.|\s|-|_)*[Ee]0*(\d+).*/i
|| $dirsandfile =~ /(.*?)(?:\.|\s|\/|\\|-|\1)*(?:Season|Series|\Q$seasontitle\E)\D?0*(\d+)(?:\.|\s|\/|\\|-|\1)+\[?0*\2?\s*[xX-]?\s*0*(\d{1,2}).*/i

---------------------------------------------------------------------------------------------------------------------------------

If you plan to add to sorttv develop will be great.

thanks
Giovanni

Great, thanks! I will include that in the next release.

I was thinking that probably the best way is to add an option in config file; in this way everyone can add regex in order get series and episode number from the convention adopted by broadcaster.

Giovanni


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Lord_Kami - 2012-10-30

Found a bug in the latest stable version. Multi volume rar-archives where files are named .*part[number].rar, sorttv extracts each and every .rar resulting in a very time and space consuming operation.

Is it possible to work from a list of files in this situation and only extract once?

You can use something like this, or list archives with unrar and then make a list in perl.
Code:
unrar lt -v <file> | grep -E '^Volume' | colrm 1 7

I'm not sure if this applies to other types of archives. I usually run sorttv in a cron-job.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Topgunn - 2012-11-03

(2012-10-30, 17:30)Lord_Kami Wrote: Found a bug in the latest stable version. Multi volume rar-archives where files are named .*part[number].rar, sorttv extracts each and every .rar resulting in a very time and space consuming operation.

Hi, I am new to this script and Ive been having a few problems and hence have a few questions. I have been playing around with linux for a little while but Im still a novice with Google being my best friend. After my list of problems you will probably think why bother but the lure of completely automating my system and the fact Im always up for a challenge has me wanting to get it all sorted.
The plan is to run the script when a torrent completes in transmission but for now I just have it sorting my existing download directory.
Ill start with the same problem Lord_Kami is having. Any folder with multipart rars is being unrared times how ever many parts there are so I completely agree its a very time and space consuming operation.
Another problem Im having has been mentioned before in this thread but Im not sure how to fix it. I have both compressed and normal files in my download location and if I set sort-by=COPY so I can keep seeding it leaves a (extracted by sorttv) folder that Transmission wont remove when the torrent ends. I have tried to put (extracted by sorttv) in the delete section of the config but I cant get the script to delete it. My current work around that I came up with is two copies of the script with different configs, one that processes normal files and copies them and the other that processes rars and moves them. I made a basic shell script that calls the normal/copy one first and when that finishes the next rar/move one does any that the first one didnt do. This works but I know it is far from ideal and I would rather have it setup so the one script works by copying all actual files (including whats in the rars) but after a successful copy deleting the rar files it creates and I was wondering what it is exactly I have to put in the script config to delete them?
Also when I run the script back over the same folder and files it seems to uncompress them again before it realises that its already done that file and proceeds to skip it. Thats also putting a lot of unnecessary load on my server along with it processing multipart rars individually. I can see in verbose mode that it can see the file name before it attempts to uncompress it so it should compare then and not after. If my planned integration with transmission works that should take care of it but it might be something that needs looking at. Now to my next question,
When Transmission finishes downloading it can call a script and pass on a few parameters including the downloaded torrents name. If I can use the torrent name when calling the script for eg. perl /path/to/script/sorttv.pl "$TORRENT_NAME" would that work to call the script on that file? I think thats the right way to pull the file name out but if I try to call the script onto an actual file name as a test with no other parameters it makes a folder in the source files directory and not in the destination that I put in the config. Surely I dont have to put the paths to each directory when I call the script? I saw in the readme that you can do perl sorttv.pl --directory-to-sort=/home/me/Downloads --directory-to-sort-into=/home/me/Videos/TV --non-episode-dir=/home/me/Videos/Non-episodes but what about movies or music etc?
If I use the argument file-to-sort= "$TORRENT_NAME" in the config and then just Transmission to call perl /path/to/script/sorttv.pl when a download completes would that work or would it still just put it into the directory where the source file came from?
At the moment the script cant seem to find specials against standard scene release names on the TvDb such as Show Name.S01.Special.Episode title.HDTV.x264-Scene.Group.mp4. I have all the matching and renaming options still at default and I can find it manually on the TvDb listed as a special in Season 1. It picked up the normal episodes ok so I dont know what to change there or if thats a bug.
I realise Im asking for a fair bit here but hopefully I can help somewhat aswell.
I hope I have explained myself properly.
Thanks so much for any help.
edit: just trying to think of different ways of doing what I want





RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Eluc - 2012-11-06

Hello,
I think this program is so cool and just the way I want, but my HTPC is on Openelec (w/o Perl I figured out sadly). Is there a way to get it work on Openelec anyway ? Installing Perl manually or I don't know... Sorry I'm a bit frustrated because I'm very familiary with Windows for years but I'm like a newbie on Linux, even if I try my best.
Any help is welcome.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Topgunn - 2012-11-07

Ok Ive played around with it a bit and had a bit more of a think and im starting to sort out my problems. I managed to find an expression that the script would pick up to delete the folder left behind from the extract process but then i got a :is a directory error so researched how perl deletes files and found the unlink command in the script and that it only deletes files. I then looked up how to delete non-empty directories instead and found the rmtree command so I changed unlink to rmtree in the script and added use File:Tongueath; to the top and bingo it worked. At this stage that folder is the only thing I want deleted so I can leave it like that for now. I doubt it will still delete files but I could add in another argument with unlink if I want that.
This is the first time Ive ever asked for help in a forum because I normally just work out how to do things for myself and I understand people arent here for my beckoned call so its probably a blessing that I havent received any help as yet. Obviously it would make it a lot easier for me but at the same time it feels so good to work things out for yourself. So either way I realise that was my first post here and it was a big one. As I work out the problems Ill post back just in case it can help anyone else in the future.