How to run 2 post processing script

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.
Ashus
Newbie
Newbie
Posts: 8
Joined: June 18th, 2019, 8:21 am

How to run 2 post processing script

Post by Ashus »

I have SABnzbd version 2.3.8,

I've been using sickbeard mp4 automator with sabnzbd for post processing script to convert my media into mp4, then calls sonarr/radarr to pick it up.

I'd like to also use Deobfuscate[dot]py script. I was using instead the sorting tab, enabling TV and adding "%dn/%dn[dot]%ext" in the sort string as a workaround for obfuscated media. I dunno if this is the efficient way or not, but it feels deobfuscate[dot]py script is better in checking the actual file's real name rather than using sorting to rename based on original job name.

Only reason I wanna run 2 scripts is because with sorting rename, I still get the tag "-Obfuscated" at the end of the media, which would cause some problems with my other programs (like bazarr for subtitles trying to get the exact scene name).

Is there a way to achieve this?

I'm thinking of ditching the whole mp4 automator for the other script, I also heard mp4 automator can be run on sonarr's side (sab downloads, sonarr picks up and run the script from there) which would be awesome. But that's a question for sonarr I guess.

User avatar
jcfp
Release Testers
Release Testers
Posts: 929
Joined: February 7th, 2008, 12:45 pm

Re: How to run 2 post processing script

Post by jcfp »

You can run multiple scripts by having a single, very simple script call as many others as you want, passing along the command line arguments. If all scripts are shell, you could also source them. See viewtopic.php?f=9&t=15392&p=86847#p86852

Ashus
Newbie
Newbie
Posts: 8
Joined: June 18th, 2019, 8:21 am

Re: How to run 2 post processing script

Post by Ashus »

jcfp wrote:
June 19th, 2019, 3:27 am
You can run multiple scripts by having a single, very simple script call as many others as you want, passing along the command line arguments. If all scripts are shell, you could also source them. [delete because of "New users are not allowed to post links" for me]
Thanks for the reply!

I also read similar post to this, I forgot to mention that i'm using Windows 10 pro OS, don't even know how to use bash as its unix based.
I'm not too savvy when it comes to command lines. I actually thought I'd have both scripts put in one folder for SAB, and under categories tab, i'd choose the script for each category, then I realised life is never too easy like that ;D and didn't know how to choose 2 scripts together for each category.

How would I go about this on windows 10, How can I create a script to run 2 scripts? How can I have deobfuscate[dot]py run first, then mp4_automator?
(I would like the end result for sonarr to import the completed media with its original name of the media downloaded)

Puzzled
Newbie
Newbie
Posts: 47
Joined: September 2nd, 2017, 3:02 am

Re: How to run 2 post processing script

Post by Puzzled »

You probably don't have the full Python executable, only the DLL from SABnzbd, so I think you need to call them from another Python script. Unfortunately I don't know how to do that.

User avatar
safihre
Administrator
Administrator
Posts: 3644
Joined: April 30th, 2015, 7:35 am
Location: Switzerland
Contact:

Re: How to run 2 post processing script

Post by safihre »

Why would you want sonarr to not do all the fancy stuff it can do? It is amazing got exactly this, putting the nice name on the release. So you don't need any scripts etc.

Ashus
Newbie
Newbie
Posts: 8
Joined: June 18th, 2019, 8:21 am

Re: How to run 2 post processing script

Post by Ashus »

safihre wrote:
June 19th, 2019, 2:53 pm
Why would you want sonarr to not do all the fancy stuff it can do? It is amazing got exactly this, putting the nice name on the release. So you don't need any scripts etc.
What do you mean?

Here's a scenario of my setup. Sonarr sebds the job to sabnzbd to download.
Sab downloads it (regardless whether its obfuscafed or not).
Sab moves the completed media to the appropriate folder.
Mp4 automator script starts and does its magic.
After completion, Sonarr picks it up and moves it to my Plex media folder and renames it appropriately (i.e. Name of Show S01 E01 - Title)

This is all great and wonderful. To add a little spice into this. I have another program running from another talented people behind it to auto download subtitles everytime sonarr picks up the media, its called bazarr.

Bazarr would efficiently work if it knew the actual scene name of the media based on whaf sonarr imported.

So if the media was Obfuscafed, sonarr would import it as 124ed72drqr7.mkv and rename ut appropriately based on its job title.
Now bazarr would see the scene name as that, obfuscated, and would try other methods to try to find a suitable subtitle for it (based on fps, resolution etc..) that would result in a hit or miss)

Now the deobfuscafe script does exactly what I need by looking into par2 files to find the exact name of the media (so bazarr can do its magic finding subtitle name to the exact scene name).

So my problem is I have 2 scripts, but my priority is to have the deobfuscate script to do its work before sonarr picks it up. I don't mind if my mp4 automator script works after sonarr imports or on SAB before sonarr (i still couldnt figure out how to have mp4 automator script work on sonarr side, so thats why i was wondering how sab can work with 2 scripts)

SAB's sorting also does it, but the problem is that its rename is based on job title, not original media title.
So if the job title was amzn web dl - obfuscated, it would name it also with obfuscated which messes up with scene name scanning. Where as the original name from par2 file would name it without the added obfuscated tag, or so i've heard.

User avatar
safihre
Administrator
Administrator
Posts: 3644
Joined: April 30th, 2015, 7:35 am
Location: Switzerland
Contact:

Re: How to run 2 post processing script

Post by safihre »

Oke you can download Python 2 here: https://www.python.org/downloads/release/python-2716/
Then you can run multiple scripts, although it really depends on your local setup

Ashus
Newbie
Newbie
Posts: 8
Joined: June 18th, 2019, 8:21 am

Re: How to run 2 post processing script

Post by Ashus »

safihre wrote:
June 20th, 2019, 7:29 am
Oke you can download Python 2 here[download link]
Then you can run multiple scripts, although it really depends on your local setup
I've already got python 2.7 due to the pre-requisite of my other programs (mp4_automator and others)

however, I don't know how to go about this, i'm only as good as following the instructions on what to do :D

I never wrote my own script as I don't know how to do it. Could you provide a guide on how to do the script on windows 10?
Do I make a new folder and add my scripts into it, then put the path in my SAB scripts, then into categories I add the script to each category that calls the other scripts?

I may be over-complicating things as its way over my head for someone never wrote a script before

Puzzled
Newbie
Newbie
Posts: 47
Joined: September 2nd, 2017, 3:02 am

Re: How to run 2 post processing script

Post by Puzzled »

Try a bat file first, those are the simplest. Open Notepad and save these two lines as postscript.bat in the same directory as deobfuscate.py:
python deobfuscate.py %*
python mp4_automator.py %*

You may need to use the full path to both python and the two scripts.

Ashus
Newbie
Newbie
Posts: 8
Joined: June 18th, 2019, 8:21 am

Re: How to run 2 post processing script

Post by Ashus »

so my python path is C:\Python27\python[dot]exe

while my scripts are:
C:\Program Files\SABnzbd\scripts\Deobfuscate[dot]py
C:\sickbeard_mp4_automator\SABpostprocess[dot]py (which calls the other script mkvtomp4[dot]py within the same directory for the conversion)

the mp4 automator script is too complicated to just move the script to deobfuscate directory, as it has sub scripts into sonarr/radarr and SAB (3 scripts) which all call out to mkvtomp4 script to perform the conversion, i'm thinking of moving deobfuscate script into mp4 automator directory.

so with batch file, you mean I can write it as this way?
C:\Python27\python[dot]exe C:\Program Files\SABnzbd\scripts\Deobfuscate[dot]py %*
C:\Python27\python[dot]exe C:\sickbeard_mp4_automator\SABpostprocess[dot]py %*

and that will be created within mp4 automator directory? or can I put it in any directory seeing I already gave it a path to the scripts?
and after that, how would I configure SAB client?

Puzzled
Newbie
Newbie
Posts: 47
Joined: September 2nd, 2017, 3:02 am

Re: How to run 2 post processing script

Post by Puzzled »

You'll have to put quotes around C:\Program Files\SABnzbd\scripts\Deobfuscate[dot]py because of the space but otherwise I think it should work if you have configured the mp4_automator ini correctly. Put the bat file in C:\Program Files\SABnzbd\scripts\. Such things rarely work the first time, though...

Ashus
Newbie
Newbie
Posts: 8
Joined: June 18th, 2019, 8:21 am

Re: How to run 2 post processing script

Post by Ashus »

so with the bat in scripts folder of SAB, I would go into sab client config -> folders, and put the script folder here?
also with categories list i would call the bat script on both radarr and sonarr right?

User avatar
safihre
Administrator
Administrator
Posts: 3644
Joined: April 30th, 2015, 7:35 am
Location: Switzerland
Contact:

Re: How to run 2 post processing script

Post by safihre »

Yes! But the Bat file in the folder that you selected in Config > Folders.

Ashus
Newbie
Newbie
Posts: 8
Joined: June 18th, 2019, 8:21 am

Re: How to run 2 post processing script

Post by Ashus »

Thanks! Will give this a try!

Ashus
Newbie
Newbie
Posts: 8
Joined: June 18th, 2019, 8:21 am

Re: How to run 2 post processing script

Post by Ashus »

I tried the bat script, but I keep getting an error from SABnzbd:

**DELETED**

my bat file is written as this:

Code: Select all

C:\Python27\python.exe "C:\Program Files\SABnzbd\scripts\Deobfuscate.py %*"
C:\Python27\python.exe "C:\sickbeard_mp4_automator\SABpostprocess.py %*"
I feel like i'm missing something here, or something is written wrong.

EDIT: just to add that all my paths are correct.

EDIT2: ignore my ignorance ;D ! I had the quotation wrong

this is the correct way and it worked!

Code: Select all

C:\Python27\python.exe "C:\Program Files\SABnzbd\scripts\Deobfuscate.py" %*
C:\Python27\python.exe "C:\sickbeard_mp4_automator\SABpostprocess.py" %*
Thank you! Gonna see if it will work with tv shows.

But so far I'm happy with the result! Thanks guys!

Post Reply