Convert to new-style class by inheriting from object

This commit is contained in:
labrys 2016-05-31 03:38:54 -04:00 committed by Labrys
commit 0a1fe84306
5 changed files with 13 additions and 8 deletions

View file

@ -9,7 +9,8 @@ from core import logger
requests.packages.urllib3.disable_warnings() requests.packages.urllib3.disable_warnings()
class autoProcessComics:
class autoProcessComics(object):
def processEpisode(self, section, dirName, inputName=None, status=0, clientAgent='manual', inputCategory=None): def processEpisode(self, section, dirName, inputName=None, status=0, clientAgent='manual', inputCategory=None):
if int(status) != 0: if int(status) != 0:
logger.warning("FAILED DOWNLOAD DETECTED, nothing to process.",section) logger.warning("FAILED DOWNLOAD DETECTED, nothing to process.",section)

View file

@ -10,7 +10,8 @@ from core import logger
requests.packages.urllib3.disable_warnings() requests.packages.urllib3.disable_warnings()
class autoProcessGames:
class autoProcessGames(object):
def process(self, section, dirName, inputName=None, status=0, clientAgent='manual', inputCategory=None): def process(self, section, dirName, inputName=None, status=0, clientAgent='manual', inputCategory=None):
status = int(status) status = int(status)

View file

@ -12,7 +12,8 @@ from core.transcoder import transcoder
requests.packages.urllib3.disable_warnings() requests.packages.urllib3.disable_warnings()
class autoProcessMovie:
class autoProcessMovie(object):
def get_release(self, baseURL, imdbid=None, download_id=None, release_id=None): def get_release(self, baseURL, imdbid=None, download_id=None, release_id=None):
results = {} results = {}
params = {} params = {}
@ -46,7 +47,7 @@ class autoProcessMovie:
if 'error' in result: if 'error' in result:
logger.error(str(result['error'])) logger.error(str(result['error']))
else: else:
logger.error("no media found for id %s" % (params['id'])) logger.error("no media found for id %s" % (params['id']))
return results return results
# Gather release info and return it back, no need to narrow results # Gather release info and return it back, no need to narrow results
@ -210,7 +211,7 @@ class autoProcessMovie:
else: else:
logger.error("Transcoding failed for files in %s" % (dirName), section) logger.error("Transcoding failed for files in %s" % (dirName), section)
return [1, "%s: Failed to post-process - Transcoding failed" % (section) ] return [1, "%s: Failed to post-process - Transcoding failed" % (section) ]
for video in listMediaFiles(dirName, media=True, audio=False, meta=False, archives=False): for video in listMediaFiles(dirName, media=True, audio=False, meta=False, archives=False):
if not release and not ".cp(tt" in video and imdbid: if not release and not ".cp(tt" in video and imdbid:
videoName, videoExt = os.path.splitext(video) videoName, videoExt = os.path.splitext(video)
video2 = "%s.cp(%s)%s" % (videoName, imdbid, videoExt) video2 = "%s.cp(%s)%s" % (videoName, imdbid, videoExt)

View file

@ -11,7 +11,8 @@ from core import logger
requests.packages.urllib3.disable_warnings() requests.packages.urllib3.disable_warnings()
class autoProcessMusic:
class autoProcessMusic(object):
def get_status(self, url, apikey, dirName): def get_status(self, url, apikey, dirName):
logger.debug("Attempting to get current status for release:%s" % (os.path.basename(dirName))) logger.debug("Attempting to get current status for release:%s" % (os.path.basename(dirName)))
@ -121,7 +122,7 @@ class autoProcessMusic:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code)) ] return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code)) ]
elif r.text == "OK": elif r.text == "OK":
logger.postprocess("SUCCESS: Post-Processing started for %s in folder %s ..." % (inputName, dirName),section) logger.postprocess("SUCCESS: Post-Processing started for %s in folder %s ..." % (inputName, dirName),section)
else: else:
logger.error("FAILED: Post-Processing has NOT started for %s in folder %s. exiting!" % (inputName, dirName),section) logger.error("FAILED: Post-Processing has NOT started for %s in folder %s. exiting!" % (inputName, dirName),section)
return [1, "%s: Failed to post-process - Returned log from %s was not as expected." % (section, section) ] return [1, "%s: Failed to post-process - Returned log from %s was not as expected." % (section, section) ]

View file

@ -16,7 +16,8 @@ from core.transcoder import transcoder
requests.packages.urllib3.disable_warnings() requests.packages.urllib3.disable_warnings()
class autoProcessTV:
class autoProcessTV(object):
def command_complete(self, url, params, headers, section): def command_complete(self, url, params, headers, section):
try: try:
r = requests.get(url, params=params, headers=headers, stream=True, verify=False, timeout=(30, 60)) r = requests.get(url, params=params, headers=headers, stream=True, verify=False, timeout=(30, 60))