[Queue Script] Get password from file based on nzbname

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.
Post Reply
sflargo
Posts: 29
Joined: 12 May 2012, 10:13

[Queue Script] Get password from file based on nzbname

Post by sflargo » 22 Aug 2020, 16:47

Find here my script to get the password which is one line below the nzbname.
Thus the structure of the password file has to be:

Code: Select all

#Header: xxxxxx
#Pass: yyyyy
#
#Header: xxxxxx
#Pass: yyyyy
#
#Header: xxxxxx
#Pass: yyyyy

script:

Code: Select all

#!/bin/sh
#-----------------------------------------------------------------------
#NZBGet >11 Post-Processing-Script
#-----------------------------------------------------------------------

##############################################################################

### NZBGET SCAN SCRIPT

# Get password from password file.
# Structure of password file:
#Header: xxxxxx
#Pass: yyyyy
#
#Header: xxxxxx
#Pass: yyyyy
#
#Header: xxxxxx
#Pass: yyyyy

##############################################################################
### OPTIONS ###

#inputpath=
#inputfile=

### NZBGET SCAN SCRIPT


inputext=$NZBNP_NZBNAME
input=$(echo "$inputext" | cut -f 1 -d '.')

#constants:
nzb_success=2
pref_corrupt=0
success=93
failure=94
none=95

inputfile=$NZBPO_inputpath$NZBPO_inputfile

echo "using passfile: $inputfile"
echo "searching for: $input"

echo "(grep -1 $input $inputfile)"
pass=$(grep -1 $input $inputfile)




echo "found pass" $pass

string=$pass
if [[ $string == *":"* ]]; then

{
    echo ": found, cleaning"
	    cleaned=$(echo $string | cut -d':' -f3)
		    cleanedws=$(echo $cleaned | xargs)
			    echo "using password" $cleanedws
	echo "[NZB] NZBPR_*Unpack:Password=$cleanedws"
	}
	exit $success
	fi
                      


exit $failure

Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests