Hi
I'm not familiar with python, so how would a post-processing script look like if would like to get the nzo_id for the just downloaded item and save it for later use ?
grab nzo_id in post script
Re: grab nzo_id in post script
You could get it from the os.env variables, see the wiki for the right key
You do know a tiny bit of python?
You do know a tiny bit of python?
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
-
- Newbie
- Posts: 4
- Joined: October 26th, 2017, 7:20 am
Re: grab nzo_id in post script
Only some and it is giving me some troubble.
have this script as of now, but it is not working. I dont know how from python directly delete something from the history, so I'm building this url to do so via the REST api. The goal is to build and call a url like this:
have this script as of now, but it is not working. I dont know how from python directly delete something from the history, so I'm building this url to do so via the REST api. The goal is to build and call a url like this:
The url gets build correctly. If I let it print the url into the SABnzbs logs I can cut and paste into a curl command or webbrowser and it will delete the specified SAB_NZO_ID from the history. Modifiing the script to manually define the SAB_NZO_ID works as well - the troubble is that when SABnzbd calls the script it does not work. No errors - just nothing happens.
Code: Select all
import os
import sys
import urllib2
urlopen = urllib2.urlopen
nzoid = os.environ.get('SAB_NZO_ID', '')
apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
baseurl = 'http://10.0.0.10:8080/'
url = '%sapi?mode=history&name=delete&value=%s&apikey=%s' % (baseurl, nzoid, apikey)
#print url
r = urlopen(url)
sys.exit(0)
Re: grab nzo_id in post script
Aaah that's what you want.
You can't do that, because when the script is called it's not in a state that allows it to be removed.
If you want no history to be kept, you can use History Retention setting in Config Switches and set it to Number=0
You can't do that, because when the script is called it's not in a state that allows it to be removed.
If you want no history to be kept, you can use History Retention setting in Config Switches and set it to Number=0
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate