[Request] Flat unpack

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: 7514
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [Request] Flat unpack

Post by hugbug » 12 Nov 2014, 11:45

Check line ending. Use dos2unix or a text editor to transform.

Vash
Posts: 4
Joined: 09 Nov 2014, 19:04

Re: [Request] Flat unpack

Post by Vash » 12 Nov 2014, 19:56

clintonhall wrote:I updated the code above... stupid typo had "dirPath" instead of "dirpath"

Try again.
Thank you again. :) Now it does say succesfull, but does not flatten. For Example "Reno.and.Decor".

Now it's like this "/volume1/Downloads/ebooks/Reno.and.Decor.TruePDF-December.2014/Reno.and.Decor.TruePDF-December.2014.pdf"

But i want it like this "/volume1/Downloads/ebooks/Reno.and.Decor.TruePDF-December.2014.pdf" No subfolders at all. Flat into root like Sabnzbd does. Is there a way?

Code: Select all

INFO	Wed Nov 12 2014 20:40:55	Collection Reno.and.Decor.TruePDF-December.2014 added to history
INFO	Wed Nov 12 2014 20:40:55	Post-process-script flatten.py for Reno.and.Decor.TruePDF-December.2014 successful
INFO	Wed Nov 12 2014 20:40:54	flatten: Checking for empty folders in:/volume1/Downloads/ebooks/Reno.and.Decor.TruePDF-December.2014
INFO	Wed Nov 12 2014 20:40:54	flatten: Flattening directory: /volume1/Downloads/ebooks/Reno.and.Decor.TruePDF-December.2014
INFO	Wed Nov 12 2014 20:40:54	flatten: Script triggered from NZBGet Version 14.0-testing.
INFO	Wed Nov 12 2014 20:40:54	Executing post-process-script flatten.py for Reno.and.Decor.TruePDF-December.2014
INFO	Wed Nov 12 2014 20:40:54	Unpausing download after move
INFO	Wed Nov 12 2014 20:40:54	Move for Reno.and.Decor.TruePDF-December.2014 successful
INFO	Wed Nov 12 2014 20:40:54	Moving file Reno.and.Decor.TruePDF-December.2014.pdf to /volume1/Downloads/ebooks/Reno.and.Decor.TruePDF-December.2014
INFO	Wed Nov 12 2014 20:40:54	Moving file Reno.and.Decor.TruePDF-December.2014.pdf.par2 to /volume1/Downloads/ebooks/Reno.and.Decor.TruePDF-December.2014
INFO	Wed Nov 12 2014 20:40:54	Moving completed files for Reno.and.Decor.TruePDF-December.2014
INFO	Wed Nov 12 2014 20:40:54	Nothing to unpack for Reno.and.Decor.TruePDF-December.2014
INFO	Wed Nov 12 2014 20:40:54	No renamed files found for Reno.and.Decor.TruePDF-December.2014
INFO	Wed Nov 12 2014 20:40:54	Checking renamed files for Reno.and.Decor.TruePDF-December.2014
INFO	Wed Nov 12 2014 20:40:54	Pausing download before par-rename
INFO	Wed Nov 12 2014 20:40:54	Queueing Reno.and.Decor.TruePDF-December.2014 for post-processing
INFO	Wed Nov 12 2014 20:40:54	Collection Reno.and.Decor.TruePDF-December.2014 completely downloaded
INFO	Wed Nov 12 2014 20:40:54	Successfully downloaded Reno.and.Decor.TruePDF-December.2014/Reno.and.Decor.TruePDF-December.2014.pdf

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

Re: [Request] Flat unpack

Post by hugbug » 12 Nov 2014, 20:21

Vash wrote:I had this feature with sabnzbd, called "flat_unpack". It upacks files, but ignores the subfolders in the archive.
The script does what was requested. The top-level folder with nzb-name is created automatically by NZBGet. All additional folders inside archive are flattened by the script.
If you want to move files outside of the nzb-folder that requires attention to handle existing files with the same names.

Vash
Posts: 4
Joined: 09 Nov 2014, 19:04

Re: [Request] Flat unpack

Post by Vash » 12 Nov 2014, 20:48

hugbug wrote:
Vash wrote:I had this feature with sabnzbd, called "flat_unpack". It upacks files, but ignores the subfolders in the archive.
The script does what was requested. The top-level folder with nzb-name is created automatically by NZBGet. All additional folders inside archive are flattened by the script.
If you want to move files outside of the nzb-folder that requires attention to handle existing files with the same names.
Hi hugbug, actually i was looking for a way to get this Sabnzbd feature "flat_unpack" with nzbget. English is not my motherlanguage, I'am sorry for the misunderstanding. With Sabnzbd you can activate for each rss stream that "flat_unpack" feature. That means, that all files are extracted flat into main rss folder, like for example "/volume1/Downloads/ebooks/". No subfolders at all, all files flat in main. Well, if it's not possible, i can live without it :) It's still a cool feature for maybe someday in the future?? ;)

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

Re: [Request] Flat unpack

Post by hugbug » 12 Nov 2014, 20:58

This is of course is possible with the pp-script. We just have to wait a minute until Clinton implement the feature :lol:

Pp-script VideoSort works in a similar way by moving downloaded videos into a different location.

clintonhall
Posts: 449
Joined: 15 Dec 2012, 01:52
Location: Australia
Contact:

Re: [Request] Flat unpack

Post by clintonhall » 12 Nov 2014, 23:00

I just edited the script to include a new option:
"DestinationDirectory"

If you set DestinationDirectory = /volume1/Downloads/
it will flatten all files into /volume1/Downloads/

if you leave this blank, it will flatten the files into the individual download sub-directory.

if you then activate the option AppendCategories, the files would be flattened into /volume1/Downloads/ebooks/

clintonhall
Posts: 449
Joined: 15 Dec 2012, 01:52
Location: Australia
Contact:

Re: [Request] Flat unpack

Post by clintonhall » 12 Nov 2014, 23:11

hugbug,

do I need to print a command back to NZBGet to set the nzbdirectory for any other scripts that follow??? Is this dangerous, as it means other scripts could now try to process ALL previously downloaded files?

Magoo
Posts: 2
Joined: 08 Jun 2015, 09:15

Re: [Request] Flat unpack

Post by Magoo » 08 Jun 2015, 19:51

For some reason I can't get this script to work properly even after setting "destination dir".

No error or warnings, but I still end up with the nzb folder name?


Thanks,
Magoo

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

Re: [Request] Flat unpack

Post by hugbug » 08 Jun 2015, 22:25

Magoo wrote:For some reason I can't get this script to work properly even after setting "destination dir".

No error or warnings, but I still end up with the nzb folder name?
The script works as expected, see the first post. For what you want (which is an undestandable request) the script has to be extended.

clintonhall
Posts: 449
Joined: 15 Dec 2012, 01:52
Location: Australia
Contact:

Re: [Request] Flat unpack

Post by clintonhall » 10 Jun 2015, 12:18

I just made a slight change that may have prevented this working with single directory downloads... I also added some more logging to see what is going on.

Please update the code as per the 3rd post in this thread, then try again and post logs if this doesn't work.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests