mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-06 13:11:11 -07:00
Code cleanup
This commit is contained in:
parent
92d00ed62a
commit
cdadf045a8
15 changed files with 106 additions and 92 deletions
|
@ -332,7 +332,7 @@ def main(args):
|
||||||
logger.postprocess("#########################################################")
|
logger.postprocess("#########################################################")
|
||||||
|
|
||||||
# debug command line options
|
# debug command line options
|
||||||
logger.debug("Options passed into TorrentToMedia: " + str(args))
|
logger.debug("Options passed into TorrentToMedia: %s", args)
|
||||||
|
|
||||||
# Post-Processing Result
|
# Post-Processing Result
|
||||||
result = 0
|
result = 0
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||||
ssl = 0
|
ssl = 0
|
||||||
web_root =
|
web_root =
|
||||||
delay = 65
|
|
||||||
method = renamer
|
method = renamer
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
wait_for = 2
|
wait_for = 2
|
||||||
#### # Set to path where completed downloads go on the remote CouchPotatoServer
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
remote_path =
|
remote_path =
|
||||||
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
[SickBeard]
|
[SickBeard]
|
||||||
|
@ -40,13 +40,15 @@
|
||||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||||
web_root =
|
web_root =
|
||||||
ssl = 0
|
ssl = 0
|
||||||
delay = 0
|
|
||||||
watch_dir =
|
|
||||||
fork = auto
|
fork = auto
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
nzbExtractionBy = Downloader
|
nzbExtractionBy = Downloader
|
||||||
Torrent_NoLink = 0
|
Torrent_NoLink = 0
|
||||||
process_method =
|
process_method =
|
||||||
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
|
remote_path =
|
||||||
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
|
watch_dir =
|
||||||
|
|
||||||
[NzbDrone]
|
[NzbDrone]
|
||||||
#### autoProcessing for TV Series
|
#### autoProcessing for TV Series
|
||||||
|
@ -61,11 +63,13 @@
|
||||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||||
web_root =
|
web_root =
|
||||||
ssl = 0
|
ssl = 0
|
||||||
delay = 0
|
|
||||||
watch_dir =
|
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
nzbExtractionBy = Downloader
|
nzbExtractionBy = Downloader
|
||||||
Torrent_NoLink = 0
|
Torrent_NoLink = 0
|
||||||
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
|
remote_path =
|
||||||
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
|
watch_dir =
|
||||||
|
|
||||||
[HeadPhones]
|
[HeadPhones]
|
||||||
#### autoProcessing for Music
|
#### autoProcessing for Music
|
||||||
|
@ -78,7 +82,10 @@
|
||||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||||
ssl = 0
|
ssl = 0
|
||||||
web_root =
|
web_root =
|
||||||
delay = 65
|
wait_for = 2
|
||||||
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
|
remote_path =
|
||||||
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
[Mylar]
|
[Mylar]
|
||||||
|
@ -93,6 +100,9 @@
|
||||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||||
web_root=
|
web_root=
|
||||||
ssl=0
|
ssl=0
|
||||||
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
|
remote_path =
|
||||||
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
[Gamez]
|
[Gamez]
|
||||||
|
@ -106,6 +116,9 @@
|
||||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||||
ssl = 0
|
ssl = 0
|
||||||
web_root =
|
web_root =
|
||||||
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
|
remote_path =
|
||||||
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
[Torrent]
|
[Torrent]
|
||||||
|
|
|
@ -47,14 +47,9 @@
|
||||||
|
|
||||||
# CouchPotato watch directory.
|
# CouchPotato watch directory.
|
||||||
#
|
#
|
||||||
# set this if CouchPotato and nzbGet are on different systems.
|
# set this to where your CouchPotato completed downloads are.
|
||||||
#cpswatch_dir=
|
#cpswatch_dir=
|
||||||
|
|
||||||
# CouchPotato Postprocess Delay.
|
|
||||||
#
|
|
||||||
# must be at least 60 seconds.
|
|
||||||
#cpsdelay=65
|
|
||||||
|
|
||||||
# CouchPotato Postprocess Method (renamer, manage).
|
# CouchPotato Postprocess Method (renamer, manage).
|
||||||
#
|
#
|
||||||
# use "renamer" for CPS renamer (default) or "manage" to call a manage update.
|
# use "renamer" for CPS renamer (default) or "manage" to call a manage update.
|
||||||
|
|
|
@ -46,6 +46,11 @@
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#gzweb_root=
|
#gzweb_root=
|
||||||
|
|
||||||
|
# Gamez watch directory.
|
||||||
|
#
|
||||||
|
# set this to where your Gamez completed downloads are.
|
||||||
|
#gzwatch_dir=
|
||||||
|
|
||||||
## WakeOnLan
|
## WakeOnLan
|
||||||
|
|
||||||
# use WOL (0, 1).
|
# use WOL (0, 1).
|
||||||
|
|
|
@ -45,10 +45,15 @@
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#hpweb_root=
|
#hpweb_root=
|
||||||
|
|
||||||
# HeadPhones Postprocess Delay.
|
# HeadPhones watch directory.
|
||||||
#
|
#
|
||||||
# set as required to ensure correct processing.
|
# set this to where your HeadPhones completed downloads are.
|
||||||
#hpdelay=65
|
#hpwatch_dir=
|
||||||
|
|
||||||
|
# HeadPhones wait_for
|
||||||
|
#
|
||||||
|
# Set the number of minutes to wait after initiating HeadPhones post-processing to check if the album status has changed.
|
||||||
|
#hpwait_for=2
|
||||||
|
|
||||||
## WakeOnLan
|
## WakeOnLan
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,6 @@
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#cpsweb_root=
|
#cpsweb_root=
|
||||||
|
|
||||||
# CouchPotato Postprocess Delay.
|
|
||||||
#
|
|
||||||
# must be at least 60 seconds.
|
|
||||||
#cpsdelay=65
|
|
||||||
|
|
||||||
# CouchPotato Postprocess Method (renamer, manage).
|
# CouchPotato Postprocess Method (renamer, manage).
|
||||||
#
|
#
|
||||||
# use "renamer" for CPS renamer (default) or "manage" to call a manage update.
|
# use "renamer" for CPS renamer (default) or "manage" to call a manage update.
|
||||||
|
@ -99,11 +94,6 @@
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#sbweb_root=
|
#sbweb_root=
|
||||||
|
|
||||||
# SickBeard delay
|
|
||||||
#
|
|
||||||
# Set the number of seconds to wait before calling post-process in SickBeard.
|
|
||||||
#sbdelay=0
|
|
||||||
|
|
||||||
# SickBeard watch directory.
|
# SickBeard watch directory.
|
||||||
#
|
#
|
||||||
# set this if SickBeard and nzbGet are on different systems.
|
# set this if SickBeard and nzbGet are on different systems.
|
||||||
|
@ -176,11 +166,6 @@
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#hpweb_root=
|
#hpweb_root=
|
||||||
|
|
||||||
# HeadPhones Postprocess Delay.
|
|
||||||
#
|
|
||||||
# set as required to ensure correct processing.
|
|
||||||
#hpdelay=65
|
|
||||||
|
|
||||||
## Mylar
|
## Mylar
|
||||||
|
|
||||||
# Mylar script category.
|
# Mylar script category.
|
||||||
|
@ -338,7 +323,7 @@ def main(args, section=None):
|
||||||
logger.postprocess("#########################################################")
|
logger.postprocess("#########################################################")
|
||||||
|
|
||||||
# debug command line options
|
# debug command line options
|
||||||
logger.debug("Options passed into nzbToMedia: " + str(args))
|
logger.debug("Options passed into nzbToMedia: %s", args)
|
||||||
|
|
||||||
# Post-Processing Result
|
# Post-Processing Result
|
||||||
result = 0
|
result = 0
|
||||||
|
|
|
@ -49,6 +49,11 @@
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#myweb_root=
|
#myweb_root=
|
||||||
|
|
||||||
|
# Mylar watch directory.
|
||||||
|
#
|
||||||
|
# set this to where your Mylar completed downloads are.
|
||||||
|
#mywatch_dir=
|
||||||
|
|
||||||
## WakeOnLan
|
## WakeOnLan
|
||||||
|
|
||||||
# use WOL (0, 1).
|
# use WOL (0, 1).
|
||||||
|
|
|
@ -48,14 +48,9 @@
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#ndweb_root=
|
#ndweb_root=
|
||||||
|
|
||||||
# NzbDrone delay
|
|
||||||
#
|
|
||||||
# Set the number of seconds to wait before calling post-process in NzbDrone.
|
|
||||||
#nddelay=0
|
|
||||||
|
|
||||||
# NzbDrone watch directory.
|
# NzbDrone watch directory.
|
||||||
#
|
#
|
||||||
# set this if NzbDrone and nzbGet are on different systems.
|
# set this to where your NzbDrone completed downloads are.
|
||||||
#ndwatch_dir=
|
#ndwatch_dir=
|
||||||
|
|
||||||
## Extensions
|
## Extensions
|
||||||
|
|
|
@ -53,14 +53,9 @@
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#sbweb_root=
|
#sbweb_root=
|
||||||
|
|
||||||
# SickBeard delay
|
|
||||||
#
|
|
||||||
# Set the number of seconds to wait before calling post-process in SickBeard.
|
|
||||||
#sbdelay=0
|
|
||||||
|
|
||||||
# SickBeard watch directory.
|
# SickBeard watch directory.
|
||||||
#
|
#
|
||||||
# set this if SickBeard and nzbGet are on different systems.
|
# set this to where your SickBeard completed downloads are.
|
||||||
#sbwatch_dir=
|
#sbwatch_dir=
|
||||||
|
|
||||||
# SickBeard fork.
|
# SickBeard fork.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import urllib
|
import os
|
||||||
import time
|
import time
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
from lib import requests
|
from lib import requests
|
||||||
|
@ -38,17 +38,18 @@ class autoProcessComics:
|
||||||
web_root = ""
|
web_root = ""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
watch_dir = nzbtomedia.CFG[section][inputCategory]["watch_dir"]
|
remote_path = nzbtomedia.CFG[section][inputCategory]["remote_path"]
|
||||||
except:
|
except:
|
||||||
watch_dir = ""
|
remote_path = None
|
||||||
params = {}
|
|
||||||
|
|
||||||
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
||||||
|
|
||||||
if dirName == "Manual Run" and watch_dir != "":
|
params = {}
|
||||||
dirName = watch_dir
|
|
||||||
|
|
||||||
params['nzb_folder'] = dirName
|
params['nzb_folder'] = dirName
|
||||||
|
if remote_path:
|
||||||
|
dirName_new = os.path.join(remote_path, os.path.basename(dirName)).replace("\\", "/")
|
||||||
|
params['nzb_folder'] = dirName_new
|
||||||
|
|
||||||
if nzbName != None:
|
if nzbName != None:
|
||||||
params['nzb_name'] = nzbName
|
params['nzb_name'] = nzbName
|
||||||
|
|
||||||
|
@ -57,12 +58,12 @@ class autoProcessComics:
|
||||||
else:
|
else:
|
||||||
protocol = "http://"
|
protocol = "http://"
|
||||||
|
|
||||||
url = protocol + host + ":" + port + web_root + "/post_process?" + urllib.urlencode(params)
|
url = protocol + host + ":" + port + web_root + "/post_process"
|
||||||
|
|
||||||
logger.debug("Opening URL: %s", url)
|
logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.get(url, auth=(username, password), stream=True)
|
r = requests.get(url, params=params, auth=(username, password), stream=True)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
logger.error("Unable to open URL")
|
logger.error("Unable to open URL")
|
||||||
return 1 # failure
|
return 1 # failure
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import json
|
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
from lib import requests
|
from lib import requests
|
||||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii
|
from nzbtomedia.nzbToMediaUtil import convert_to_ascii
|
||||||
|
@ -44,29 +43,34 @@ class autoProcessGames:
|
||||||
|
|
||||||
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
||||||
|
|
||||||
baseURL = protocol + host + ":" + port + web_root + "/api?api_key=" + apikey + "&mode="
|
baseURL = protocol + host + ":" + port + web_root + "/api"
|
||||||
|
|
||||||
fields = nzbName.split("-")
|
fields = nzbName.split("-")
|
||||||
|
|
||||||
gamezID = fields[0].replace("[","").replace("]","").replace(" ","")
|
gamezID = fields[0].replace("[","").replace("]","").replace(" ","")
|
||||||
|
|
||||||
downloadStatus = 'Wanted'
|
downloadStatus = 'Wanted'
|
||||||
if status == 0:
|
if status == 0:
|
||||||
downloadStatus = 'Downloaded'
|
downloadStatus = 'Downloaded'
|
||||||
|
|
||||||
url = baseURL + "UPDATEREQUESTEDSTATUS&db_id=" + gamezID + "&status=" + downloadStatus
|
params = {}
|
||||||
|
params['api_key'] = apikey
|
||||||
|
params['mode'] = 'UPDATEREQUESTEDSTATUS'
|
||||||
|
params['db_id'] = gamezID
|
||||||
|
params['status'] = downloadStatus
|
||||||
|
|
||||||
|
url = baseURL
|
||||||
|
|
||||||
logger.debug("Opening URL: %s", url)
|
logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.get(url, stream=True)
|
r = requests.get(url, params=params)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
logger.error("Unable to open URL")
|
logger.error("Unable to open URL")
|
||||||
return 1 # failure
|
return 1 # failure
|
||||||
|
|
||||||
result = {}
|
result = r.json()
|
||||||
for line in r.iter_lines():
|
logger.postprocess("%s", result)
|
||||||
if line:
|
|
||||||
logger.postprocess("%s", line)
|
|
||||||
result.update(json.load(line))
|
|
||||||
|
|
||||||
if result['success']:
|
if result['success']:
|
||||||
logger.postprocess("Status for %s has been set to %s in Gamez", gamezID, downloadStatus)
|
logger.postprocess("Status for %s has been set to %s in Gamez", gamezID, downloadStatus)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import urllib
|
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
from lib import requests
|
from lib import requests
|
||||||
from nzbtomedia.Transcoder import Transcoder
|
from nzbtomedia.Transcoder import Transcoder
|
||||||
|
@ -154,6 +153,9 @@ class autoProcessMovie:
|
||||||
logger.error("Could not find any releases marked as WANTED on CouchPotato to compare changes against %s, skipping ...", nzbName)
|
logger.error("Could not find any releases marked as WANTED on CouchPotato to compare changes against %s, skipping ...", nzbName)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
release_id = releases.keys()[0]
|
||||||
|
media_id = releases[release_id]['media_id']
|
||||||
|
|
||||||
process_all_exceptions(nzbName.lower(), dirName)
|
process_all_exceptions(nzbName.lower(), dirName)
|
||||||
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
||||||
|
|
||||||
|
@ -171,14 +173,16 @@ class autoProcessMovie:
|
||||||
command = "/renamer.scan"
|
command = "/renamer.scan"
|
||||||
|
|
||||||
params = {}
|
params = {}
|
||||||
|
if len(releases) == 1:
|
||||||
|
download_id =
|
||||||
if download_id:
|
if download_id:
|
||||||
params['downloader'] = clientAgent
|
params['downloader'] = clientAgent
|
||||||
params['download_id'] = download_id
|
params['download_id'] = download_id
|
||||||
|
|
||||||
params['media_folder'] = urllib.quote(dirName)
|
params['media_folder'] = dirName
|
||||||
if remote_path:
|
if remote_path:
|
||||||
dirName_new = os.path.join(remote_path, os.path.basename(dirName)).replace("\\", "/")
|
dirName_new = os.path.join(remote_path, os.path.basename(dirName)).replace("\\", "/")
|
||||||
params['media_folder'] = urllib.quote(dirName_new)
|
params['media_folder'] = dirName_new
|
||||||
|
|
||||||
url = baseURL + command
|
url = baseURL + command
|
||||||
|
|
||||||
|
@ -211,9 +215,6 @@ class autoProcessMovie:
|
||||||
logger.warning("Please manually ignore this release and refresh the wanted movie from CouchPotato, Exiting ...")
|
logger.warning("Please manually ignore this release and refresh the wanted movie from CouchPotato, Exiting ...")
|
||||||
return 1 # failure
|
return 1 # failure
|
||||||
|
|
||||||
release_id = releases.keys()[0]
|
|
||||||
media_id = releases[release_id]['media_id']
|
|
||||||
|
|
||||||
logger.postprocess("Ignoring current failed release %s ...", nzbName)
|
logger.postprocess("Ignoring current failed release %s ...", nzbName)
|
||||||
|
|
||||||
url = baseURL + "/release.ignore"
|
url = baseURL + "/release.ignore"
|
||||||
|
@ -251,7 +252,7 @@ class autoProcessMovie:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
# we will now check to see if CPS has finished renaming before returning to TorrentToMedia and unpausing.
|
# we will now check to see if CPS has finished renaming before returning to TorrentToMedia and unpausing.
|
||||||
timeout = time.time() + 60 * int(wait_for)
|
timeout = time.time() + 60 * wait_for
|
||||||
while (time.time() < timeout): # only wait 2 (default) minutes, then return.
|
while (time.time() < timeout): # only wait 2 (default) minutes, then return.
|
||||||
releases_current = self.get_releases(baseURL, download_id, dirName, nzbName)
|
releases_current = self.get_releases(baseURL, download_id, dirName, nzbName)
|
||||||
releasesDiff = self.releases_diff(releases, releases_current)
|
releasesDiff = self.releases_diff(releases, releases_current)
|
||||||
|
@ -261,7 +262,7 @@ class autoProcessMovie:
|
||||||
return 0 # success
|
return 0 # success
|
||||||
|
|
||||||
# pause and let CouchPotatoServer catch its breath
|
# pause and let CouchPotatoServer catch its breath
|
||||||
time.sleep(10 * int(wait_for))
|
time.sleep(10 * wait_for)
|
||||||
|
|
||||||
# The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resule seeding now.
|
# The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resule seeding now.
|
||||||
logger.warning("The movie does not appear to have changed status after %s minutes. Please check CouchPotato Logs", wait_for)
|
logger.warning("The movie does not appear to have changed status after %s minutes. Please check CouchPotato Logs", wait_for)
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import datetime
|
|
||||||
import urllib
|
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
from lib import requests
|
from lib import requests
|
||||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii
|
from nzbtomedia.nzbToMediaUtil import convert_to_ascii
|
||||||
|
@ -53,7 +51,7 @@ class autoProcessMusic:
|
||||||
host = nzbtomedia.CFG[section][inputCategory]["host"]
|
host = nzbtomedia.CFG[section][inputCategory]["host"]
|
||||||
port = nzbtomedia.CFG[section][inputCategory]["port"]
|
port = nzbtomedia.CFG[section][inputCategory]["port"]
|
||||||
apikey = nzbtomedia.CFG[section][inputCategory]["apikey"]
|
apikey = nzbtomedia.CFG[section][inputCategory]["apikey"]
|
||||||
delay = float(nzbtomedia.CFG[section][inputCategory]["delay"])
|
wait_for = int(nzbtomedia.CFG[section][inputCategory]["wait_for"])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ssl = int(nzbtomedia.CFG[section][inputCategory]["ssl"])
|
ssl = int(nzbtomedia.CFG[section][inputCategory]["ssl"])
|
||||||
|
@ -64,6 +62,11 @@ class autoProcessMusic:
|
||||||
except:
|
except:
|
||||||
web_root = ""
|
web_root = ""
|
||||||
|
|
||||||
|
try:
|
||||||
|
remote_path = nzbtomedia.CFG[section][inputCategory]["remote_path"]
|
||||||
|
except:
|
||||||
|
remote_path = None
|
||||||
|
|
||||||
if ssl:
|
if ssl:
|
||||||
protocol = "https://"
|
protocol = "https://"
|
||||||
else:
|
else:
|
||||||
|
@ -78,7 +81,11 @@ class autoProcessMusic:
|
||||||
params = {}
|
params = {}
|
||||||
params['apikey'] = apikey
|
params['apikey'] = apikey
|
||||||
params['cmd'] = "forceProcess"
|
params['cmd'] = "forceProcess"
|
||||||
|
|
||||||
params['dir'] = os.path.dirname(dirName)
|
params['dir'] = os.path.dirname(dirName)
|
||||||
|
if remote_path:
|
||||||
|
dirName_new = os.path.join(remote_path, os.path.basename(os.path.dirname(dirName))).replace("\\", "/")
|
||||||
|
params['dir'] = dirName_new
|
||||||
|
|
||||||
url = baseURL
|
url = baseURL
|
||||||
|
|
||||||
|
@ -112,14 +119,14 @@ class autoProcessMusic:
|
||||||
return 0 # Success (as far as this script is concerned)
|
return 0 # Success (as far as this script is concerned)
|
||||||
|
|
||||||
# we will now wait 1 minutes for this album to be processed before returning to TorrentToMedia and unpausing.
|
# we will now wait 1 minutes for this album to be processed before returning to TorrentToMedia and unpausing.
|
||||||
timeout = time.time() + 60 * 2
|
timeout = time.time() + 60 * wait_for
|
||||||
while (time.time() < timeout): # only wait 2 (default) minutes, then return.
|
while (time.time() < timeout): # only wait 2 (default) minutes, then return.
|
||||||
current_status = self.get_status(url, apikey, dirName)
|
current_status = self.get_status(url, apikey, dirName)
|
||||||
if current_status is not None and current_status != release_status: # Something has changed. CPS must have processed this movie.
|
if current_status is not None and current_status != release_status: # Something has changed. CPS must have processed this movie.
|
||||||
logger.postprocess("SUCCESS: This release is now marked as status [%s] in HeadPhones",current_status)
|
logger.postprocess("SUCCESS: This release is now marked as status [%s] in HeadPhones",current_status)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
time.sleep(10 * 2)
|
time.sleep(10 * wait_for)
|
||||||
|
|
||||||
# The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resule seeding now.
|
# The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resule seeding now.
|
||||||
logger.warning("The music album does not appear to have changed status after %s minutes. Please check HeadPhones Logs",2)
|
logger.warning("The music album does not appear to have changed status after %s minutes. Please check HeadPhones Logs",2)
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
import copy
|
import copy
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import urllib
|
|
||||||
import time
|
|
||||||
import sys
|
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
from lib import requests
|
from lib import requests
|
||||||
from nzbtomedia.Transcoder import Transcoder
|
from nzbtomedia.Transcoder import Transcoder
|
||||||
|
@ -75,6 +71,10 @@ class autoProcessTV:
|
||||||
Torrent_NoLink = int(nzbtomedia.CFG[section][inputCategory]["Torrent_NoLink"])
|
Torrent_NoLink = int(nzbtomedia.CFG[section][inputCategory]["Torrent_NoLink"])
|
||||||
except:
|
except:
|
||||||
Torrent_NoLink = 0
|
Torrent_NoLink = 0
|
||||||
|
try:
|
||||||
|
remote_path = nzbtomedia.CFG[section][inputCategory]["remote_path"]
|
||||||
|
except:
|
||||||
|
remote_path = None
|
||||||
|
|
||||||
if not os.path.isdir(dirName) and os.path.isfile(dirName): # If the input directory is a file, assume single file download and split dir/name.
|
if not os.path.isdir(dirName) and os.path.isfile(dirName): # If the input directory is a file, assume single file download and split dir/name.
|
||||||
dirName = os.path.split(os.path.normpath(dirName))[0]
|
dirName = os.path.split(os.path.normpath(dirName))[0]
|
||||||
|
@ -124,6 +124,9 @@ class autoProcessTV:
|
||||||
|
|
||||||
if param in ["dirName", "dir"]:
|
if param in ["dirName", "dir"]:
|
||||||
fork_params[param] = dirName
|
fork_params[param] = dirName
|
||||||
|
if remote_path:
|
||||||
|
dirName_new = os.path.join(remote_path, os.path.basename(dirName)).replace("\\", "/")
|
||||||
|
fork_params[param] = dirName_new
|
||||||
|
|
||||||
if param == "process_method":
|
if param == "process_method":
|
||||||
if fork in nzbtomedia.SICKBEARD_TORRENT and Torrent_NoLink == 1 and not clientAgent in ['nzbget','sabnzbd']: #use default SickBeard settings here.
|
if fork in nzbtomedia.SICKBEARD_TORRENT and Torrent_NoLink == 1 and not clientAgent in ['nzbget','sabnzbd']: #use default SickBeard settings here.
|
||||||
|
|
|
@ -211,8 +211,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "CouchPotato"
|
section = "CouchPotato"
|
||||||
envCatKey = 'NZBPO_CPSCATEGORY'
|
envCatKey = 'NZBPO_CPSCATEGORY'
|
||||||
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'DELAY', 'METHOD', 'DELETE_FAILED', 'REMOTECPS', 'WAIT_FOR', 'TIMEPERGIB']
|
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'METHOD', 'DELETE_FAILED', 'REMOTECPS', 'WAIT_FOR', 'WATCH_DIR']
|
||||||
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'delay', 'method', 'delete_failed', 'remoteCPS', 'wait_for', 'TimePerGiB']
|
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'method', 'delete_failed', 'remoteCPS', 'wait_for', 'watch_dir']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_CPS' + envKeys[index]
|
key = 'NZBPO_CPS' + envKeys[index]
|
||||||
|
@ -226,8 +226,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "SickBeard"
|
section = "SickBeard"
|
||||||
envCatKey = 'NZBPO_SBCATEGORY'
|
envCatKey = 'NZBPO_SBCATEGORY'
|
||||||
envKeys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'DELAY', 'TIMEPERGIB', 'TORRENT_NOLINK', 'NZBEXTRACTIONBY']
|
envKeys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'TORRENT_NOLINK', 'NZBEXTRACTIONBY']
|
||||||
cfgKeys = ['enabled', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'delay', 'TimePerGiB', 'Torrent_NoLink', 'nzbExtractionBy']
|
cfgKeys = ['enabled', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'Torrent_NoLink', 'nzbExtractionBy']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_SB' + envKeys[index]
|
key = 'NZBPO_SB' + envKeys[index]
|
||||||
|
@ -241,8 +241,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "HeadPhones"
|
section = "HeadPhones"
|
||||||
envCatKey = 'NZBPO_HPCATEGORY'
|
envCatKey = 'NZBPO_HPCATEGORY'
|
||||||
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'DELAY', 'TIMEPERGIB']
|
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'WAIT_FOR', 'WATCH_DIR']
|
||||||
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'delay', 'TimePerGiB']
|
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'wait_for', 'watch_dir']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_HP' + envKeys[index]
|
key = 'NZBPO_HP' + envKeys[index]
|
||||||
|
@ -256,8 +256,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "Mylar"
|
section = "Mylar"
|
||||||
envCatKey = 'NZBPO_MYCATEGORY'
|
envCatKey = 'NZBPO_MYCATEGORY'
|
||||||
envKeys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT']
|
envKeys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR']
|
||||||
cfgKeys = ['enabled', 'host', 'port', 'username', 'password', 'ssl', 'web_root']
|
cfgKeys = ['enabled', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_MY' + envKeys[index]
|
key = 'NZBPO_MY' + envKeys[index]
|
||||||
|
@ -271,8 +271,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "Gamez"
|
section = "Gamez"
|
||||||
envCatKey = 'NZBPO_GZCATEGORY'
|
envCatKey = 'NZBPO_GZCATEGORY'
|
||||||
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT']
|
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'WATCH_DIR']
|
||||||
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root']
|
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'watch_dir']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_GZ' + envKeys[index]
|
key = 'NZBPO_GZ' + envKeys[index]
|
||||||
|
@ -286,8 +286,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "NzbDrone"
|
section = "NzbDrone"
|
||||||
envCatKey = 'NZBPO_NDCATEGORY'
|
envCatKey = 'NZBPO_NDCATEGORY'
|
||||||
envKeys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'DELAY', 'TIMEPERGIB', 'TORRENT_NOLINK', 'NZBEXTRACTIONBY']
|
envKeys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'TORRENT_NOLINK', 'NZBEXTRACTIONBY']
|
||||||
cfgKeys = ['enabled', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'delay', 'TimePerGiB', 'Torrent_NoLink', 'nzbExtractionBy']
|
cfgKeys = ['enabled', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'Torrent_NoLink', 'nzbExtractionBy']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_ND' + envKeys[index]
|
key = 'NZBPO_ND' + envKeys[index]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue