SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Printable Version
+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for XBMC (/forumdisplay.php?fid=116)
+--- Thread: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) (/showthread.php?tid=75949)
- vikjon0 - 2011-06-06 15:42
Quote:be named S01E01-part1I made a flithy fix for this.
EDIT: small fix...I need to store the prevnewpath before amendment otherwise there will never be a third hit.
This is of course a stupid way of doing it since I do not get part1 correctly. However, since stacking does not work in dharma it is not a big deal assuming it will scrap.
EDIT2: Bad luck for me.. it scraps but "-part2" is displayed before "" in xbmc episode list. A further filthy fix could rename the already moved file but that is perhaps a bit too dirty since we do not know if we actually did create that file or we "skipped"
In addition to this kind of fix I should probably try to guess that it is a part based on filename as well. (part1, cd1 + custom list from config file). E.g of custom list: "","walkthrough","revisited". (example from grand designs)
For the moment that is too advanced for me..still did not do the regex homework
- cliffe - 2011-06-06 16:30
vikjon0 Wrote:I made a flithy fix for this.
So, to clarify, you want it to detect that two files resulted in the same rename during a SortTV sort, and name them with part1, part2 etc. But if a later sort results in the same name then that is a separate case, since they might be coming from the exact same origin filename or be a later repack of the same episode and you don't want to have those stacked, where the same episode would show more than once.
Eg "Show S1E1 - Episode part 1.avi", "Show S1E1 - Episode part 2.avi", and "Show S1E1 - making of.avi" when sorted at the same time would become:
Show/Season 1/Show - S01E01 - Title part1.avi
Show/Season 1/Show - S01E01 - Title part2.avi
Show/Season 1/Show - S01E01 - Title part3.avi
The way I would go about doing this would probably be as follows. SortTV already maintains a shorthand list of episodes that have been sorted this time around, which is stored in the variable $newshows. $newshows contains a list of ("Show S1E1\nShow S1E2\n") etc. When sorting you could check if $newshows already contains the episode being sorted. If it does, then figure out how many of that episode are in the list and tack a part number at the end of the new one, if this is the second instance, then rename the first sorted file to have "part1" at the end.
Learning regex is definitely a good idea
Thanks and good luck.
- vikjon0 - 2011-06-06 16:46
Quote:So, to clarify, you want it to detect that two files resulted in the same rename during a SortTV sort, and name them with part1, part2 etc. But if a later sort results in the same name then that is a separate case, since they might be coming from the exact same origin filename or be a later repack of the same episode and you don't want to have those stacked, where the same episode would show more than once.Yes, and the reason I wanted to add guessing from the filename if it was a part is that if the sorting are interupted with one of the parts left in sortdir the current method will not remember. In the example I work with now it is not clear from the filename but part1 or cd1 will often be part of the name.
Quote: $newshowsOk, that is useful. It does not include skipped files? Still it is not very clean to go back into the destination dir and rename a file. A better solution will require some more work. A pre-loop of the directory or a temp dir.
- cliffe - 2011-06-06 17:06
vikjon0 Wrote:Yes, and the reason I wanted to add guessing from the filename if it was a part is that if the sorting are interupted with one of the parts left in sortdir the current method will not remember. In the example I work with now it is not clear from the filename but part1 or cd1 will often be part of the name.
I think the place to do this would be when the new file name is being calculated, and you could look at the original filename to see if it includes "part" etc (regex). If so add to the end.
vikjon0 Wrote:Ok, that is useful. It does not include skipped files? Still it is not very clean to go back into the destination dir and rename a file. A better solution will require some more work. A pre-loop of the directory or a temp dir.
$newshows does not include skipped files, but it does include files that have been overwritten with a repack etc. Maybe renaming sorted files is not quite as clean as deciding in advance, but it would be much faster to do the sort and probably easier in terms of the amount of code you would have to change. It would also be easier to review your changes and it will be easier for you to write if you don't have to make huge changes to the existing code.
On the other hand, one alternative approach would be to calculate the moves and directory creations etc in a dry run and store the changes to make in a list. This would make it possible to do the actual sorting multi-threaded: once all the decisions had been made the actual changes could be done by multiple threads. I am really not sure if it is worth the added complexity though, and I don't have the time to do that kind of refactoring.
Probably the easiest solution would be, when calculating the new name, if the original had "part1" or "cd1" etc then add "part1" to the end of the new name.
Anyway, let me know how you go.
Off the top of my head, untested:
Update 2: On second thoughts this could all be achieved with a one-line regex substitution.
Hope that helps, maybe try putting that in to the rename and see if it works etc
- pcvii - 2011-06-14 19:33
From G:/Media/Video/Wont sort TV/
TV episodes into G:/Media/Video/TV/
INFO: trying to move dirty jobs season 7 episode 11
INFO: found a matching show:
INFO: found a matching season directory:
G:/Media/Video/TV/Dirty Jobs/Season 7
INFO: Fetching episode title for Dirty Jobs Season 7 Episode 11.
Entity: line 1: parser error : Start tag expected, '<' not found
- piotrasd - 2011-06-25 12:02
Nice will be add auto sample/samples remove.
- piotrasd - 2011-06-25 12:24
I dont know why, but after extracted some movie ... sorttv dont remove archive files (rar,zip) files then i must manualy remove
(im use latest version)
And in target folder i have movie in folder
hobo.with.a.shotgun.2011.limited.720p.bluray.x264-amiable.rar (extracted by SortTV) :/
Others movie normal are extracted (zip, rar) removed, and movie files move to folder but without this ****************.rar (extracted by SortTV)
Please help me ... Thanks !
- cliffe - 2011-06-26 04:57
Currently SortTV doesn't delete files from the source directory, but it does ignore files matching the blacklist (see the config file). So .rar files and samples are not sorted into the destination directory, they just stay there. In the case of rar files they are extracted and those contents are sorted, but the rar files stay. I guess what you are requesting is an option to delete those files from the source directory, rather than ignore them.
- piotrasd - 2011-06-27 02:55
Yes will be nice, because now is not full auto :/ because we must manual go to download folder and delate myself all rest files
Add some rule like:
If extracted is without error - delate source files ...
New version available - cliffe - 2011-07-10 14:29
New in this version:
Please consider a $5 donation if you find this script helpful. Click here to make a donation using paypal
Get the new version from:
Try out the new delete option. Just edit the config file to enable deleting those files. Keep in mind that it is separate from the extraction, so if you are worried that the extraction wont succeed don't add them to the delete list.
pcvii Wrote:parser error : Start tag expected, '<' not foundThe new version should recover from these types of things.