Replace/remove substring in title
Posted: 10 Feb 2015, 09:20
One of my indexers adds an annoying tag to some posts, would it be possible to add an RSS-option that would allow me to automatically remove that?
Code: Select all
echo "[NZB] NZBNAME=my download";
Code: Select all
fwp = os.environ['NZBNP_NZBNAME']
f = re.sub('(?i)-NZBgeek\.nzb$', '.nzb', fwp)
if f:
print('[NZB] NZBNAME=', f, sep='')
Code: Select all
#!c:\Python34\python.exe
#
##############################################################################
### NZBGET SCAN SCRIPT ###
# Removes NZBGeek suffixes from NZB name.
### NZBGET SCAN SCRIPT ###
##############################################################################
import os, re, sys
# Code from EMail.py @ http://nzbget.sourceforge.net
# Exit codes used by NZBGet
POSTPROCESS_SKIP=95
POSTPROCESS_ERROR=94
POSTPROCESS_SUCCESS=93
# Code from EMail.py @ http://nzbget.sourceforge.net
# Check if the script is called from nzbget 13.0 or later
if not 'NZBOP_SCRIPTDIR' in os.environ:
print('*** NZBGet post-processing script ***')
print('This script is supposed to be called from nzbget (13.0 or later).')
sys.exit(POSTPROCESS_ERROR)
if not 'NZBNP_NZBNAME' in os.environ:
print('[WARN] Filename not found in environment')
sys.exit(POSTPROCESS_ERROR)
fwp = os.environ['NZBNP_NZBNAME']
fwp = re.sub('(?i)-NZBgeek\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-Chamele0n\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-Obfuscated\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-BUYMORE\.nzb$', '.nzb', fwp)
if fwp:
print('[NZB] NZBNAME=', fwp, sep='')
sys.exit(POSTPROCESS_SUCCESS)
The script is where it should be and it has chmod a+x rightsERROR Mon Mar 28 2016 16:28:54 Scan: Could not start /media/temp/scripts/Scan.py: No such file or directory
INFO Mon Mar 28 2016 16:28:54 Executing scan-script Scan.py for Billions.S01E10.720p.HDTV.x264-AVS-Obfuscated.nzb
Code: Select all
#!/usr/bin/env python
#!/usr/bin/env python3
Code: Select all
#!/usr/bin/env python
from __future__ import print_function
##########################################
### NZBGET SCAN SCRIPT ###
# Removes garbage suffixes from NZB names.
#
# NOTE: This script requires Python to be installed on your system.
### NZBGET SCAN SCRIPT ###
##########################################
import os
import re
import sys
# Code from EMail.py @ http://nzbget.sourceforge.net
# Exit codes used by NZBGet
POSTPROCESS_SKIP=95
POSTPROCESS_ERROR=94
POSTPROCESS_SUCCESS=93
# Code from EMail.py @ http://nzbget.sourceforge.net
# Check if the script is called from nzbget 13.0 or later
if 'NZBOP_SCRIPTDIR' not in os.environ:
print('*** NZBGet post-processing script ***')
print('This script is supposed to be called from nzbget (13.0 or later).')
sys.exit(POSTPROCESS_ERROR)
if 'NZBNP_NZBNAME' not in os.environ:
print('[WARN] Filename not found in environment')
sys.exit(POSTPROCESS_ERROR)
fwp = re.sub('(?i)[._-](obfuscated|scrambled|nzbgeek|chamele0n|buymore)\.nzb$', '.nzb', os.environ['NZBNP_NZBNAME'], re.IGNORECASE)
if fwp:
print('[NZB] NZBNAME=%s' % fwp)
sys.exit(POSTPROCESS_SUCCESS)
sys.exit(POSTPROCESS_SKIP)