Can I get some help with a script to delete the word "OBFUSCATED" please?

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
ThunderNuts
Newbie
Newbie
Posts: 3
Joined: May 12th, 2020, 11:53 pm

Can I get some help with a script to delete the word "OBFUSCATED" please?

Post by ThunderNuts »

I've read throught the WIKI, and I see that it's possible to run a Pre-queue script to affect things like the name of the download before it enters the queue, but I admit it's a little beyond my grasp.

Would it be possible for someone to share a simple script with me that will remove the word "OBFUSCATED" from the title of the download? When sabnzbd kicks things back to Radarr, it mistakes the release group name as OBFUSCATED due to the way the upload is named, and it misnames the files during the Radarr rename. Apparently this is fixed in v3 of Radarr, but since it's not at a point in development yet where I am ready to upgrade to v3, I was hoping I could solve things this way by using a pre-queue script through sabnzbd.

For reference, I'm on Windows 10, using SABnzbd v 2.3.9


Thanks!
ThunderNuts
Newbie
Newbie
Posts: 3
Joined: May 12th, 2020, 11:53 pm

Re: Can I get some help with a script to delete the word "OBFUSCATED" please?

Post by ThunderNuts »

I've found this script for nzbget that seems to do what I want, but I'm not exactly positive on how to specifically adapt it to sabnzbd:

Code: Select all

#!/usr/bin/env python3
# 

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

# Clean NZB name.
#
# Removes the following suffixes from NZB name:
# NZBgeek / Obfuscated / BUYMORE / Scrambled.
#
# NOTE: This script requires Python to be installed on your system.

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

from __future__ import print_function
import os, re, sys

# Exit codes used by NZBGet
POSTPROCESS_SUCCESS=93
POSTPROCESS_ERROR=94
POSTPROCESS_SKIP=95

# 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)-4P\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-4Planet\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-AsRequested\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-AsRequested-xpost\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-BUYMORE\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-Chamele0n\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-GEROV\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-iNC0GNiTO\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-NZBGeek\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-Obfuscated\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-postbot\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-Rakuv\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-Scrambled\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-WhiteRev\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)-xpost\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)[eztv]\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)[TGx]\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)[TGx]-xpost\.nzb$', '.nzb', fwp)
fwp = re.sub('(?i)[ettv]\.nzb$', '.nzb', fwp)
if fwp:
  print('[NZB] NZBNAME=', fwp, sep='')

sys.exit(POSTPROCESS_SUCCESS)
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Can I get some help with a script to delete the word "OBFUSCATED" please?

Post by safihre »

Download Python 2:
https://www.python.org/downloads/release/python-2718/
Make sure to click "Add to PATH" during install.

I think this script should work:

Code: Select all

import sys
import re

try:
    (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename) = sys.argv
    downloadsize = int(downloadsize)
except:
    sys.exit(1)    # exit with 1 causes SABnzbd to ignore the output of this script

fwp = nzbname
fwp = re.sub('(?i)-4P$', '.nzb', fwp)
fwp = re.sub('(?i)-4Planet$', '.nzb', fwp)
fwp = re.sub('(?i)-AsRequested$', '.nzb', fwp)
fwp = re.sub('(?i)-AsRequested-xpost$', '.nzb', fwp)
fwp = re.sub('(?i)-BUYMORE$', '.nzb', fwp)
fwp = re.sub('(?i)-Chamele0n$', '.nzb', fwp)
fwp = re.sub('(?i)-GEROV$', '.nzb', fwp)
fwp = re.sub('(?i)-iNC0GNiTO$', '.nzb', fwp)
fwp = re.sub('(?i)-NZBGeek$', '.nzb', fwp)
fwp = re.sub('(?i)-Obfuscated$', '.nzb', fwp)
fwp = re.sub('(?i)-postbot$', '.nzb', fwp)
fwp = re.sub('(?i)-Rakuv$', '.nzb', fwp)
fwp = re.sub('(?i)-Scrambled$', '.nzb', fwp)
fwp = re.sub('(?i)-WhiteRev$', '.nzb', fwp)
fwp = re.sub('(?i)-xpost$', '.nzb', fwp)
fwp = re.sub('(?i)[eztv]$', '.nzb', fwp)
fwp = re.sub('(?i)[TGx]$', '.nzb', fwp)
fwp = re.sub('(?i)[TGx]-xpost$', '.nzb', fwp)
fwp = re.sub('(?i)[ettv]$', '.nzb', fwp)

print "1"    # Accept
print fwp
print
print
print
print 
print
# 0 means OK
sys.exit(0)
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
ThunderNuts
Newbie
Newbie
Posts: 3
Joined: May 12th, 2020, 11:53 pm

Re: Can I get some help with a script to delete the word "OBFUSCATED" please?

Post by ThunderNuts »

safihre wrote: May 14th, 2020, 1:27 pm Download Python 2:

Make sure to click "Add to PATH" during install.

I think this script should work:

Code: Select all

import sys
import re

try:
    (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename) = sys.argv
    downloadsize = int(downloadsize)
except:
    sys.exit(1)    # exit with 1 causes SABnzbd to ignore the output of this script

fwp = nzbname
fwp = re.sub('(?i)-4P$', '.nzb', fwp)
fwp = re.sub('(?i)-4Planet$', '.nzb', fwp)
fwp = re.sub('(?i)-AsRequested$', '.nzb', fwp)
fwp = re.sub('(?i)-AsRequested-xpost$', '.nzb', fwp)
fwp = re.sub('(?i)-BUYMORE$', '.nzb', fwp)
fwp = re.sub('(?i)-Chamele0n$', '.nzb', fwp)
fwp = re.sub('(?i)-GEROV$', '.nzb', fwp)
fwp = re.sub('(?i)-iNC0GNiTO$', '.nzb', fwp)
fwp = re.sub('(?i)-NZBGeek$', '.nzb', fwp)
fwp = re.sub('(?i)-Obfuscated$', '.nzb', fwp)
fwp = re.sub('(?i)-postbot$', '.nzb', fwp)
fwp = re.sub('(?i)-Rakuv$', '.nzb', fwp)
fwp = re.sub('(?i)-Scrambled$', '.nzb', fwp)
fwp = re.sub('(?i)-WhiteRev$', '.nzb', fwp)
fwp = re.sub('(?i)-xpost$', '.nzb', fwp)
fwp = re.sub('(?i)[eztv]$', '.nzb', fwp)
fwp = re.sub('(?i)[TGx]$', '.nzb', fwp)
fwp = re.sub('(?i)[TGx]-xpost$', '.nzb', fwp)
fwp = re.sub('(?i)[ettv]$', '.nzb', fwp)

print "1"    # Accept
print fwp
print
print
print
print 
print
# 0 means OK
sys.exit(0)
I already had Python installed from a previous project, so that made it super easy. Your script worked beautifully, thank you so much! ;D
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Can I get some help with a script to delete the word "OBFUSCATED" please?

Post by safihre »

Great!
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
fadern
Newbie
Newbie
Posts: 4
Joined: May 27th, 2020, 2:39 pm

Re: Can I get some help with a script to delete the word "OBFUSCATED" please?

Post by fadern »

Hi,

Im trying to run this script on my system but it wont work. The script runs as Pre-queue user script.

