clinton-hall / GetScripts

A Collection of NZBGet Post-Process Scripts
GNU General Public License v2.0
100 stars 39 forks source link

Make SafeRename SABnzbd compatible? #5

Closed sanderjo closed 9 years ago

sanderjo commented 9 years ago

This is the SABnzbd postprocessing script I created based on your NZBget script: https://github.com/sanderjo/SAB-SafeRename

I think it would be technically possible to have just one script usable for NZBget and SABnzbd; something along the lines of:

import os, sys, re, shlex

def rename_script(dirname):
    # current function definition

if os.environ.has_key('NZBOP_SCRIPTDIR'):
    do_all_NZBget_environment_checks()
    rename_script(os.path.normpath(os.environ['NZBPP_DIRECTORY'])
    sys.exit(NZBGET_POSTPROCESS_SUCCESS)
else:
    # Assume a call from SABnzbd 
    do_SAB_stuff() # among which: (scriptname,directory,orgnzbname,jobname,reportnumber,category,group,postprocstatus,url) = sys.argv
    rename_script(directory)

If this is acceptable for NZBget style and you (Clinton Hall), it would create one source ... easier to maintain

clinton-hall commented 9 years ago

yeah, this is certainly possible

I do pretty much exactly what you describe above in my nzbToMedia scripts.

What happened here is that I started with sabToSickBeard (from SickBeard itself) and developed sabToCouchPotato... eventually I added HeadPhones and Gamez support etc... Then Ported it all over to work with NZBGet.

These scripts do the safe rename as part of their basic function, but then (since NZBGet can do multiple scripts, and since not everyone uses SickBeard and CouchPotato) I was asked to break these up into individual scripts.

All of these can rather easily be ported to make then work with SABnzbd and NZBGet.

clinton-hall commented 9 years ago

in theory this should work.

Thanks for the help on this script.