[PP-Script] VideoSort - better video sorting

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [PP-Script] VideoSort - better video sorting

Post by hugbug » 11 Aug 2016, 09:25

\\\\192.168.178.4\\usenet-downloads\\Downloads\\The.100.S02E07.Der.Weg.in.die.Freiheit.German.DD51.Dubbed.DL.1080p.iTunesHD.AVC-TVS{{UsenetRevolution}}\\The.100.S02E07.Der.Weg.in.die.Freiheit.German.DD51.Dubbed.DL.1080p.iTunesHD.AVC-TVS\\tvs-thu-dd51-ded-dl-18p-ithd-avc-207.mkv
The path is above normal Windows limit of 260 characters and cannot be access using standard file functions. There is a way to overcome the limitation by encoding filenames in a special way but VideoSort needs to be extended for this. Created an issue on tracker but can't give you a promise when this will be added. Help from other users/developers is very welcome.

As a workaround try to shorten your paths. For example instead of "\\192.168.178.4\usenet-downloads\Downloads" you could make "\\192.168.178.4\UDownloads". Then if possible shorten nzb file names.

dasganni
Posts: 4
Joined: 10 Aug 2016, 22:24

Re: [PP-Script] VideoSort - better video sorting

Post by dasganni » 12 Aug 2016, 10:43

hugbug wrote:
\\\\192.168.178.4\\usenet-downloads\\Downloads\\The.100.S02E07.Der.Weg.in.die.Freiheit.German.DD51.Dubbed.DL.1080p.iTunesHD.AVC-TVS{{UsenetRevolution}}\\The.100.S02E07.Der.Weg.in.die.Freiheit.German.DD51.Dubbed.DL.1080p.iTunesHD.AVC-TVS\\tvs-thu-dd51-ded-dl-18p-ithd-avc-207.mkv
The path is above normal Windows limit of 260 characters and cannot be access using standard file functions. There is a way to overcome the limitation by encoding filenames in a special way but VideoSort needs to be extended for this. Created an issue on tracker but can't give you a promise when this will be added. Help from other users/developers is very welcome.

As a workaround try to shorten your paths. For example instead of "\\192.168.178.4\usenet-downloads\Downloads" you could make "\\192.168.178.4\UDownloads". Then if possible shorten nzb file names.
Hi,

thanks for your fast answer. I deinstalled the service and now use the application with user rights to use network drives. Hoped this will solve the Problem as it shortens the path, but the Problem still exists.. If I have a look into the failed file, the destination path is: Z:\Stranger.Things.S01E02.Die.Verrueckte.auf.der.Maple.Street.German.DD51.DL.1080p.NetflixUHD.x264-TVS{{UsenetRevolution}} || 123 characters
and the file name is: \tvs-st-dd51-dl-18p-nfuhd-x264-102.mkv ||39 characters

Together 162 characters which seems to fit into the 260 characters.

But he still doubles all backslashes sometimes and as I have seen now the folder too:

Z:\\Stranger.Things.S01E02.Die.Verrueckte.auf.der.Maple.Street.German.DD51.DL.1080p.NetflixUHD.x264-TVS{{UsenetRevolution}}\\Stranger.Things.S01E02.Die.Verrueckte.auf.der.Maple.Street.German.DD51.DL.1080p.NetflixUHD.x264-TVS\\tvs-st-dd51-dl-18p-nfuhd-x264-102.mkv

After doing this, yes 264 characters.. Can not figure out, why he is doubling everything.. Any Idea? I will have a further look into this myself and update if I find something.

Best regards

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [PP-Script] VideoSort - better video sorting

Post by hugbug » 12 Aug 2016, 11:09

dasganni wrote:why he is doubling everything.. Any Idea?
That's how python exception handler prints them. The actual strings do not have double slashes.

Generally it is better if you provide the whole post-processing log (via pastebin.com). In your previous message the error was "VideoSort: [Error 3] Das System kann den angegebenen Pfad nicht finden" and the path was indeed longer than 260 characters. Now you only provided the info that "the Problem still exists.". From that I can only understand that *something* doesn't work as you expect. Were there any error messages?

dasganni
Posts: 4
Joined: 10 Aug 2016, 22:24

Re: [PP-Script] VideoSort - better video sorting

Post by dasganni » 12 Aug 2016, 11:36

Hi,

yes, the error was the same: VideoSort: [Error 3] Das System kann den angegebenen Pfad nicht finden: 'Z:\\Stranger.Things.S01E02.Die.Verrueckte.auf.der.Maple.Street.German.DD51.DL.1080p.NetflixUHD.x264-TVS{{UsenetRevolution}}\\Stranger.Things.S01E02.Die.Verrueckte.auf.der.Maple.Street.German.DD51.DL.1080p.NetflixUHD.x264-TVS\\tvs-st-dd51-dl-18p-nfuhd-x264-102.mkv'