How do I post logs??? The site detects the logs as a link... :-(


Setup:
Synology DSM 6+
SABnzbs 2.3.9 [03c10dc]
Python 2.7.14
SickChill
post script nzbtomedia

this is my script.

Code: Select all

import sys
import re

try:
        (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename) = sys.argv
            downloadsize = int(downloadsize)
except:
        sys.exit(1)    # exit with 1 causes SABnzbd to ignore the output of this script

        fwp = nzbname
        fwp = re.sub('(?i)-4P$', '.nzb', fwp)
        fwp = re.sub('(?i)-4Planet$', '.nzb', fwp)
        fwp = re.sub('(?i)-AsRequested$', '.nzb', fwp)
        fwp = re.sub('(?i)-AsRequested-xpost$', '.nzb', fwp)
        fwp = re.sub('(?i)-BUYMORE$', '.nzb', fwp)
        fwp = re.sub('(?i)-Chamele0n$', '.nzb', fwp)
        fwp = re.sub('(?i)-GEROV$', '.nzb', fwp)
        fwp = re.sub('(?i)-iNC0GNiTO$', '.nzb', fwp)
        fwp = re.sub('(?i)-NZBGeek$', '.nzb', fwp)
        fwp = re.sub('(?i)-Obfuscated$', '.nzb', fwp)
        fwp = re.sub('(?i)-ObfuscatedPostBot$', '.nzb', fwp)
        fwp = re.sub('(?i)-postbot$', '.nzb', fwp)
        fwp = re.sub('(?i)-Rakuv$', '.nzb', fwp)
        fwp = re.sub('(?i)-Rakuvfinhel$', '.nzb', fwp)
        fwp = re.sub('(?i)-Rakuvfin$', '.nzb', fwp)
        fwp = re.sub('(?i)-RakuvDE$', '.nzb', fwp)
        fwp = re.sub('(?i)-Rakuv01$', '.nzb', fwp)
        fwp = re.sub('(?i)-Scrambled$', '.nzb', fwp)
        fwp = re.sub('(?i)-SirUppington$', '.nzb', fwp)
        fwp = re.sub('(?i)-WhiteRev$', '.nzb', fwp)
        fwp = re.sub('(?i)-xpost$', '.nzb', fwp)
        fwp = re.sub('(?i)[eztv]$', '.nzb', fwp)
        fwp = re.sub('(?i)[TGx]$', '.nzb', fwp)
        fwp = re.sub('(?i)[TGx]-xpost$', '.nzb', fwp)
        fwp = re.sub('(?i)[ettv]$', '.nzb', fwp)

        print "1"    # Accept
        print fwp
        print
        print
        print
        print 
        print
        # 0 means OK
        sys.exit(0)
fadern
Newbie
Newbie
Posts: 4
Joined: May 27th, 2020, 2:39 pm

Re: Can I get some help with a script to delete the word "OBFUSCATED" please?

Post by fadern »

2020-05-27 22:12:24,472::INFO::[newsunpack:2345] Pre-queue script returns 1 and output=
File "/usr/local/sabnzbd/var/scripts/nzbToMedia/removestringspy", line 6
downloadsize = int(downloadsize)
^
IndentationError: unexpected indent
fadern
Newbie
Newbie
Posts: 4
Joined: May 27th, 2020, 2:39 pm

Re: Can I get some help with a script to delete the word "OBFUSCATED" please?

Post by fadern »

i did find the extra space that was causing the first error but now the script wont recognize some strings..

2020-05-27 23:04:34,401::INFO::[__init__:624] Backing up /volume1/Files/Downloads/complete/incomplete/Joey..S01E15..1080p..AMZN..WEB-DL..DD2..0..H..264-Pawel2006-xpost/__ADMIN__/Joey..S01E15..1080p..AMZN.. WEB-DL..DD2..0..H..264-Pawel2006-xpost..nzb.. gz
2020-05-27 23:04:34,664::INFO::[newsunpack:2335] Running pre-queue script ['/volume1/@appstore/sabnzbd/bin/nice', '-n15', 'python', u'/usr/local/sabnzbd/var/scripts/nzbToMedia/removestringspy', u'Joey..S01E15..1080p..AMZN..WEB-DL..DD2..0..H..264-Pawel2006-xpost', '', '', '', u'-100', u'2352000324', u'alt..binaries..wtfnzb..kilo', u'Joey', u'1', u'15', u'1080p AMZN WEB-DL DD2 0 H 264-Pawel2006-xpost']
2020-05-27 23:04:34,773::INFO::[newsunpack:2345] Pre-queue script returns 0 and output=

2020-05-27 23:04:34,773::INFO::[newsunpack:2359] Pre-Q accepts Joey..S01E15..1080p..AMZN..WEB-DL..DD2..0..H..264-Pawel2006-xpost
2020-05-27 23:04:34,776::INFO::[nzbqueue:260] Saving queue
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Can I get some help with a script to delete the word "OBFUSCATED" please?

Post by safihre »

You did not copy my script. Please copy my script exactlt, because you now have some extra spaces in there that break things.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
fadern
Newbie
Newbie
Posts: 4
Joined: May 27th, 2020, 2:39 pm

Re: Can I get some help with a script to delete the word "OBFUSCATED" please?

Post by fadern »

safihre wrote: May 28th, 2020, 12:55 am You did not copy my script. Please copy my script exactlt, because you now have some extra spaces in there that break things.
Ok, thank you. ive removed the extra spaces and it works most of the time. I need to ad some more strings but then it breaks and removes only a letter...

Code: Select all

import sys
import re

try:
    (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename) = sys.argv
    downloadsize = int(downloadsize)
except:
    sys.exit(1)    # exit with 1 causes SABnzbd to ignore the output of this script

fwp = nzbname
fwp = re.sub('(?i)-4P$', '.nzb', fwp)
fwp = re.sub('(?i)-4Planet$', '.nzb', fwp)
fwp = re.sub('(?i)-AsRequested$', '.nzb', fwp)
fwp = re.sub('(?i)-AsRequested-Obfuscated$', '.nzb', fwp)
fwp = re.sub('(?i)-AsRequested-xpost$', '.nzb', fwp)
fwp = re.sub('(?i)-BUYMORE$', '.nzb', fwp)
fwp = re.sub('(?i)-Chamele0n$', '.nzb', fwp)
fwp = re.sub('(?i)[ettv]$', '.nzb', fwp)
fwp = re.sub('(?i)[ettv]-Obfuscated$', '.nzb', fwp)
fwp = re.sub('(?i)[eztv]$', '.nzb', fwp)
fwp = re.sub('(?i)-GEROV$', '.nzb', fwp)
fwp = re.sub('(?i)-iNC0GNiTO$', '.nzb', fwp)
fwp = re.sub('(?i)-NZBGeek$', '.nzb', fwp)
fwp = re.sub('(?i)-Obfuscated$', '.nzb', fwp)
fwp = re.sub('(?i)-ObfuscatedPostBot$', '.nzb', fwp)
fwp = re.sub('(?i)-postbot$', '.nzb', fwp)
fwp = re.sub('(?i)-Rakuv$', '.nzb', fwp)
fwp = re.sub('(?i)-Rakuvfinhel$', '.nzb', fwp)
fwp = re.sub('(?i)-Rakuvfin$', '.nzb', fwp)
fwp = re.sub('(?i)-RakuvDE$', '.nzb', fwp)
fwp = re.sub('(?i)-Rakuv01$', '.nzb', fwp)
fwp = re.sub('(?i)-Scrambled$', '.nzb', fwp)
fwp = re.sub('(?i)-SirUppington$', '.nzb', fwp)
fwp = re.sub('(?i)[TGx]$', '.nzb', fwp)
fwp = re.sub('(?i)[TGx]-xpost$', '.nzb', fwp)
fwp = re.sub('(?i)-WhiteRev$', '.nzb', fwp)
fwp = re.sub('(?i)-xpost$', '.nzb', fwp)

print "1"    # Accept
print fwp
print
print
print
print 
print
# 0 means OK
sys.exit(0)

Code: Select all

2020-05-28 10:40:41,765::INFO::[__init__:624] Backing up /volume1/Files/Downloads/complete/incomplete/Guy.Martins.Great.Escape.2019.720p.HDTV.x264-LiNKLE-xpost/__ADMIN__/Guy.Martins.Great.Escape.2019.720p.HDTV.x264-LiNKLE-xpost.nzb.gz
2020-05-28 10:40:41,877::INFO::[newsunpack:2335] Running pre-queue script ['/volume1/@appstore/sabnzbd/bin/nice', '-n15', 'python', u'/usr/local/sabnzbd/var/scripts/nzbToMedia/removestrings.py', u'Guy.Martins.Great.Escape.2019.720p.HDTV.x264-LiNKLE-xpost', '', '', '', '', u'1895340159', u'alt.binaries.newznzb.foxtrot alt.binaries.newznzb.echo alt.binaries.newznzb.kilo alt.binaries.newznzb.novemeber alt.binaries.newznzb.india alt.binaries.newznzb.charlie alt.binaries.newznzb.mike alt.binaries.newznzb.alpha alt.binaries.newznzb.golf alt.binaries.newznzb.bravo alt.binaries.newznzb.delta alt.binaries.newznzb.lima alt.binaries.newznzb.hotel alt.binaries.newznzb.juliet', '', '', '', '']
2020-05-28 10:40:42,537::INFO::[downloader:781] Thread [email protected]: timed out
2020-05-28 10:40:42,581::INFO::[newsunpack:2345] Pre-queue script returns 0 and output=
1
Guy.Martins.Great.Escape.2019.720p.HDTV.x264-LiNKLE-xpos.nzb
Post Reply