multi format unpackaging: .zip, .rar, .iso, .7z, .gzip, ...

Want something added? Ask for it here.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: multi format unpackaging: .zip, .rar, .iso, .7z, .gzip, ...

Post by shypike »

FOSS projects like SABnzbd are always understaffed.
There are a few drivers for working on it:
- It has to be done for quality or usability reasons
- It's a feature that the developer him/herself wants to have
- It's fun to do it

So far, implementing 7z support doesn't match at least one of these criteria.
I'm open for code submissions.
Last edited by shypike on February 24th, 2011, 2:58 am, edited 1 time in total.
trog
Newbie
Newbie
Posts: 5
Joined: February 6th, 2011, 11:02 pm

Re: multi format unpackaging: .zip, .rar, .iso, .7z, .gzip, ...

Post by trog »

sander wrote:
trog wrote:
If sabznbd could lead the way in moving off .rar I think could more or less instantly switch my pipeline to use .7z.
Well ... have you tried my 7z-unpack-script? It works for me  :)
Finally got around to having a few spare minutes to try it, but yeh, it looks too Linux-specific to work for me. If I had more time I'd look at Windowsifying it but I'm flat out today (getting on a plane to the US tomorrow for a conference).

I've posted a .7z file using my modified pipeline - you can see it on nzbindex.nl at:

http://nzbindex.nl/search/?q=ausgamers+ ... m=1&more=0

From what I can see it won't work with sander's script by default - 7z's volume creation stuff creates volume filenames like:

filename.7z.001
filename.7z.002
filename.7z.003
...
filename.7z.00n

sander's script does a '7z -y  x *7z' so it won't pick up those sorts of files. Probably can just fix that by changing it to '*7z*', although I'd be happy with '*.7z.*'.

Aside from that it looks like a good starting point - with a bit more work to cater to multiple operating systems it'll be good enough for people to use easily for most files, I suspect. If time permits when I'm back from overseas I'll see what I can do!
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: multi format unpackaging: .zip, .rar, .iso, .7z, .gzip, ...

Post by sander »

trog, I downloaded your post on my system, and ... everything went OK automagically thanks to SAB and my 7z-script.

The 7z.001, 7z.002, etc files are handled by SABnzbd itself: SAB will combine them to the final .7z. And that is where SAB itself will stop. My postprocessing script will take over from there, and will unpack the .7z file.

So: the method works.

Now back to your setup: do you use Windows? Is Python installed?
Please don't send me unrequested PM's; the forum is the best way to communicate.
If someone helps you, please reply to that help.
f you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
john3voltas
Release Testers
Release Testers
Posts: 115
Joined: January 17th, 2008, 5:35 pm
Location: Lisbon/Portugal

Re: multi format unpackaging: .zip, .rar, .iso, .7z, .gzip, ...

Post by john3voltas »

He probably didn't set SAB to join files when done downloading...
SABnzbd 0.6.0Alpha11 on Fedora 14-64bit laptop.
Usenet-News, TeraNews, newszilla6.xs4all.nl and reader.ipv6.xsnews.nl.
IPv6 connections powered by Hurricane Electric.
Can pull 30Mbit nntp on a 30Mbit FTTH link.
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: multi format unpackaging: .zip, .rar, .iso, .7z, .gzip, ...

Post by sander »

Interesting: On Windows, I don't the *7z file, only the *.7z.00n files ...

Code: Select all

26-02-2011  09:43    <DIR>          .
26-02-2011  09:43    <DIR>          ..
26-02-2011  09:43         5.242.880 wweallstars_swaggerfinish.wmv.7z.001
26-02-2011  09:43         5.242.880 wweallstars_swaggerfinish.wmv.7z.002
26-02-2011  09:43         5.242.880 wweallstars_swaggerfinish.wmv.7z.003
26-02-2011  09:43         2.019.513 wweallstars_swaggerfinish.wmv.7z.004
26-02-2011  09:43             1.986 wweallstars_swaggerfinish.wmv.nfo
26-02-2011  09:43             1.601 wweallstars_swaggerfinish.wmv.sfv
               6 File(s)     17.751.740 bytes
               2 Dir(s)  31.529.340.928 bytes free
Please don't send me unrequested PM's; the forum is the best way to communicate.
If someone helps you, please reply to that help.
f you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: multi format unpackaging: .zip, .rar, .iso, .7z, .gzip, ...

Post by sander »

@trog,

I've created a 4-line batch file to handle 7z-unpacking on Windows. I've tested it on Windows XP, and it works.

Contents of the 7z-windows.bat:

Code: Select all

cd %1
if exist *7z 7za x -y *7z
if exist *7z.001 7za x -y *7z.001
echo Finished
It will both handle *7z files and separate *7z.00x files.

Here's the howto:

On-off setup:
Make sure you download the command line version of 7zip: Go to http://www.7-zip.org/download.html and download “7-Zip Command Line Version”. Unpack the downloaded file 7za.exe into your PATH, for example c:\WINDOWS\

Create a directory for the post-processing script, put the above batchfile in there, and fill out that directory in SAB: http://localhost:8080/config/directories/ -> “Post-Processing Scripts Folder”

Usage:
Put a NZB into SABnzbd’s queue the normal way. As soon it’s in the queue, on the right hand side, in the drop down button, select  7z-windows.bat as post-processing.


See the included screenshot how things should look and work.
Please don't send me unrequested PM's; the forum is the best way to communicate.
If someone helps you, please reply to that help.
f you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: multi format unpackaging: .zip, .rar, .iso, .7z, .gzip, ...

Post by sander »

Here's an improved 7z-unpack script for Windows. Including GOTO's ... yeah!  ;)

Code: Select all

@ECHO OFF
cd %1


if exist *7z (
	echo "File with *.7z found. Unpacking it ..."
	7za x -y *7z
	if %ERRORLEVEL% == 0 ( goto OK ) else ( goto NOTOK )
) else if exist *7z.001	(
	echo "File(s) with *.7z.001 found. Unpacking it ..."
	7za x -y *7z.001
	if %ERRORLEVEL% == 0 ( goto OK ) else ( goto NOTOK )
) else (
	echo "No *7z files found, so running this script was not useful ... "
	exit 0
)

echo Strange you should not reach this point
exit 1

:OK
echo Unpacking went OK
exit 0

:NOTOK
echo Something went wrong
exit 1
Please don't send me unrequested PM's; the forum is the best way to communicate.
If someone helps you, please reply to that help.
f you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
thof
Newbie
Newbie
Posts: 1
Joined: June 22nd, 2011, 4:34 am

Re: multi format unpackaging: .zip, .rar, .iso, .7z, .gzip, ...

Post by thof »

Hi All,

Great work! I was finally able to get this working on my NAS, running linux. However I had to change the script a little bit, the command "7z -y  x *7z" should in my case be "7zr -y  x *7z". (edit: with the full 7z package the standard script works!)

Now for an update to the script, I'm looking for a way to also extract ".iso" files. 7z should be able to handle these. How can I change the script to also unpack these?
Oh and does the script also recognize files that are in a deeper folder? Sometimes this happens that the actual files are in a deeper folder...

Thanks!


... aaargh, 7z keeps throwing an error when manually trying to extract an .iso: "Error: Can not open file as archive", Tried different variations on: "7z x *iso"
Last edited by thof on June 22nd, 2011, 5:43 am, edited 1 time in total.
imdos
Newbie
Newbie
Posts: 1
Joined: February 27th, 2012, 10:24 am

Re: multi format unpackaging: .zip, .rar, .iso, .7z, .gzip,

Post by imdos »

thof wrote:Hi All,

Great work! I was finally able to get this working on my NAS, running linux. However I had to change the script a little bit, the command "7z -y  x *7z" should in my case be "7zr -y  x *7z". (edit: with the full 7z package the standard script works!)

Now for an update to the script, I'm looking for a way to also extract ".iso" files. 7z should be able to handle these. How can I change the script to also unpack these?
Oh and does the script also recognize files that are in a deeper folder? Sometimes this happens that the actual files are in a deeper folder...

Thanks!


... aaargh, 7z keeps throwing an error when manually trying to extract an .iso: "Error: Can not open file as archive", Tried different variations on: "7z x *iso"
Can you share the script, you where using?

I can't find the script, and it isn't attached to this thread as well it seams :o
Post Reply