[Python Any reason for script not stopping?
Posted: March 5th, 2015, 7:39 am
Trying to learn some more Python. Does anyone see why this script is not exiting in SAB? It is running until i restart SAB manually. I did a equal script just with a lot of if, elif lines, that works.
Its a updating Plex script.
Its a updating Plex script.
Code: Select all
#!/usr/bin/env python
import sys
import os
import urllib
try:
(scriptname,directory,orgnzbname,jobname,reportnumber,category,group,postprocstatus,url) = sys.argv
except:
try:
# Category
c = sys.argv[5]
except:
print"No commandline paramenter found"
sys.exit(1)
#c = category
def update(x):
ip = "IP:PORT"
os.system("wget -q --delete-after http://%s/library/sections/%r/refresh > /dev/null" % (ip,x)) #for linux
#urllib.urlopen("http://%s/library/sections/%r/refresh" % (ip,x)) # for windows
sys.exit(0)
options = {
'movieshd': 6,
'comedy':5,
'ufc':9,
'documentary':7,
'barnefilm':10,
'skifilm':8,
}
holder = options[c]
update(holder)