Unpack without directory structure?

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
combspecialist
Newbie
Newbie
Posts: 16
Joined: July 1st, 2011, 10:30 am

Unpack without directory structure?

Post by combspecialist »

I've recently been trying to get automatic downloading/naming working with RSS feeds and have just about cracked it. The only problem I have is that some posters insist on placing the main file I want (for example a 1.1GB MKV file) within a directory within the RAR archive. This seems to throw off the auto renaming. The extraction still takes place and is also done to the right location but I end up with another subfolder being created (the one from within the RARs) and that then contains the MKV file with it's original name.

The other crap in there (.srr, .nfo etc) have already been tidied up using sab's file discard feature so what I'm trying to do is get sab to exatrct such archives but ignore the directory structure within. I hope it would then discard the extra crap, see there's only the TV episode left and apply its renaming skills. Is this possible?
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Unpack without directory structure?

Post by shypike »

SABnzbd already tries to collapse unneeded folders.
So jobname/folder/file.avi will be reduced to jobname/file.avi.
However when spurious files exist at the jobname/ level, this won't happen.
Posters pack their stuff in so many different ways that it's impossible to come
to a universal and reliable solution.
Sure you can tell unrar to ignore packed folder, but this immediately brings up the
question of what to do with duplicate names. Also things like DVD images need an internal structure.

BTW: I need to check whether the folder collapse is done before or after the
extension-based cleanup. (It should be done afterwards).
combspecialist
Newbie
Newbie
Posts: 16
Joined: July 1st, 2011, 10:30 am

Re: Unpack without directory structure?

Post by combspecialist »

Thanks for the speedy reply. Would a sensible compromise be to have an option to collapse unneeded folders only when additional files are all covered by the cleanup list? Or is there an unsupported method I can already use to force this behaviour?
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: Unpack without directory structure?

Post by sander »

Some remarks/ideas:

unrar-commands:
e Extract files to current directory
x Extract files with full path

So I think you want 'e' not 'x', right?

My SAB log file says:

sabnzbd.log.5:2011-07-20 11:40:53,384::DEBUG::[newsunpack:530] Running unrar ['/usr/bin/unrar', 'x', '-idp', '-o-', '-or', '-p-', '/home/sander/Downloads/incomplete/blabla/BLABLA.part01.rar', '/home/sander/Downloads/complete/_UNPACK_blabla/']

So 'x' is used.

http://localhost:8080/config/switches/ does not provide rar/unrar parameter options (as it does for par2). Pity.


sabnzbd/newsunpack.py says

if one_folder:
action = 'e'
else:
action = 'x'

I don't know what one_folder means, and/or how you can force it. Maybe it's an option after all? If not, you could consider setting action = 'e' in the source code for all cases.


HTH
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Unpack without directory structure?

Post by shypike »

one_folder is about the option to store every file of a category in the category base folder.
Triggered by appending an asterisk * to the category path.
That's not what you want for every category. Suitable for single AVI filea, but not for DVDs.
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: Unpack without directory structure?

Post by sander »

combspecialist wrote:Thanks for the speedy reply. Would a sensible compromise be to have an option to collapse unneeded folders only when additional files are all covered by the cleanup list? Or is there an unsupported method I can already use to force this behaviour?
Maybe easier to make a post-processing script that will take care of what you want. In (untested) pseudo-code without checking if a file is being overwritten:

Code: Select all

mv $1/* $1
mv $1/*/* $1
mv $1/*/*/* $1
or only select *.mkv if you want.

HTH
combspecialist
Newbie
Newbie
Posts: 16
Joined: July 1st, 2011, 10:30 am

Re: Unpack without directory structure?

Post by combspecialist »

OK, I have done some testing on this to try and work out what's happening and having manually downloaded a RAR set for an episode which spawned an additional folder, I've found there is no additional folder in the rar set at all. So it would seem sab is responsible for the additional folders somehow.

Here's an example NZB filename picked up from an RSS filter:

ShowName.S04E03.Episode.Title.720p.WEB-DL.DD5.1.H.264.nfo.nzb

After downloading, sab unpacks this to: S:\ShowName\Season 4\ShowName.S04E03.Episode.Title.720p.WEB-DL.DD5.1.H.264.nfo\ShowName.S04E03.Episode Name.720p.WEB-DL.DD5.1.H.264-TB.mkv

I may have something misconfigured but everything looks correct to me (and this method is working for some downloads). I have a category set up to deal with this show and the Folder/Path is set to S:\ShowName\Season 4. I also have Series Sorting enabled using the mask %sn S%0sE%0e.WEBDL.%ext.

So what I'm aiming for is extraction to S:\ShowName\Season 4\ShowName S04E03.WEBDL.mkv which I thought my settings would achieve, I've obviously overlooked something though - can anyone help?
combspecialist
Newbie
Newbie
Posts: 16
Joined: July 1st, 2011, 10:30 am

Re: Unpack without directory structure?

Post by combspecialist »

Update: I'm an idiot. On the Config -> Sorting screen, I hadn't highlighted all of the entries in the Affected Categories list and therefore the naming was not being applied and sab was falling back on using the "NZB as folder name" method. For some reason, I hadn't realised you could highlight multiple items in that list and it's not a style you normally see with lists such as that, it's normally checkboxes. That's my lame defense anyway!
Post Reply