PreProcessing Script query.

Get help, report and discuss bugs.
Post Reply
sparklyballs
Posts: 9
Joined: 12 Jan 2014, 15:59

PreProcessing Script query.

Post by sparklyballs » 15 Jan 2014, 00:25

this is my script thus far for assigning movies with the current year, last year and two years ago in their file names a higher priority in the download list along with giving all TV series very high priority.

#!/bin/sh

curyear=`date +%Y`
lastyear=$((`date +%Y` -1))
twoyearsago=$((`date +%Y` -2))



if [ "$NZBNP_CATEGORY" = movies ] ; then
case "$NZBPP_NZBNAME" in
*$curyear*)
echo "[NZB] PRIORITY=50";;
*$lastyear*)
echo "[NZB] PRIORITY=50";;
*$twoyearsago*)
echo "[NZB] PRIORITY=50";;
esac
fi

if [ "$NZBNP_CATEGORY" = series ] ; then
echo "[NZB] PRIORITY=100"
fi


i can't seem to get the movies side sorted, i can set ALL movies a higher priority using the category string (but i can do that in CP anyways so not what i'm looking for) what i need to know is the correct string for the NZB name as it comes from CP. is NZBPP_NZBNAME the right one ? i've tried the other one listed in the post processing scripts page ( NZBPP_NZBFILENAME ) but neither seem to work for me. is there another one somewhere i'm missing ?

sparklyballs
Posts: 9
Joined: 12 Jan 2014, 15:59

Re: PreProcessing Script query.

Post by sparklyballs » 15 Jan 2014, 00:50

#!/bin/sh

curyear=`date +%Y`
lastyear=$((`date +%Y` -1))
twoyearsago=$((`date +%Y` -2))



if [ "$NZBNP_CATEGORY" = movies ] ; then
case "$NZBNP_NZBNAME" in
*$curyear*)
echo "[NZB] PRIORITY=50";;
*$lastyear*)
echo "[NZB] PRIORITY=50";;
*$twoyearsago*)
echo "[NZB] PRIORITY=50";;
esac
fi

if [ "$NZBNP_CATEGORY" = series ] ; then
echo "[NZB] PRIORITY=100"
fi



NAILED IT, YES !!!!!!!!

I didn't notice it but there is a subtle difference in the $ name on the post processing page and the script i adapted for tv series that i expanded upon to get this.
on the post processing page the string is NZBPP_NZBNAME whereas for a pre process script it should be NZBNP_NZBNAME.

Script works like a dream now i've sussed that out.

jrtwynam
Posts: 3
Joined: 21 Oct 2020, 16:40

Re: PreProcessing Script query.

Post by jrtwynam » 21 Oct 2020, 16:53

Hi,

I realize this is an old thread, but I'm having a similar issue. I've written a scan script that I just want to update the priority of an NZB based on the category, but I can't seem to get the script to execute. The script is below - I've temporarily commented out the IF block for testing purposes, so my hope is that with this version, it would increase the priority for ANY file that gets added, but it's not doing that. I thought that anything that was written to NZBGet, namely an "echo" command here, would show up in the Messages screen, but it doesn't. So, either this assumption was wrong on my part, or the script isn't getting executed.

I've tried setting this up in Settings --> Extension Scripts --> Extensions, and entering "PreProcess.bat" (i.e. the name of the script file), but that doesn't seem to execute it. I've also tried setting this for specific categories, e.g. Category2.Extensions = "PreProcess.bat, PostProcessMovies.bat", thinking that NZBGet would recognize the scan script when the NZB file with that category is added, but no such luck.

As for how I'm adding the NZBs to NZBGet, it's a combination of RSS feeds as well as manually sending them using NZB Unity, which puts a link on the indexer's web page that points to my installation of NZB Get. I think I read somewhere while researching this issue that although there are various ways to load an NZB into NZBGet, once it knows which file you want to load, all these various ways follow the same path to get the file into the queue, so I don't think the method I'm using to add them would make a difference, but I don't know that for sure.

Any help is appreciated.

Thanks.

Code: Select all

@echo off
goto start:
########################################
### NZBGET SCAN SCRIPT    ###

# This script will attempt to adjust the NZB priority based on the category.

### NZBGET SCAN SCRIPT     ###
#########################################

:start

echo Full Path: 	%NZBNP_DIRECTORY%
echo Original NZB:	%NZBNP_NZBFILENAME%
echo Clean NZB:		%NZBNP_NZBNAME%
echo Category:		%NZBNP_CATEGORY%
echo.

rem if %NZBNP_CATEGORY%==Movies (
    echo "[INFO] Setting NZB priority to HIGH"
    echo "[NZB] PRIORITY=50"
rem )


rem # Exit codes used by NZBGet
rem POSTPROCESS_SUCCESS=93
rem POSTPROCESS_NONE=95
rem POSTPROCESS_ERROR=94
exit /b 93

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

Re: PreProcessing Script query.

Post by hugbug » 28 Oct 2020, 13:07

For each script a section should appear in the settings.
If the section isn't there then the script wasn't recognised as an extension script and it will not work.
Also instead of entering the script name manually you should be able to select the script via button "Choose" near edit field of option Extensions. Again, if the script isn't in the list it will not work.

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests