diff --git a/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh b/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh deleted file mode 100755 index afe8fd8b..00000000 --- a/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh +++ /dev/null @@ -1,502 +0,0 @@ -#!/bin/sh -# -*- coding: cp1252 -*- -# -# Example postprocessing script for NZBGet -# -# Copyright (C) 2008 Peter Roubos -# Copyright (C) 2008 Otmar Werner -# Copyright (C) 2008-2012 Andrei Prygunkov -# Copyright (C) 2012 Antoine Bertin -# Copyright (C) 2012 J�rgen Seif -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# - -####################### Usage instructions ####################### -# o Script will unrar downloaded rar files, join ts-files and rename img-files -# to iso. -# -# o To use this script with nzbget set the option "PostProcess" in -# nzbget configuration file to point to this script file. E.g.: -# PostProcess=/home/user/nzbget/nzbget-postprocess.sh -# -# o The script needs a configuration file. An example configuration file -# is provided in file "postprocess-example.conf". Put the configuration file -# into the directory where nzbget's configuration file (nzbget.conf) or where -# this script itself is located. Then edit the configuration file in any -# text editor to adjust the settings. -# -# o You can also edit the script's configuration via web-interface (requires -# NZBGetWeb 1.4 or later). Set the options "PostProcessConfigFile" and -# "PostProcessConfigTemplate" to point to "postprocess-example.conf" -# (including full path). The both options are under the section -# "CONFIGURATION OF POSTPROCESSING-SCRIPT" in NZBGetWeb. -# -# o There are few options, which can be ajdusted for each nzb-file -# individually. To view/edit them in web-interface click on a spanner icon -# near the name of nzb-file. -# -# o The script supports the feature called "delayed par-check". -# That means it can try to unpack downloaded files without par-checking -# them fisrt. Only if unpack fails, the script schedules par-check, -# then unpacks again. -# To use delayed par-check set following options in nzbget configuration file: -# ParCheck=no -# ParRepair=yes -# LoadPars=one (or) LoadPars=all -# -# o If you want to par-check/repair all files before trying to unpack them, -# set option "ParCheck=yes". -# -####################### End of Usage instructions ####################### - - -# NZBGet passes following arguments to postprocess-programm as environment -# variables: -# NZBPP_DIRECTORY - path to destination dir for downloaded files; -# NZBPP_NZBFILENAME - name of processed nzb-file; -# NZBPP_PARFILENAME - name of par-file or empty string (if no collections were -# found); -# NZBPP_PARSTATUS - result of par-check: -# 0 = not checked: par-check disabled or nzb-file does -# not contain any par-files; -# 1 = checked and failed to repair; -# 2 = checked and successfully repaired; -# 3 = checked and can be repaired but repair is disabled; -# NZBPP_NZBCOMPLETED - state of nzb-job: -# 0 = there are more collections in this nzb-file queued; -# 1 = this was the last collection in nzb-file; -# NZBPP_PARFAILED - indication of failed par-jobs for current nzb-file: -# 0 = no failed par-jobs; -# 1 = current par-job or any of the previous par-jobs for -# the same nzb-files failed; -# NZBPP_CATEGORY - category assigned to nzb-file (can be empty string). - - -# Name of script's configuration file -SCRIPT_CONFIG_FILE="nzbget-postprocess.conf" - -# Exit codes -POSTPROCESS_PARCHECK_CURRENT=91 -POSTPROCESS_PARCHECK_ALL=92 -POSTPROCESS_SUCCESS=93 -POSTPROCESS_ERROR=94 -POSTPROCESS_NONE=95 - -# Postprocessing function for nzbToCouchPotato and nzbToSickBeard -nzbToMedia() { - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing external postprocessing with argument $1" ; fi - PostProcessStatus=0 - if [ -n "$1" ]; then PostProcessStatus=$1 ; fi - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: comparing '$NZBPP_CATEGORY' to '$CouchPotatoCategory' and '$SickBeardCategory'" ; fi - find "$NZBPP_DIRECTORY" -type f -size -200000k -iname \*sample\* -exec rm {} \; >/dev/null 2>&1 - if [ "$NZBPP_CATEGORY" = "$CouchPotatoCategory" ]; then - if [ "$CouchPotato" = "yes" -a -e "$NzbToCouchPotato" ]; then - script=$NzbToCouchPotato - # Call Couchpotato's postprocessing script - echo "[INFO] Post-Process: Running CouchPotato's postprocessing script" - if [ "$Debug" = "yes" ]; then - echo "[DETAIL] Post-Process: CouchPotato-Script-Path=$NzbToCouchPotato" - echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV1=$NZBPP_DIRECTORY" - echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV2=$NZBPP_NZBFILENAME" - echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV3=$PostProcessStatus" - fi - $PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" | while read line ; do if [ "$line" != "" ] ; then echo "[INFO] Post-Process: $line" ; fi ; done - else - if [ "$CouchPotato" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as it is disabled by user ('$CouchPotato')"; fi - if [ ! -e "$NzbToCouchPotato" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as the specified script ('$NzbToCouchPotato') does not exist"; fi - fi - fi - if [ "$NZBPP_CATEGORY" = "$SickBeardCategory" ]; then - if [ "$SickBeard" = "yes" -a -e "$NzbToSickBeard" ]; then - script=$NzbToSickBeard - # Call SickBeard's postprocessing script - echo "[INFO] Post-Process: Running SickBeard's postprocessing script" - if [ "$Debug" = "yes" ]; then - echo "[DETAIL] Post-Process: SickBeard-Script-Path=$NzbToSickBeard" - echo "[DETAIL] Post-Process: SickBeard-Script-ARGV1=$NZBPP_DIRECTORY" - echo "[DETAIL] Post-Process: SickBeard-Script-ARGV2=$NZBPP_NZBFILENAME" - echo "[DETAIL] Post-Process: SickBeard-Script-ARGV3=$PostProcessStatus" - fi - $PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" | while read line ; do if [ "$line" != "" ] ; then echo "[INFO] Post-Process: $line" ; fi ; done - else - if [ "$SickBeard" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as it is disabled by user ('$SickBeard')"; fi - if [ ! -e "$NzbToSickBeard" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as the specified script ('$NzbToSickBeard') does not exist"; fi - fi - fi - if [ "$NZBPP_CATEGORY" = "$CustomCategory" ]; then - if [ "$Custom" = "yes" -a -e "$CustomScript" ]; then - script=$CustomScript - # Call Custom postprocessing script - echo "[INFO] Post-Process: Running the Custom postprocessing script" - if [ "$Debug" = "yes" ]; then - echo "[DETAIL] Post-Process: Custom-Script-Path=$CustomScript" - echo "[DETAIL] Post-Process: Custom-Script-ARGV1=$NZBPP_DIRECTORY" - echo "[DETAIL] Post-Process: Custom-Script-ARGV2=$NZBPP_NZBFILENAME" - echo "[DETAIL] Post-Process: Custom-Script-ARGV3=$PostProcessStatus" - fi - $CustomCmd $CustomScript "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" | while read line ; do if [ "$line" != "" ] ; then echo "[INFO] Post-Process: $line" ; fi ; done - else - if [ "$Custom" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as it is disabled by user ('$Custom')"; fi - if [ ! -e "$CustomScript" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as the specified script ('$CustomScript') does not exist"; fi - fi - fi -} - -replaceVarBy() { - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'replaceVarBy'. Going to replace '${2}' in '${1}' by '${3}'" ; fi - - # If we're not using Bash use sed, as we need to support as much as systems possible, also those running sh/dash etc - if [ -n "${BASH_VERSION}" ]; then - REPLACEDRESULT="${1/${2}/${3}}" - else - REPLACEDRESULT=$(echo "${1}" | sed "s^${2}^${3}^g") - fi - - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: replace result: ${REPLACEDRESULT}" ; fi -} - -# Pass on postprocess exit codes to external scripts for handling failed downloads -do_exit() { - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'do_exit' with argument $1" ; fi - nzbStatus=0 - if [ "$1" -ne "$POSTPROCESS_SUCCESS" ]; then nzbStatus=1 ; fi - script=none - nzbToMedia $nzbStatus - echo "[DETAIL] after calling nzbToMedia" - replaceVarBy "${Email_Subject}" "" "${NZBPP_NZBFILENAME}" - replaceVarBy "${REPLACEDRESULT}" "" "${NZBPP_CATEGORY}" - replaceVarBy "${REPLACEDRESULT}" "