all this happens on a Win 7 machine, i guess Linux users will have to at least change the path to par2 and unrar and exchange % with $ as explained here:
http://wiki.sabnzbd.org/user-scripts
the situation would be like this/the nzb contains:
password protected rars
renamed par2 to .p345
so you can´t just use the standard "delete" post processing option, cause there are no usable par2 files, or they aren´t recognized
what i want to do is to automatically rename, repair and extract the pw protected rars
the idea:
renaming the unusable pars
calling par2 to repair/rename
calling rar to extract with pw
the actual script:
(create a .txt file, copy the text in the code box to that file, save as .bat and put it in the sabnzb script folder, set path in sabnzb options):
IMPORTANT NOTE: when importing the job/nzb into sabnzb the nzb name HAS TO BE the password for extraction! (see below why)
you MUST NOT rename the job/nzb name in sabnzb because after downloading the nzbname=jobname=finished folder name is set as password for extraction
what you can do to know what you are downloading: in sabnzb you can set a password: jobname / password
with my script sabnzbs own postprocessing is disabled so the pw isn´t used so you can set that to release name what you are downloading, it would have no other function
Code: Select all
@echo off
cd /d %1
IF EXIST "*.p*" (rename "*.p*" "*.par2") ELSE echo no pars found !
IF EXIST "*.par2" echo pars successfully renamed
"C:\Program Files (x86)\SABnzbd\win\par2\x64\par2.exe" r "*.par2" "*"
"C:\Program Files (x86)\SABnzbd\win\unrar\x64\unrar.exe" x -p%3 "*.rar"
IF errorlevel 1 echo unpacking failure ! (wrong password?)
IF not errorlevel 1 del "*.rar" "*.par2"explanation what the script does:
Code: Select all
@echo off #all messages off, except where "echo" is written
cd /d %1 #ChangeDirectory to finshed job directory
IF EXIST "*.p*" (rename "*.p*" "*.par2") ELSE echo no pars found ! #if .p* files are found, rename to .par2 else error message, IF/ELSE have to be in the same line, therefore the () to seperate the commands
IF EXIST "*.par2" echo pars successfully renamed #after renaming, if .par2 files are found, success message
"C:\Program Files (x86)\SABnzbd\win\par2\x64\par2.exe" r "*.par2" "*" #call par2 to repair and look for all files, that way totally randomly named files are scanned too, if you have sabnzb installed to a different location you have to set the correct path!
"C:\Program Files (x86)\SABnzbd\win\unrar\x64\unrar.exe" x -p%3 "*.rar" #call unrar to extract with pw=job/nzbname, if you have sabnzb installed to a different location you have to set the correct path!
IF errorlevel 1 echo unpacking failure ! (wrong password?) #if unpacking unsuccessful, error message
IF not errorlevel 1 del "*.rar" "*.par2" #after successful extraction, delete all rars and pars
i´m not sure how to extract the / password from the sabnzb attribute file and make that available for unrar, is that possible with windows shell? (i don´t want to bloat the script so that users who would use that script don´t have to install any additional software)shypike wrote:The password is stored here:The content is like this:Code: Select all
<incomplete>\%3\__ADMIN__\SABnzbd_attribPlease note that this will only work if you haven't renamed a job.Code: Select all
* 3 None 0 Job name / PASSWORD Job name.nzb