But i found a little workaround with the helping of another script. I used flatten.py to move the files one directory above, so now the path is much shorter again and for now, it successed some times, I will try further on.

Thank you and best regards

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [PP-Script] VideoSort - better video sorting

Post by hugbug » 12 Aug 2016, 12:02

flatten.py will not help as it doesn't support long file names either.

If it sometimes works and other times doesn't (for the same nzb) - there should be another reason like network issue maybe?

dasganni
Posts: 4
Joined: 10 Aug 2016, 22:24

Re: [PP-Script] VideoSort - better video sorting

Post by dasganni » 12 Aug 2016, 12:34

Hmm, i understand, that this should not work, but for the moment it does, tried with some nzbs now (20) and tried this too with the ones, which had problems before and now everyone succeed.. Maybe just luck, I will have a further look into this, if this really was just luck and it happens again, i will check if this can be the network. Really appreciate your help!

ObB
Posts: 14
Joined: 17 Jun 2015, 20:13

Re: [PP-Script] VideoSort - better video sorting

Post by ObB » 29 Aug 2016, 05:49

Here is my "problem" ...

I'm mostly happy with the way that NZBGet puts all the files downloaded for an NZB in a folder using the "name" from the NZB header. I move these folders manually from NZBGet's DestDir to my own folder structure. Obfuscated filenames are not usually a problem for me as I am using the folder names to identify downloads. But on my iPhone/iPads I use the app Infuse (https://firecore.com/infuse). When using this app to browse folders it works as you would expect, except when a folder contains only one video file, it does not show the folder, but instead only shows the video file. This becomes a problem when that file has an obfuscated filename. The folder name is still good, but the Infuse app does not show the folder so it is hard to identify files.

So I tried using VideoSort. What I want to do is *NOT* move any files from the folder that NZBGet creates in "DestDir", but to rename the video files inside the folder. However, it appears that VideoSort always moves the video files to another folder.

So I made some changes that appear to work, for me at least. I am *NOT* a Python programmer, but I have worked in a number of other languages, and I can often get by cut and pasting small sections of code :)

What I did was make "." a special case for destination directories where if specified the "dest_dir" will be set from the source filename, so in effect, the file(s) will not be moved from their original folder.

I also have to check to see if "new_path" file name if the same as the original "filename" to prevent renaming to "filename.(2).ext"

Both of these code snippets are in the function "construct_path(filename)"

----

Code: Select all

    if dest_dir == '':
        dest_dir = os.path.dirname(download_dir)
----
becomes ...
----

Code: Select all

    if dest_dir == '':
        dest_dir = os.path.dirname(download_dir)

    if dest_dir == '.':
        dest_dir = os.path.dirname(filename)
----

and

----

Code: Select all

	return new_path
----
becomes
----

Code: Select all

    if filename == new_path:
        if verbose:
            print('filename == new_path - return None')
        return None

    return new_path
----


There is probably plenty that is wrong with this implementation, (for example, I'm not too sure how well it will work with "Cleanup" or "Overwrite" set to "yes" ... I have both options set to "No") but its working well enough for me at the moment.

But I do think that this option to not move the files from the original folder would be useful if it could be implemented properly into the official code.

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [PP-Script] VideoSort - better video sorting

Post by hugbug » 29 Aug 2016, 07:36

I think with these settings VideoSort should do what you need:

Code: Select all

MoviesDir=
SeriesDir=
DatedDir=
MoviesFormat=%dn/%dn
SeriesFormat=%dn/%dn
DatedFormat=%dn/%dn
Not sure what happens if the file already has the correct name - that may require your patch to avoid adding suffix (2).

ObB
Posts: 14
Joined: 17 Jun 2015, 20:13

Re: [PP-Script] VideoSort - better video sorting

Post by ObB » 29 Aug 2016, 13:34

hugbug wrote:I think with these settings VideoSort should do what you need:

Code: Select all

MoviesDir=
SeriesDir=
DatedDir=
MoviesFormat=%dn/%dn
SeriesFormat=%dn/%dn
DatedFormat=%dn/%dn
That works too !!

I did try to think of how to get the existing code to do what I wanted,but obviously I didn't think hard enough !!
Not sure what happens if the file already has the correct name - that may require your patch to avoid adding suffix (2).
It does add the (2) suffix. Not the end of the world, but a little annoying. (its easy to test by just doing "Post-Proccess Again" multiple times where the source and destination folders are the same)

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [PP-Script] VideoSort - better video sorting

Post by hugbug » 29 Aug 2016, 14:54

ObB wrote:It does add the (2) suffix.
That's to improve.
Would you like to create a pull request on github or should I do the changes myself?

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests