Page 1 of 1

Script Request - Replace Chars in Folder Names

Posted: March 14th, 2018, 5:25 pm
by exxo
Hello together,

i am fetching many NZB in community's that aren't aware that Plex is unable to get Meta Data when the root folder of a movie contains underscores or blanks.
For reasons that are beyond my knowledge, they remove the dots in topic titles and the folder names of scene releases :-\

SABNZB supports replacing blanks with underscores, but there is no option available in settings that replaces blanks with dots.
Hence I need a script that replaces these chars with dots.

The script needs to be POSIX complaint because SABNZBD runs on my Synology DS216j and unfortunately DSM 6.x supports only the ash shell.

Any help is highly appreciated.

Thank you very much in advance.

Re: Script Request - Replace Chars in Folder Names

Posted: March 15th, 2018, 3:08 am
by safihre
Just use a Python script as Pre-Queue script:

Code: Select all

import sys

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

# Replace whatever you want:
nzbname = nzbname.replace(' ', '.')

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