Script Request - Replace Chars in Folder Names

Come up with a useful post-processing script? Share it here!
Post Reply
exxo
Newbie
Newbie
Posts: 1
Joined: March 14th, 2018, 4:58 pm

Script Request - Replace Chars in Folder Names

Post 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.
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Script Request - Replace Chars in Folder Names

Post 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)
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
Post Reply