diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 70bbcf95..79f6de76 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -31,17 +31,18 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp try: encoded, input_directory1 = char_replace(input_directory) encoded, input_name1 = char_replace(input_name) - except: + except Exception: pass control_value_dict = {"input_directory": text_type(input_directory1)} - new_value_dict = {"input_name": text_type(input_name1), - "input_hash": text_type(input_hash), - "input_id": text_type(input_id), - "client_agent": text_type(client_agent), - "status": 0, - "last_update": datetime.date.today().toordinal() - } + new_value_dict = { + "input_name": text_type(input_name1), + "input_hash": text_type(input_hash), + "input_id": text_type(input_id), + "client_agent": text_type(client_agent), + "status": 0, + "last_update": datetime.date.today().toordinal(), + } my_db.upsert("downloads", new_value_dict, control_value_dict) logger.debug("Received Directory: {0} | Name: {1} | Category: {2}".format(input_directory, input_name, input_category)) @@ -195,7 +196,7 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp try: core.copy_link(inputFile, target_file, core.USELINK) core.remove_read_only(target_file) - except: + except Exception: logger.error("Failed to link: {0} to {1}".format(inputFile, target_file)) input_name, output_destination = convert_to_ascii(input_name, output_destination) @@ -305,7 +306,7 @@ def main(args): try: input_directory, input_name, input_category, input_hash, input_id = core.parse_args(client_agent, args) - except: + except Exception: logger.error("There was a problem loading variables") return -1 diff --git a/core/__init__.py b/core/__init__.py index cfc75199..b5fd8ee8 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -77,9 +77,9 @@ FORKS[FORK_FAILED_TORRENT] = {"dir": None, "failed": None, "process_method": Non FORKS[FORK_SICKRAGE] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None} FORKS[FORK_SICKCHILL] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None, "force_next": None} FORKS[FORK_SICKBEARD_API] = {"path": None, "failed": None, "process_method": None, "force_replace": None, "return_data": None, "type": None, "delete": None, "force_next": None} -FORKS[FORK_MEDUSA] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None, "ignore_subs":None} +FORKS[FORK_MEDUSA] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None, "ignore_subs": None} FORKS[FORK_SICKGEAR] = {"dir": None, "failed": None, "process_method": None, "force": None} -ALL_FORKS = {k:None for k in set(list(itertools.chain.from_iterable([FORKS[x].keys() for x in FORKS.keys()])))} +ALL_FORKS = {k: None for k in set(list(itertools.chain.from_iterable([FORKS[x].keys() for x in FORKS.keys()])))} # NZBGet Exit Codes NZBGET_POSTPROCESS_PARCHECK = 92 @@ -281,7 +281,7 @@ def initialize(section=None): # pylint: disable=E1101 # On non-unicode builds this will raise an AttributeError, if encoding type is not valid it throws a LookupError sys.setdefaultencoding(SYS_ENCODING) - except: + except Exception: print('Sorry, you MUST add the nzbToMedia folder to the PYTHONPATH environment variable' '\nor find another way to force Python to use {codec} for string encoding.'.format (codec=SYS_ENCODING)) @@ -345,7 +345,7 @@ def initialize(section=None): # restart nzbToMedia try: del MYAPP - except: + except Exception: pass restart() else: @@ -361,7 +361,7 @@ def initialize(section=None): NZB_CLIENTAGENT = CFG["Nzb"]["clientAgent"] # sabnzbd SABNZBDHOST = CFG["Nzb"]["sabnzbd_host"] - SABNZBDPORT = int(CFG["Nzb"]["sabnzbd_port"] or 8080) # defaults to accomodate NzbGet + SABNZBDPORT = int(CFG["Nzb"]["sabnzbd_port"] or 8080) # defaults to accomodate NzbGet SABNZBDAPIKEY = CFG["Nzb"]["sabnzbd_apikey"] NZB_DEFAULTDIR = CFG["Nzb"]["default_downloadDirectory"] GROUPS = CFG["Custom"]["remove_group"] @@ -398,7 +398,7 @@ def initialize(section=None): DELUGEUSR = CFG["Torrent"]["DelugeUSR"] # mysecretusr DELUGEPWD = CFG["Torrent"]["DelugePWD"] # mysecretpwr - QBITTORRENTHOST = CFG["Torrent"]["qBittorrenHost"] # localhost + QBITTORRENTHOST = CFG["Torrent"]["qBittorrenHost"] # localhost QBITTORRENTPORT = int(CFG["Torrent"]["qBittorrentPort"]) # 8080 QBITTORRENTUSR = CFG["Torrent"]["qBittorrentUSR"] # mysecretusr QBITTORRENTPWD = CFG["Torrent"]["qBittorrentPWD"] # mysecretpwr @@ -426,27 +426,27 @@ def initialize(section=None): try: subprocess.Popen(["nice"], stdout=devnull, stderr=devnull).communicate() NICENESS.extend(['nice', '-n{0}'.format(int(CFG["Posix"]["niceness"]))]) - except: + except Exception: pass try: subprocess.Popen(["ionice"], stdout=devnull, stderr=devnull).communicate() try: NICENESS.extend(['ionice', '-c{0}'.format(int(CFG["Posix"]["ionice_class"]))]) - except: + except Exception: pass try: if 'ionice' in NICENESS: NICENESS.extend(['-n{0}'.format(int(CFG["Posix"]["ionice_classdata"]))]) else: NICENESS.extend(['ionice', '-n{0}'.format(int(CFG["Posix"]["ionice_classdata"]))]) - except: + except Exception: pass - except: + except Exception: pass devnull.close() - COMPRESSEDCONTAINER = [re.compile('.r\d{2}$', re.I), - re.compile('.part\d+.rar$', re.I), + COMPRESSEDCONTAINER = [re.compile(r'.r\d{2}$', re.I), + re.compile(r'.part\d+.rar$', re.I), re.compile('.rar$', re.I)] COMPRESSEDCONTAINER += [re.compile('{0}$'.format(ext), re.I) for ext in CFG["Extensions"]["compressedExtensions"]] MEDIACONTAINER = CFG["Extensions"]["mediaExtensions"] @@ -480,7 +480,7 @@ def initialize(section=None): GENERALOPTS.append('+genpts') try: OUTPUTQUALITYPERCENT = int(CFG["Transcoder"]["outputQualityPercent"]) - except: + except Exception: pass OUTPUTVIDEOPATH = CFG["Transcoder"]["outputVideoPath"] PROCESSOUTPUT = int(CFG["Transcoder"]["processOutput"]) @@ -505,19 +505,19 @@ def initialize(section=None): VPRESET = CFG["Transcoder"]["outputVideoPreset"].strip() try: VFRAMERATE = float(CFG["Transcoder"]["outputVideoFramerate"].strip()) - except: + except Exception: pass try: VCRF = int(CFG["Transcoder"]["outputVideoCRF"].strip()) - except: + except Exception: pass try: VLEVEL = CFG["Transcoder"]["outputVideoLevel"].strip() - except: + except Exception: pass try: VBITRATE = int((CFG["Transcoder"]["outputVideoBitrate"].strip()).replace('k', '000')) - except: + except Exception: pass VRESOLUTION = CFG["Transcoder"]["outputVideoResolution"] ACODEC = CFG["Transcoder"]["outputAudioCodec"].strip() @@ -528,11 +528,11 @@ def initialize(section=None): ACODEC_ALLOW = [] try: ACHANNELS = int(CFG["Transcoder"]["outputAudioChannels"].strip()) - except: + except Exception: pass try: ABITRATE = int((CFG["Transcoder"]["outputAudioBitrate"].strip()).replace('k', '000')) - except: + except Exception: pass ACODEC2 = CFG["Transcoder"]["outputAudioTrack2Codec"].strip() ACODEC2_ALLOW = CFG["Transcoder"]["AudioCodec2Allow"].strip() @@ -542,11 +542,11 @@ def initialize(section=None): ACODEC2_ALLOW = [] try: ACHANNELS2 = int(CFG["Transcoder"]["outputAudioTrack2Channels"].strip()) - except: + except Exception: pass try: ABITRATE2 = int((CFG["Transcoder"]["outputAudioTrack2Bitrate"].strip()).replace('k', '000')) - except: + except Exception: pass ACODEC3 = CFG["Transcoder"]["outputAudioOtherCodec"].strip() ACODEC3_ALLOW = CFG["Transcoder"]["AudioOtherCodecAllow"].strip() @@ -556,11 +556,11 @@ def initialize(section=None): ACODEC3_ALLOW = [] try: ACHANNELS3 = int(CFG["Transcoder"]["outputAudioOtherChannels"].strip()) - except: + except Exception: pass try: ABITRATE3 = int((CFG["Transcoder"]["outputAudioOtherBitrate"].strip()).replace('k', '000')) - except: + except Exception: pass SCODEC = CFG["Transcoder"]["outputSubtitleCodec"].strip() BURN = int(CFG["Transcoder"]["burnInSubtitle"].strip()) @@ -574,118 +574,118 @@ def initialize(section=None): 'libfaac': ['libfaac', 'aac', 'faac'] } transcode_defaults = { - 'iPad':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':None, 'ACHANNELS':2, - 'ACODEC2':'ac3','ACODEC2_ALLOW':['ac3'],'ABITRATE2':None, 'ACHANNELS2':6, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'iPad-1080p':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':'1920:1080','VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':None, 'ACHANNELS':2, - 'ACODEC2':'ac3','ACODEC2_ALLOW':['ac3'],'ABITRATE2':None, 'ACHANNELS2':6, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'iPad-720p':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':'1280:720','VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':None, 'ACHANNELS':2, - 'ACODEC2':'ac3','ACODEC2_ALLOW':['ac3'],'ABITRATE2':None, 'ACHANNELS2':6, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'Apple-TV':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':'1280:720','VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'ac3','ACODEC_ALLOW':['ac3'],'ABITRATE':None, 'ACHANNELS':6, - 'ACODEC2':'aac','ACODEC2_ALLOW':['libfaac'],'ABITRATE2':None, 'ACHANNELS2':2, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'iPod':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':'1280:720','VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':128000, 'ACHANNELS':2, - 'ACODEC2':None,'ACODEC2_ALLOW':[],'ABITRATE2':None, 'ACHANNELS2':None, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'iPhone':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':'460:320','VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':128000, 'ACHANNELS':2, - 'ACODEC2':None,'ACODEC2_ALLOW':[],'ABITRATE2':None, 'ACHANNELS2':None, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'PS3':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'ac3','ACODEC_ALLOW':['ac3'],'ABITRATE':None, 'ACHANNELS':6, - 'ACODEC2':'aac','ACODEC2_ALLOW':['libfaac'],'ABITRATE2':None, 'ACHANNELS2':2, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'xbox':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'ac3','ACODEC_ALLOW':['ac3'],'ABITRATE':None, 'ACHANNELS':6, - 'ACODEC2':None,'ACODEC2_ALLOW':[],'ABITRATE2':None, 'ACHANNELS2':None, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'Roku-480p':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':128000, 'ACHANNELS':2, - 'ACODEC2':'ac3','ACODEC2_ALLOW':['ac3'],'ABITRATE2':None, 'ACHANNELS2':6, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'Roku-720p':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':128000, 'ACHANNELS':2, - 'ACODEC2':'ac3','ACODEC2_ALLOW':['ac3'],'ABITRATE2':None, 'ACHANNELS2':6, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'Roku-1080p':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':160000, 'ACHANNELS':2, - 'ACODEC2':'ac3','ACODEC2_ALLOW':['ac3'],'ABITRATE2':None, 'ACHANNELS2':6, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - }, - 'mkv':{ - 'VEXTENSION':'.mkv','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':None,'VLEVEL':None, - 'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4', 'mpeg2video'], - 'ACODEC':'dts','ACODEC_ALLOW':['libfaac', 'dts', 'ac3', 'mp2', 'mp3'],'ABITRATE':None, 'ACHANNELS':8, - 'ACODEC2':None,'ACODEC2_ALLOW':[],'ABITRATE2':None, 'ACHANNELS2':None, - 'ACODEC3':'ac3','ACODEC3_ALLOW':['libfaac', 'dts', 'ac3', 'mp2', 'mp3'],'ABITRATE3':None, 'ACHANNELS3':8, - 'SCODEC':'mov_text' - }, - 'mp4-scene-release':{ - 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,'VCRF':19,'VLEVEL':'3.1', - 'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4', 'mpeg2video'], - 'ACODEC':'dts','ACODEC_ALLOW':['libfaac', 'dts', 'ac3', 'mp2', 'mp3'],'ABITRATE':None, 'ACHANNELS':8, - 'ACODEC2':None,'ACODEC2_ALLOW':[],'ABITRATE2':None, 'ACHANNELS2':None, - 'ACODEC3':'ac3','ACODEC3_ALLOW':['libfaac', 'dts', 'ac3', 'mp2', 'mp3'],'ABITRATE3':None, 'ACHANNELS3':8, - 'SCODEC':'mov_text' - }, - 'MKV-SD':{ - 'VEXTENSION':'.mkv','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':'1200k','VCRF':None,'VLEVEL':None, - 'VRESOLUTION':'720:-1','VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], - 'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':128000, 'ACHANNELS':2, - 'ACODEC2':'ac3','ACODEC2_ALLOW':['ac3'],'ABITRATE2':None, 'ACHANNELS2':6, - 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, - 'SCODEC':'mov_text' - } + 'iPad': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': None, 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'aac', 'ACODEC_ALLOW': ['libfaac'], 'ABITRATE': None, 'ACHANNELS': 2, + 'ACODEC2': 'ac3', 'ACODEC2_ALLOW': ['ac3'], 'ABITRATE2': None, 'ACHANNELS2': 6, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'iPad-1080p': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': '1920:1080', 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'aac', 'ACODEC_ALLOW': ['libfaac'], 'ABITRATE': None, 'ACHANNELS': 2, + 'ACODEC2': 'ac3', 'ACODEC2_ALLOW': ['ac3'], 'ABITRATE2': None, 'ACHANNELS2': 6, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'iPad-720p': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': '1280:720', 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'aac', 'ACODEC_ALLOW': ['libfaac'], 'ABITRATE': None, 'ACHANNELS': 2, + 'ACODEC2': 'ac3', 'ACODEC2_ALLOW': ['ac3'], 'ABITRATE2': None, 'ACHANNELS2': 6, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'Apple-TV': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': '1280:720', 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'ac3', 'ACODEC_ALLOW': ['ac3'], 'ABITRATE': None, 'ACHANNELS': 6, + 'ACODEC2': 'aac', 'ACODEC2_ALLOW': ['libfaac'], 'ABITRATE2': None, 'ACHANNELS2': 2, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'iPod': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': '1280:720', 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'aac', 'ACODEC_ALLOW': ['libfaac'], 'ABITRATE': 128000, 'ACHANNELS': 2, + 'ACODEC2': None, 'ACODEC2_ALLOW': [], 'ABITRATE2': None, 'ACHANNELS2': None, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'iPhone': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': '460:320', 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'aac', 'ACODEC_ALLOW': ['libfaac'], 'ABITRATE': 128000, 'ACHANNELS': 2, + 'ACODEC2': None, 'ACODEC2_ALLOW': [], 'ABITRATE2': None, 'ACHANNELS2': None, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'PS3': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': None, 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'ac3', 'ACODEC_ALLOW': ['ac3'], 'ABITRATE': None, 'ACHANNELS': 6, + 'ACODEC2': 'aac', 'ACODEC2_ALLOW': ['libfaac'], 'ABITRATE2': None, 'ACHANNELS2': 2, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'xbox': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': None, 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'ac3', 'ACODEC_ALLOW': ['ac3'], 'ABITRATE': None, 'ACHANNELS': 6, + 'ACODEC2': None, 'ACODEC2_ALLOW': [], 'ABITRATE2': None, 'ACHANNELS2': None, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'Roku-480p': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': None, 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'aac', 'ACODEC_ALLOW': ['libfaac'], 'ABITRATE': 128000, 'ACHANNELS': 2, + 'ACODEC2': 'ac3', 'ACODEC2_ALLOW': ['ac3'], 'ABITRATE2': None, 'ACHANNELS2': 6, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'Roku-720p': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': None, 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'aac', 'ACODEC_ALLOW': ['libfaac'], 'ABITRATE': 128000, 'ACHANNELS': 2, + 'ACODEC2': 'ac3', 'ACODEC2_ALLOW': ['ac3'], 'ABITRATE2': None, 'ACHANNELS2': 6, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'Roku-1080p': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': None, 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'aac', 'ACODEC_ALLOW': ['libfaac'], 'ABITRATE': 160000, 'ACHANNELS': 2, + 'ACODEC2': 'ac3', 'ACODEC2_ALLOW': ['ac3'], 'ABITRATE2': None, 'ACHANNELS2': 6, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + }, + 'mkv': { + 'VEXTENSION': '.mkv', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': None, 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4', 'mpeg2video'], + 'ACODEC': 'dts', 'ACODEC_ALLOW': ['libfaac', 'dts', 'ac3', 'mp2', 'mp3'], 'ABITRATE': None, 'ACHANNELS': 8, + 'ACODEC2': None, 'ACODEC2_ALLOW': [], 'ABITRATE2': None, 'ACHANNELS2': None, + 'ACODEC3': 'ac3', 'ACODEC3_ALLOW': ['libfaac', 'dts', 'ac3', 'mp2', 'mp3'], 'ABITRATE3': None, 'ACHANNELS3': 8, + 'SCODEC': 'mov_text' + }, + 'mp4-scene-release': { + 'VEXTENSION': '.mp4', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': None, 'VCRF': 19, 'VLEVEL': '3.1', + 'VRESOLUTION': None, 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4', 'mpeg2video'], + 'ACODEC': 'dts', 'ACODEC_ALLOW': ['libfaac', 'dts', 'ac3', 'mp2', 'mp3'], 'ABITRATE': None, 'ACHANNELS': 8, + 'ACODEC2': None, 'ACODEC2_ALLOW': [], 'ABITRATE2': None, 'ACHANNELS2': None, + 'ACODEC3': 'ac3', 'ACODEC3_ALLOW': ['libfaac', 'dts', 'ac3', 'mp2', 'mp3'], 'ABITRATE3': None, 'ACHANNELS3': 8, + 'SCODEC': 'mov_text' + }, + 'MKV-SD': { + 'VEXTENSION': '.mkv', 'VCODEC': 'libx264', 'VPRESET': None, 'VFRAMERATE': None, 'VBITRATE': '1200k', 'VCRF': None, 'VLEVEL': None, + 'VRESOLUTION': '720: -1', 'VCODEC_ALLOW': ['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], + 'ACODEC': 'aac', 'ACODEC_ALLOW': ['libfaac'], 'ABITRATE': 128000, 'ACHANNELS': 2, + 'ACODEC2': 'ac3', 'ACODEC2_ALLOW': ['ac3'], 'ABITRATE2': None, 'ACHANNELS2': 6, + 'ACODEC3': None, 'ACODEC3_ALLOW': [], 'ABITRATE3': None, 'ACHANNELS3': None, + 'SCODEC': 'mov_text' + } } if DEFAULTS and DEFAULTS in transcode_defaults: VEXTENSION = transcode_defaults[DEFAULTS]['VEXTENSION'] @@ -765,17 +765,17 @@ def initialize(section=None): else: try: SEVENZIP = subprocess.Popen(['which', '7z'], stdout=subprocess.PIPE).communicate()[0].strip() - except: + except Exception: pass if not SEVENZIP: try: SEVENZIP = subprocess.Popen(['which', '7zr'], stdout=subprocess.PIPE).communicate()[0].strip() - except: + except Exception: pass if not SEVENZIP: try: SEVENZIP = subprocess.Popen(['which', '7za'], stdout=subprocess.PIPE).communicate()[0].strip() - except: + except Exception: pass if not SEVENZIP: SEVENZIP = None @@ -783,7 +783,7 @@ def initialize(section=None): "Failed to locate 7zip. Transcoding of disk images and extraction of .7z files will not be possible!") try: PAR2CMD = subprocess.Popen(['which', 'par2'], stdout=subprocess.PIPE).communicate()[0].strip() - except: + except Exception: pass if not PAR2CMD: PAR2CMD = None @@ -798,12 +798,12 @@ def initialize(section=None): else: try: FFMPEG = subprocess.Popen(['which', 'ffmpeg'], stdout=subprocess.PIPE).communicate()[0].strip() - except: + except Exception: pass if not FFMPEG: try: FFMPEG = subprocess.Popen(['which', 'avconv'], stdout=subprocess.PIPE).communicate()[0].strip() - except: + except Exception: pass if not FFMPEG: FFMPEG = None @@ -819,12 +819,12 @@ def initialize(section=None): else: try: FFPROBE = subprocess.Popen(['which', 'ffprobe'], stdout=subprocess.PIPE).communicate()[0].strip() - except: + except Exception: pass if not FFPROBE: try: FFPROBE = subprocess.Popen(['which', 'avprobe'], stdout=subprocess.PIPE).communicate()[0].strip() - except: + except Exception: pass if not FFPROBE: FFPROBE = None diff --git a/core/auto_process/games.py b/core/auto_process/games.py index 19ecc63a..28183095 100644 --- a/core/auto_process/games.py +++ b/core/auto_process/games.py @@ -60,7 +60,7 @@ class Game(object): logger.postprocess("moving files to library: {0}".format(library), section) try: shutil.move(dir_name, os.path.join(library, input_name)) - except: + except Exception: logger.error("Unable to move {0} to {1}".format(dir_name, os.path.join(library, input_name)), section) return [1, "{0}: Failed to post-process - Unable to move files".format(section)] else: diff --git a/core/auto_process/movies.py b/core/auto_process/movies.py index dde29946..00f15e84 100644 --- a/core/auto_process/movies.py +++ b/core/auto_process/movies.py @@ -26,9 +26,9 @@ class Movie(object): method = cfg["method"] else: method = None - #added importMode for Radarr config + # added importMode for Radarr config if section == "Radarr": - import_mode = cfg.get("importMode","Move") + import_mode = cfg.get("importMode", "Move") else: import_mode = None delete_failed = int(cfg["delete_failed"]) @@ -75,7 +75,7 @@ class Movie(object): download_id = release[release_id]['download_info']['id'] downloader = release[release_id]['download_info']['downloader'] release_status_old = release[release_id]['status'] - except: + except Exception: pass if not os.path.isdir(dir_name) and os.path.isfile(dir_name): # If the input directory is a file, assume single file download and split dir/name. @@ -147,7 +147,7 @@ class Movie(object): logger.debug('Renaming: {0} to: {1}'.format(video, video2)) os.rename(video, video2) - if not apikey: #If only using Transcoder functions, exit here. + if not apikey: # If only using Transcoder functions, exit here. logger.info('No CouchPotato or Radarr apikey entered. Processing completed.') return [0, "{0}: Successfully post-processed {1}".format(section, input_name)] @@ -170,7 +170,7 @@ class Movie(object): logger.postprocess("Starting {0} scan for {1}".format(method, input_name), section) if section == "Radarr": - payload = {'name': 'DownloadedMoviesScan', 'path': params['media_folder'], 'downloadClientId': download_id,'importMode' : import_mode} + payload = {'name': 'DownloadedMoviesScan', 'path': params['media_folder'], 'downloadClientId': download_id, 'importMode': import_mode} if not download_id: payload.pop("downloadClientId") logger.debug("Opening URL: {0} with PARAMS: {1}".format(base_url, payload), section) @@ -300,7 +300,7 @@ class Movie(object): logger.postprocess("SUCCESS: Release for {0} has now been marked with a status of [{1}]".format( title, str(release_status_new).upper()), section) return [0, "{0}: Successfully post-processed {1}".format(section, input_name)] - except: + except Exception: pass elif scan_id: url = "{0}/{1}".format(base_url, scan_id) @@ -416,7 +416,7 @@ class Movie(object): id = result[section]['_id'] results[id] = result[section] return results - except: + except Exception: pass # Gather release info and proceed with trying to narrow results to one release choice @@ -441,7 +441,7 @@ class Movie(object): id = release['_id'] results[id] = release results[id]['title'] = movie['title'] - except: + except Exception: continue # Narrow results by removing old releases by comparing their last_edit field @@ -451,7 +451,7 @@ class Movie(object): try: if x2["last_edit"] > x1["last_edit"]: results.pop(id1) - except: + except Exception: continue # Search downloads on clients for a match to try and narrow our results down to 1 @@ -460,7 +460,7 @@ class Movie(object): try: if not find_download(str(x['download_info']['downloader']).lower(), x['download_info']['id']): results.pop(id) - except: + except Exception: continue return results diff --git a/core/auto_process/music.py b/core/auto_process/music.py index 0e5daeca..1275087d 100644 --- a/core/auto_process/music.py +++ b/core/auto_process/music.py @@ -61,9 +61,9 @@ class Music(object): core.extract_files(dir_name) input_name, dir_name = convert_to_ascii(input_name, dir_name) - #if listMediaFiles(dir_name, media=False, audio=True, meta=False, archives=False) and status: - # logger.info("Status shown as failed from Downloader, but valid video files found. Setting as successful.", section) - # status = 0 + # if listMediaFiles(dir_name, media=False, audio=True, meta=False, archives=False) and status: + # logger.info("Status shown as failed from Downloader, but valid video files found. Setting as successful.", section) + # status = 0 if status == 0 and section == "HeadPhones": diff --git a/core/auto_process/tv.py b/core/auto_process/tv.py index 930823ab..33cae750 100644 --- a/core/auto_process/tv.py +++ b/core/auto_process/tv.py @@ -44,7 +44,7 @@ class TV(object): delete_failed = int(cfg.get("delete_failed", 0)) nzb_extraction_by = cfg.get("nzbExtractionBy", "Downloader") process_method = cfg.get("process_method") - if client_agent == core.TORRENT_CLIENTAGENT and core.USELINK == "move-sym": + if client_agent == core.TORRENT_CLIENTAGENT and core.USELINK == "move-sym": process_method = "symlink" remote_path = int(cfg.get("remote_path", 0)) wait_for = int(cfg.get("wait_for", 2)) @@ -56,8 +56,8 @@ class TV(object): extract = 0 else: extract = int(cfg.get("extract", 0)) - #get importmode, default to "Move" for consistency with legacy - import_mode = cfg.get("importMode","Move") + # get importmode, default to "Move" for consistency with legacy + import_mode = cfg.get("importMode", "Move") if not os.path.isdir(dir_name) and os.path.isfile(dir_name): # If the input directory is a file, assume single file download and split dir/name. dir_name = os.path.split(os.path.normpath(dir_name))[0] @@ -256,7 +256,7 @@ class TV(object): if not apikey and username and password: login = "{0}{1}:{2}{3}/login".format(protocol, host, port, web_root) login_params = {'username': username, 'password': password} - r = s.get(login, verify=False, timeout=(30,60)) + r = s.get(login, verify=False, timeout=(30, 60)) if r.status_code == 401 and r.cookies.get('_xsrf'): login_params['_xsrf'] = r.cookies.get('_xsrf') s.post(login, data=login_params, stream=True, verify=False, timeout=(30, 60)) diff --git a/core/configuration.py b/core/configuration.py index 6ac42645..d469ad67 100644 --- a/core/configuration.py +++ b/core/configuration.py @@ -18,7 +18,7 @@ class Section(configobj.Section, object): if not section.sections: try: value = list(ConfigObj.find_key(section, 'enabled'))[0] - except: + except Exception: value = 0 if int(value) == 1: return section @@ -28,7 +28,7 @@ class Section(configobj.Section, object): for subsection in subsections: try: value = list(ConfigObj.find_key(subsections, 'enabled'))[0] - except: + except Exception: value = 0 if int(value) != 1: @@ -45,7 +45,7 @@ class Section(configobj.Section, object): for subsection in to_return: try: value = list(ConfigObj.find_key(to_return[subsection], key))[0] - except: + except Exception: value = None if not value: @@ -198,7 +198,7 @@ class ConfigObj(configobj.ConfigObj, Section): if not list(ConfigObj.find_key(CFG_NEW, option)): try: values.pop(option) - except: + except Exception: pass return values @@ -239,7 +239,7 @@ class ConfigObj(configobj.ConfigObj, Section): process_section(section, subsection) # create a backup of our old config - CFG_OLD.filename ="{config}.old".format(config=core.CONFIG_FILE) + CFG_OLD.filename = "{config}.old".format(config=core.CONFIG_FILE) CFG_OLD.write() # write our new config to autoProcessMedia.cfg @@ -299,9 +299,9 @@ class ConfigObj(configobj.ConfigObj, Section): section = "CouchPotato" env_cat_key = 'NZBPO_CPSCATEGORY' env_keys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'METHOD', 'DELETE_FAILED', 'REMOTE_PATH', - 'WAIT_FOR', 'WATCH_DIR', 'OMDBAPIKEY'] + 'WAIT_FOR', 'WATCH_DIR', 'OMDBAPIKEY'] cfg_keys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'method', 'delete_failed', 'remote_path', - 'wait_for', 'watch_dir', 'omdbapikey'] + 'wait_for', 'watch_dir', 'omdbapikey'] if env_cat_key in os.environ: for index in range(len(env_keys)): key = 'NZBPO_CPS{index}'.format(index=env_keys[index]) @@ -318,9 +318,9 @@ class ConfigObj(configobj.ConfigObj, Section): section = "SickBeard" env_cat_key = 'NZBPO_SBCATEGORY' env_keys = ['ENABLED', 'HOST', 'PORT', 'APIKEY', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', - 'DELETE_FAILED', 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'REMOTE_PATH', 'PROCESS_METHOD'] + 'DELETE_FAILED', 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'REMOTE_PATH', 'PROCESS_METHOD'] cfg_keys = ['enabled', 'host', 'port', 'apikey', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', - 'delete_failed', 'Torrent_NoLink', 'nzbExtractionBy', 'remote_path', 'process_method'] + 'delete_failed', 'Torrent_NoLink', 'nzbExtractionBy', 'remote_path', 'process_method'] if env_cat_key in os.environ: for index in range(len(env_keys)): key = 'NZBPO_SB{index}'.format(index=env_keys[index]) @@ -354,9 +354,9 @@ class ConfigObj(configobj.ConfigObj, Section): section = "Mylar" env_cat_key = 'NZBPO_MYCATEGORY' env_keys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'APIKEY', 'SSL', 'WEB_ROOT', 'WATCH_DIR', - 'REMOTE_PATH'] + 'REMOTE_PATH'] cfg_keys = ['enabled', 'host', 'port', 'username', 'password', 'apikey', 'ssl', 'web_root', 'watch_dir', - 'remote_path'] + 'remote_path'] if env_cat_key in os.environ: for index in range(len(env_keys)): key = 'NZBPO_MY{index}'.format(index=env_keys[index]) @@ -386,10 +386,10 @@ class ConfigObj(configobj.ConfigObj, Section): section = "NzbDrone" env_cat_key = 'NZBPO_NDCATEGORY' env_keys = ['ENABLED', 'HOST', 'APIKEY', 'PORT', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', - 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'WAIT_FOR', 'DELETE_FAILED', 'REMOTE_PATH', 'IMPORTMODE'] - #new cfgKey added for importMode + 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'WAIT_FOR', 'DELETE_FAILED', 'REMOTE_PATH', 'IMPORTMODE'] + # new cfgKey added for importMode cfg_keys = ['enabled', 'host', 'apikey', 'port', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', - 'Torrent_NoLink', 'nzbExtractionBy', 'wait_for', 'delete_failed', 'remote_path','importMode'] + 'Torrent_NoLink', 'nzbExtractionBy', 'wait_for', 'delete_failed', 'remote_path', 'importMode'] if env_cat_key in os.environ: for index in range(len(env_keys)): key = 'NZBPO_ND{index}'.format(index=env_keys[index]) @@ -406,10 +406,10 @@ class ConfigObj(configobj.ConfigObj, Section): section = "Radarr" env_cat_key = 'NZBPO_RACATEGORY' env_keys = ['ENABLED', 'HOST', 'APIKEY', 'PORT', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', - 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'WAIT_FOR', 'DELETE_FAILED', 'REMOTE_PATH', 'OMDBAPIKEY', 'IMPORTMODE'] - #new cfgKey added for importMode + 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'WAIT_FOR', 'DELETE_FAILED', 'REMOTE_PATH', 'OMDBAPIKEY', 'IMPORTMODE'] + # new cfgKey added for importMode cfg_keys = ['enabled', 'host', 'apikey', 'port', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', - 'Torrent_NoLink', 'nzbExtractionBy', 'wait_for', 'delete_failed', 'remote_path', 'omdbapikey','importMode'] + 'Torrent_NoLink', 'nzbExtractionBy', 'wait_for', 'delete_failed', 'remote_path', 'omdbapikey', 'importMode'] if env_cat_key in os.environ: for index in range(len(env_keys)): key = 'NZBPO_RA{index}'.format(index=env_keys[index]) @@ -426,9 +426,9 @@ class ConfigObj(configobj.ConfigObj, Section): section = "Lidarr" env_cat_key = 'NZBPO_LICATEGORY' env_keys = ['ENABLED', 'HOST', 'APIKEY', 'PORT', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', - 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'WAIT_FOR', 'DELETE_FAILED', 'REMOTE_PATH'] + 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'WAIT_FOR', 'DELETE_FAILED', 'REMOTE_PATH'] cfg_keys = ['enabled', 'host', 'apikey', 'port', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', - 'Torrent_NoLink', 'nzbExtractionBy', 'wait_for', 'delete_failed', 'remote_path'] + 'Torrent_NoLink', 'nzbExtractionBy', 'wait_for', 'delete_failed', 'remote_path'] if env_cat_key in os.environ: for index in range(len(env_keys)): key = 'NZBPO_LI{index}'.format(index=env_keys[index]) @@ -464,25 +464,25 @@ class ConfigObj(configobj.ConfigObj, Section): section = "Transcoder" env_keys = ['TRANSCODE', 'DUPLICATE', 'IGNOREEXTENSIONS', 'OUTPUTFASTSTART', 'OUTPUTVIDEOPATH', - 'PROCESSOUTPUT', 'AUDIOLANGUAGE', 'ALLAUDIOLANGUAGES', 'SUBLANGUAGES', - 'ALLSUBLANGUAGES', 'EMBEDSUBS', 'BURNINSUBTITLE', 'EXTRACTSUBS', 'EXTERNALSUBDIR', - 'OUTPUTDEFAULT', 'OUTPUTVIDEOEXTENSION', 'OUTPUTVIDEOCODEC', 'VIDEOCODECALLOW', - 'OUTPUTVIDEOPRESET', 'OUTPUTVIDEOFRAMERATE', 'OUTPUTVIDEOBITRATE', 'OUTPUTAUDIOCODEC', - 'AUDIOCODECALLOW', 'OUTPUTAUDIOBITRATE', 'OUTPUTQUALITYPERCENT', 'GETSUBS', - 'OUTPUTAUDIOTRACK2CODEC', 'AUDIOCODEC2ALLOW', 'OUTPUTAUDIOTRACK2BITRATE', - 'OUTPUTAUDIOOTHERCODEC', 'AUDIOOTHERCODECALLOW', 'OUTPUTAUDIOOTHERBITRATE', - 'OUTPUTSUBTITLECODEC', 'OUTPUTAUDIOCHANNELS', 'OUTPUTAUDIOTRACK2CHANNELS', - 'OUTPUTAUDIOOTHERCHANNELS','OUTPUTVIDEORESOLUTION'] + 'PROCESSOUTPUT', 'AUDIOLANGUAGE', 'ALLAUDIOLANGUAGES', 'SUBLANGUAGES', + 'ALLSUBLANGUAGES', 'EMBEDSUBS', 'BURNINSUBTITLE', 'EXTRACTSUBS', 'EXTERNALSUBDIR', + 'OUTPUTDEFAULT', 'OUTPUTVIDEOEXTENSION', 'OUTPUTVIDEOCODEC', 'VIDEOCODECALLOW', + 'OUTPUTVIDEOPRESET', 'OUTPUTVIDEOFRAMERATE', 'OUTPUTVIDEOBITRATE', 'OUTPUTAUDIOCODEC', + 'AUDIOCODECALLOW', 'OUTPUTAUDIOBITRATE', 'OUTPUTQUALITYPERCENT', 'GETSUBS', + 'OUTPUTAUDIOTRACK2CODEC', 'AUDIOCODEC2ALLOW', 'OUTPUTAUDIOTRACK2BITRATE', + 'OUTPUTAUDIOOTHERCODEC', 'AUDIOOTHERCODECALLOW', 'OUTPUTAUDIOOTHERBITRATE', + 'OUTPUTSUBTITLECODEC', 'OUTPUTAUDIOCHANNELS', 'OUTPUTAUDIOTRACK2CHANNELS', + 'OUTPUTAUDIOOTHERCHANNELS', 'OUTPUTVIDEORESOLUTION'] cfg_keys = ['transcode', 'duplicate', 'ignoreExtensions', 'outputFastStart', 'outputVideoPath', - 'processOutput', 'audioLanguage', 'allAudioLanguages', 'subLanguages', - 'allSubLanguages', 'embedSubs', 'burnInSubtitle', 'extractSubs', 'externalSubDir', - 'outputDefault', 'outputVideoExtension', 'outputVideoCodec', 'VideoCodecAllow', - 'outputVideoPreset', 'outputVideoFramerate', 'outputVideoBitrate', 'outputAudioCodec', - 'AudioCodecAllow', 'outputAudioBitrate', 'outputQualityPercent', 'getSubs', - 'outputAudioTrack2Codec', 'AudioCodec2Allow', 'outputAudioTrack2Bitrate', - 'outputAudioOtherCodec', 'AudioOtherCodecAllow', 'outputAudioOtherBitrate', - 'outputSubtitleCodec', 'outputAudioChannels', 'outputAudioTrack2Channels', - 'outputAudioOtherChannels', 'outputVideoResolution'] + 'processOutput', 'audioLanguage', 'allAudioLanguages', 'subLanguages', + 'allSubLanguages', 'embedSubs', 'burnInSubtitle', 'extractSubs', 'externalSubDir', + 'outputDefault', 'outputVideoExtension', 'outputVideoCodec', 'VideoCodecAllow', + 'outputVideoPreset', 'outputVideoFramerate', 'outputVideoBitrate', 'outputAudioCodec', + 'AudioCodecAllow', 'outputAudioBitrate', 'outputQualityPercent', 'getSubs', + 'outputAudioTrack2Codec', 'AudioCodec2Allow', 'outputAudioTrack2Bitrate', + 'outputAudioOtherCodec', 'AudioOtherCodecAllow', 'outputAudioOtherBitrate', + 'outputSubtitleCodec', 'outputAudioChannels', 'outputAudioTrack2Channels', + 'outputAudioOtherChannels', 'outputVideoResolution'] for index in range(len(env_keys)): key = 'NZBPO_{index}'.format(index=env_keys[index]) if key in os.environ: @@ -503,9 +503,9 @@ class ConfigObj(configobj.ConfigObj, Section): section = "UserScript" env_cat_key = 'NZBPO_USCATEGORY' env_keys = ['USER_SCRIPT_MEDIAEXTENSIONS', 'USER_SCRIPT_PATH', 'USER_SCRIPT_PARAM', 'USER_SCRIPT_RUNONCE', - 'USER_SCRIPT_SUCCESSCODES', 'USER_SCRIPT_CLEAN', 'USDELAY', 'USREMOTE_PATH'] + 'USER_SCRIPT_SUCCESSCODES', 'USER_SCRIPT_CLEAN', 'USDELAY', 'USREMOTE_PATH'] cfg_keys = ['user_script_mediaExtensions', 'user_script_path', 'user_script_param', 'user_script_runOnce', - 'user_script_successCodes', 'user_script_clean', 'delay', 'remote_path'] + 'user_script_successCodes', 'user_script_clean', 'delay', 'remote_path'] if env_cat_key in os.environ: for index in range(len(env_keys)): key = 'NZBPO_{index}'.format(index=env_keys[index]) diff --git a/core/extractor/__init__.py b/core/extractor/__init__.py index a1ed8457..03005662 100644 --- a/core/extractor/__init__.py +++ b/core/extractor/__init__.py @@ -147,7 +147,7 @@ def extract(file_path, output_destination): break else: continue - except: + except Exception: core.logger.error("EXTRACTOR: Extraction failed for {file}. " "Could not call command {cmd}".format (file=file_path, cmd=cmd)) @@ -165,13 +165,13 @@ def extract(file_path, output_destination): if not os.path.join(dir, subdir) in orig_files: try: os.chmod(os.path.join(dir, subdir), perms) - except: + except Exception: pass for file in files: if not os.path.join(dir, file) in orig_files: try: shutil.copymode(file_path, os.path.join(dir, file)) - except: + except Exception: pass return True else: diff --git a/core/forks.py b/core/forks.py index ca8df914..5cf4e5f1 100644 --- a/core/forks.py +++ b/core/forks.py @@ -20,7 +20,7 @@ def auto_fork(section, input_category): apikey = cfg.get("apikey") ssl = int(cfg.get("ssl", 0)) web_root = cfg.get("web_root", "") - replace = {'sickrage':'SickRage', 'sickchill':'SickChill', 'sickgear':'SickGear', 'medusa':'Medusa', 'sickbeard-api':'SickBeard-api'} + replace = {'sickrage': 'SickRage', 'sickchill': 'SickChill', 'sickgear': 'SickGear', 'medusa': 'Medusa', 'sickbeard-api': 'SickBeard-api'} f1 = replace[cfg.get("fork", "auto")] if cfg.get("fork", "auto") in replace else cfg.get("fork", "auto") try: fork = f1, core.FORKS[f1] @@ -68,7 +68,7 @@ def auto_fork(section, input_category): login = "{protocol}{host}:{port}{root}/login".format( protocol=protocol, host=host, port=port, root=web_root) login_params = {'username': username, 'password': password} - r = s.get(login, verify=False, timeout=(30,60)) + r = s.get(login, verify=False, timeout=(30, 60)) if r.status_code == 401 and r.cookies.get('_xsrf'): login_params['_xsrf'] = r.cookies.get('_xsrf') s.post(login, data=login_params, stream=True, verify=False) @@ -82,7 +82,7 @@ def auto_fork(section, input_category): optional_parameters = [] try: optional_parameters = r.json()['data']['optionalParameters'].keys() - except: + except Exception: optional_parameters = r.json()['data']['data']['optionalParameters'].keys() for param in params: if param not in optional_parameters: diff --git a/core/main_db.py b/core/main_db.py index c782e763..74b5cdef 100644 --- a/core/main_db.py +++ b/core/main_db.py @@ -169,10 +169,13 @@ class DBConnection(object): def upsert(self, table_name, value_dict, key_dict): + def gen_params(my_dict): + return [ + "{key} = ?".format(key=k) + for k in my_dict.keys() + ] + changes_before = self.connection.total_changes - - gen_params = lambda my_dict: ["{key} = ?".format(key=k) for k in my_dict.keys()] - items = list(value_dict.values()) + list(key_dict.values()) self.action( "UPDATE {table} " diff --git a/core/scene_exceptions.py b/core/scene_exceptions.py index 90e745de..3a315353 100644 --- a/core/scene_exceptions.py +++ b/core/scene_exceptions.py @@ -123,7 +123,7 @@ def rename_script(dirname): rename_file = "" for dir, dirs, files in os.walk(dirname): for file in files: - if re.search('(rename\S*\.(sh|bat)$)', file, re.IGNORECASE): + if re.search(r'(rename\S*\.(sh|bat)$)', file, re.IGNORECASE): rename_file = os.path.join(dir, file) dirname = dir break @@ -146,6 +146,7 @@ def rename_script(dirname): except Exception as error: logger.error("Unable to rename file due to: {error}".format(error=error), "EXCEPTION") + def par2(dirname): newlist = [] sofar = 0 @@ -176,7 +177,7 @@ def par2(dirname): proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket) proc.communicate() result = proc.returncode - except: + except Exception: logger.error("par2 file processing for {0} has failed".format(parfile), "PAR2") if result == 0: logger.info("par2 file processing succeeded", "PAR2") diff --git a/core/transcoder.py b/core/transcoder.py index 223b1c20..4314a715 100644 --- a/core/transcoder.py +++ b/core/transcoder.py @@ -69,7 +69,7 @@ def zip_out(file, img, bitbucket): cmd = [core.SEVENZIP, '-so', 'e', img, file] try: procin = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=bitbucket) - except: + except Exception: logger.error("Extracting [{0}] has failed".format(file), 'TRANSCODER') return procin @@ -99,7 +99,7 @@ def get_video_details(videofile, img=None, bitbucket=None): out, err = proc.communicate() result = proc.returncode video_details = json.loads(out) - except: + except Exception: pass if not video_details: try: @@ -113,7 +113,7 @@ def get_video_details(videofile, img=None, bitbucket=None): out, err = proc.communicate() result = proc.returncode video_details = json.loads(out) - except: + except Exception: logger.error("Checking [{0}] has failed".format(file), 'TRANSCODER') return video_details, result @@ -132,7 +132,7 @@ def build_commands(file, new_dir, movie_name, bitbucket): elif check: name = ('{0}.cd{1}'.format(movie_name, check.groups()[0])) elif core.CONCAT and re.match("(.+)[cC][dD][0-9]", name): - name = re.sub("([\ \.\-\_\=\:]+[cC][dD][0-9])", "", name) + name = re.sub('([ ._=:-]+[cC][dD][0-9])', "", name) if ext == core.VEXTENSION and new_dir == dir: # we need to change the name to prevent overwriting itself. core.VEXTENSION = '-transcoded{ext}'.format(ext=core.VEXTENSION) # adds '-transcoded.ext' else: @@ -208,8 +208,8 @@ def build_commands(file, new_dir, movie_name, bitbucket): sub_streams = [item for item in video_details["streams"] if item["codec_type"] == "subtitle"] if core.VEXTENSION not in ['.mkv', '.mpegts']: sub_streams = [item for item in video_details["streams"] if - item["codec_type"] == "subtitle" and item["codec_name"] != "hdmv_pgs_subtitle" and item[ - "codec_name"] != "pgssub"] + item["codec_type"] == "subtitle" and item["codec_name"] != "hdmv_pgs_subtitle" and item[ + "codec_name"] != "pgssub"] for video in video_streams: codec = video["codec_name"] @@ -262,26 +262,26 @@ def build_commands(file, new_dir, movie_name, bitbucket): if audio_streams: for i, val in reversed(list(enumerate(audio_streams))): try: - if "Commentary" in val.get("tags").get("title"): # Split out commentry tracks. + if "Commentary" in val.get("tags").get("title"): # Split out commentry tracks. commentary.append(val) del audio_streams[i] - except: + except Exception: continue try: audio1 = [item for item in audio_streams if item["tags"]["language"] == core.ALANGUAGE] - except: # no language tags. Assume only 1 language. + except Exception: # no language tags. Assume only 1 language. audio1 = audio_streams try: audio2 = [item for item in audio1 if item["codec_name"] in core.ACODEC_ALLOW] - except: + except Exception: audio2 = [] try: audio3 = [item for item in audio_streams if item["tags"]["language"] != core.ALANGUAGE] - except: + except Exception: audio3 = [] try: audio4 = [item for item in audio3 if item["codec_name"] in core.ACODEC_ALLOW] - except: + except Exception: audio4 = [] if audio2: # right (or only) language and codec... @@ -328,11 +328,11 @@ def build_commands(file, new_dir, movie_name, bitbucket): used_audio += 1 try: audio5 = [item for item in audio1 if item["codec_name"] in core.ACODEC2_ALLOW] - except: + except Exception: audio5 = [] try: audio6 = [item for item in audio3 if item["codec_name"] in core.ACODEC2_ALLOW] - except: + except Exception: audio6 = [] if audio5: # right language and codec. map_cmd.extend(['-map', '0:{index}'.format(index=audio5[0]["index"])]) @@ -380,13 +380,13 @@ def build_commands(file, new_dir, movie_name, bitbucket): if audio_cmd2[1] in ['aac', 'dts']: audio_cmd2[2:2] = ['-strict', '-2'] - if a_mapped[1] == a_mapped[0] and audio_cmd2[1:] == audio_cmd[1:]: #check for duplicate output track. + if a_mapped[1] == a_mapped[0] and audio_cmd2[1:] == audio_cmd[1:]: # check for duplicate output track. del map_cmd[-2:] else: audio_cmd.extend(audio_cmd2) if core.AINCLUDE and core.ACODEC3: - audio_streams.extend(commentary) #add commentry tracks back here. + audio_streams.extend(commentary) # add commentry tracks back here. for audio in audio_streams: if audio["index"] in a_mapped: continue @@ -425,7 +425,7 @@ def build_commands(file, new_dir, movie_name, bitbucket): for lan in core.SLANGUAGES: try: subs1 = [item for item in sub_streams if item["tags"]["language"] == lan] - except: + except Exception: subs1 = [] if core.BURN and not subs1 and not burnt and os.path.isfile(file): for subfile in get_subs(file): @@ -443,7 +443,7 @@ def build_commands(file, new_dir, movie_name, bitbucket): burnt = 1 if not core.ALLOWSUBS: break - if sub["codec_name"] in ["dvd_subtitle", "VobSub"] and core.SCODEC == "mov_text": # We can't convert these. + if sub["codec_name"] in ["dvd_subtitle", "VobSub"] and core.SCODEC == "mov_text": # We can't convert these. continue map_cmd.extend(['-map', '0:{index}'.format(index=sub["index"])]) s_mapped.extend([sub["index"]]) @@ -454,7 +454,7 @@ def build_commands(file, new_dir, movie_name, bitbucket): break if sub["index"] in s_mapped: continue - if sub["codec_name"] in ["dvd_subtitle", "VobSub"] and core.SCODEC == "mov_text": # We can't convert these. + if sub["codec_name"] in ["dvd_subtitle", "VobSub"] and core.SCODEC == "mov_text": # We can't convert these. continue map_cmd.extend(['-map', '0:{index}'.format(index=sub["index"])]) s_mapped.extend([sub["index"]]) @@ -478,7 +478,7 @@ def build_commands(file, new_dir, movie_name, bitbucket): continue if core.SCODEC == "mov_text": subcode = [stream["codec_name"] for stream in sub_details["streams"]] - if set(subcode).intersection(["dvd_subtitle", "VobSub"]): # We can't convert these. + if set(subcode).intersection(["dvd_subtitle", "VobSub"]): # We can't convert these. continue command.extend(['-i', subfile]) lan = os.path.splitext(os.path.splitext(subfile)[0])[1][1:].split('-')[0] @@ -489,7 +489,7 @@ def build_commands(file, new_dir, movie_name, bitbucket): metlan = Language(lan) if len(lan) == 2: metlan = Language.fromalpha2(lan) - except: + except Exception: pass if metlan: meta_cmd.extend(['-metadata:s:s:{x}'.format(x=len(s_mapped) + n), @@ -542,12 +542,12 @@ def extract_subs(file, newfile_path, bitbucket): try: sub_streams = [item for item in video_details["streams"] if - item["codec_type"] == "subtitle" and item["tags"]["language"] in core.SLANGUAGES and item[ - "codec_name"] != "hdmv_pgs_subtitle" and item["codec_name"] != "pgssub"] - except: + item["codec_type"] == "subtitle" and item["tags"]["language"] in core.SLANGUAGES and item[ + "codec_name"] != "hdmv_pgs_subtitle" and item["codec_name"] != "pgssub"] + except Exception: sub_streams = [item for item in video_details["streams"] if - item["codec_type"] == "subtitle" and item["codec_name"] != "hdmv_pgs_subtitle" and item[ - "codec_name"] != "pgssub"] + item["codec_type"] == "subtitle" and item["codec_name"] != "hdmv_pgs_subtitle" and item[ + "codec_name"] != "pgssub"] num = len(sub_streams) for n in range(num): sub = sub_streams[n] @@ -575,13 +575,13 @@ def extract_subs(file, newfile_path, bitbucket): proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket) proc.communicate() result = proc.returncode - except: + except Exception: logger.error("Extracting subtitle has failed") if result == 0: try: shutil.copymode(file, output_file) - except: + except Exception: pass logger.info("Extracting {0} subtitle from {1} has succeeded".format(lan, file)) else: @@ -605,7 +605,7 @@ def process_list(it, new_dir, bitbucket): if not vts_path: try: vts_path = re.match("(.+VIDEO_TS)", item).groups()[0] - except: + except Exception: vts_path = os.path.split(item)[0] rem_list.append(item) elif re.match(".+VIDEO_TS.", item) or re.match(".+VTS_[0-9][0-9]_[0-9].", item): @@ -649,8 +649,8 @@ def rip_iso(item, new_dir, bitbucket): print_cmd(cmd) proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=bitbucket) out, err = proc.communicate() - file_list = [re.match(".+(VIDEO_TS[\\\/]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb])", line).groups()[0] for line in - out.splitlines() if re.match(".+VIDEO_TS[\\\/]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb]", line)] + file_list = [re.match(r".+(VIDEO_TS[/\\]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb])", line).groups()[0] for line in + out.splitlines() if re.match(r".+VIDEO_TS[/\\]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb]", line)] combined = [] for n in range(99): concat = [] @@ -677,7 +677,7 @@ def rip_iso(item, new_dir, bitbucket): if not new_files: logger.error("No VIDEO_TS folder found in image file {0}".format(item), "TRANSCODER") new_files = [failure_dir] - except: + except Exception: logger.error("Failed to extract from image file {0}".format(item), "TRANSCODER") new_files = [failure_dir] return new_files @@ -788,7 +788,7 @@ def transcode_directory(dir_name): procin.stdout.close() proc.communicate() result = proc.returncode - except: + except Exception: logger.error("Transcoding of video {0} has failed".format(newfile_path)) if core.SUBSDIR and result == 0 and isinstance(file, string_types): @@ -803,13 +803,13 @@ def transcode_directory(dir_name): if result == 0: try: shutil.copymode(file, newfile_path) - except: + except Exception: pass logger.info("Transcoding of video to {0} succeeded".format(newfile_path)) if os.path.isfile(newfile_path) and (file in new_list or not core.DUPLICATE): try: os.unlink(file) - except: + except Exception: pass else: logger.error("Transcoding of video to {0} failed with result {1}".format(newfile_path, result)) @@ -819,7 +819,7 @@ def transcode_directory(dir_name): for file in rem_list: try: os.unlink(file) - except: + except Exception: pass if not os.listdir(text_type(new_dir)): # this is an empty directory and we didn't transcode into it. os.rmdir(new_dir) diff --git a/core/user_scripts.py b/core/user_scripts.py index 6eae29f5..1fc97dc5 100644 --- a/core/user_scripts.py +++ b/core/user_scripts.py @@ -15,7 +15,7 @@ def external_script(output_destination, torrent_name, torrent_label, settings): core.USER_SCRIPT_MEDIAEXTENSIONS = settings["user_script_mediaExtensions"].lower() if isinstance(core.USER_SCRIPT_MEDIAEXTENSIONS, str): core.USER_SCRIPT_MEDIAEXTENSIONS = core.USER_SCRIPT_MEDIAEXTENSIONS.split(',') - except: + except Exception: core.USER_SCRIPT_MEDIAEXTENSIONS = [] core.USER_SCRIPT = settings.get("user_script_path") @@ -26,13 +26,13 @@ def external_script(output_destination, torrent_name, torrent_label, settings): core.USER_SCRIPT_PARAM = settings["user_script_param"] if isinstance(core.USER_SCRIPT_PARAM, str): core.USER_SCRIPT_PARAM = core.USER_SCRIPT_PARAM.split(',') - except: + except Exception: core.USER_SCRIPT_PARAM = [] try: core.USER_SCRIPT_SUCCESSCODES = settings["user_script_successCodes"] if isinstance(core.USER_SCRIPT_SUCCESSCODES, str): core.USER_SCRIPT_SUCCESSCODES = core.USER_SCRIPT_SUCCESSCODES.split(',') - except: + except Exception: core.USER_SCRIPT_SUCCESSCODES = 0 core.USER_SCRIPT_CLEAN = int(settings.get("user_script_clean", 1)) @@ -95,7 +95,7 @@ def external_script(output_destination, torrent_name, torrent_label, settings): "If the UserScript completed successfully you should add {0} to the user_script_successCodes".format( res), "USERSCRIPT") result = int(1) - except: + except Exception: logger.error("UserScript {0} has failed".format(command[0]), "USERSCRIPT") result = int(1) final_result += result diff --git a/core/utils.py b/core/utils.py index ce8944ea..7277c25a 100644 --- a/core/utils.py +++ b/core/utils.py @@ -45,10 +45,15 @@ requests.packages.urllib3.disable_warnings() # Monkey Patch shutil.copyfileobj() to adjust the buffer length to 512KB rather than 4KB shutil.copyfileobjOrig = shutil.copyfileobj + + def copyfileobj_fast(fsrc, fdst, length=512 * 1024): shutil.copyfileobjOrig(fsrc, fdst, length=length) + + shutil.copyfileobj = copyfileobj_fast + def report_nzb(failure_link, client_agent): # Contact indexer site logger.info("Sending failure notification to indexer site") @@ -85,7 +90,7 @@ def sanitize_name(name): name = name.strip(' .') try: name = name.encode(core.SYS_ENCODING) - except: + except Exception: pass return name @@ -123,11 +128,11 @@ def category_search(input_directory, input_name, input_category, root, categorie try: input_name = input_name.encode(core.SYS_ENCODING) - except: + except Exception: pass try: input_directory = input_directory.encode(core.SYS_ENCODING) - except: + except Exception: pass if input_directory is None: # =Nothing to process here. @@ -228,7 +233,7 @@ def is_min_size(input_name, min_size): if file_ext in core.AUDIOCONTAINER: try: input_size = get_dir_size(os.path.dirname(input_name)) - except: + except Exception: logger.error("Failed to get file size for {0}".format(input_name), 'MINSIZE') return True @@ -239,7 +244,7 @@ def is_min_size(input_name, min_size): def is_sample(input_name): # Ignore 'sample' in files - if re.search('(^|[\W_])sample\d*[\W_]', input_name.lower()): + if re.search('(^|[\\W_])sample\\d*[\\W_]', input_name.lower()): return True @@ -330,7 +335,7 @@ def flatten(output_destination): try: shutil.move(outputFile, target) - except: + except Exception: logger.error("Could not flatten {0}".format(outputFile), 'FLATTEN') remove_empty_folders(output_destination) # Cleanup empty directories @@ -367,7 +372,7 @@ def remove_read_only(filename): (name=filename)) try: os.chmod(filename, stat.S_IWRITE) - except: + except Exception: logger.warning('Cannot change permissions of {file}'.format(file=filename), logger.WARNING) @@ -398,7 +403,7 @@ def test_connection(host, port): try: socket.create_connection((host, port)) return "Up" - except: + except Exception: return "Down" @@ -510,19 +515,19 @@ def parse_rtorrent(args): input_directory = os.path.normpath(args[1]) try: input_name = args[2] - except: + except Exception: input_name = '' try: input_category = args[3] - except: + except Exception: input_category = '' try: input_hash = args[4] - except: + except Exception: input_hash = '' try: input_id = args[4] - except: + except Exception: input_id = '' return input_directory, input_name, input_category, input_hash, input_id @@ -534,15 +539,15 @@ def parse_utorrent(args): input_name = args[2] try: input_category = args[3] - except: + except Exception: input_category = '' try: input_hash = args[4] - except: + except Exception: input_hash = '' try: input_id = args[4] - except: + except Exception: input_id = '' return input_directory, input_name, input_category, input_hash, input_id @@ -556,7 +561,7 @@ def parse_deluge(args): input_id = args[1] try: input_category = core.TORRENT_CLASS.core.get_torrent_status(input_id, ['label']).get()['label'] - except: + except Exception: input_category = '' return input_directory, input_name, input_category, input_hash, input_id @@ -575,65 +580,67 @@ def parse_vuze(args): # vuze usage: C:\full\path\to\nzbToMedia\TorrentToMedia.py "%D%N%L%I%K%F" try: input = args[1].split(',') - except: + except Exception: input = [] try: input_directory = os.path.normpath(input[0]) - except: + except Exception: input_directory = '' try: input_name = input[1] - except: + except Exception: input_name = '' try: input_category = input[2] - except: + except Exception: input_category = '' try: input_hash = input[3] - except: + except Exception: input_hash = '' try: input_id = input[3] - except: + except Exception: input_id = '' try: if input[4] == 'single': input_name = input[5] - except: + except Exception: pass return input_directory, input_name, input_category, input_hash, input_id + def parse_qbittorrent(args): # qbittorrent usage: C:\full\path\to\nzbToMedia\TorrentToMedia.py "%D|%N|%L|%I" try: input = args[1].split('|') - except: + except Exception: input = [] try: - input_directory = os.path.normpath(input[0].replace('"','')) - except: + input_directory = os.path.normpath(input[0].replace('"', '')) + except Exception: input_directory = '' try: - input_name = input[1].replace('"','') - except: + input_name = input[1].replace('"', '') + except Exception: input_name = '' try: - input_category = input[2].replace('"','') - except: + input_category = input[2].replace('"', '') + except Exception: input_category = '' try: - input_hash = input[3].replace('"','') - except: + input_hash = input[3].replace('"', '') + except Exception: input_hash = '' try: - input_id = input[3].replace('"','') - except: + input_id = input[3].replace('"', '') + except Exception: input_id = '' return input_directory, input_name, input_category, input_hash, input_id + def parse_args(client_agent, args): clients = { 'other': parse_other, @@ -647,7 +654,7 @@ def parse_args(client_agent, args): try: return clients[client_agent](args) - except: + except Exception: return None, None, None, None, None @@ -699,7 +706,7 @@ def get_dirs(section, subsection, link='hard'): try: new_path = new_path.encode(core.SYS_ENCODING) - except: + except Exception: pass # Just fail-safe incase we already have afile with this clean-name (was actually a bug from earlier code, but let's be safe). @@ -714,7 +721,7 @@ def get_dirs(section, subsection, link='hard'): newfile = os.path.join(new_path, sanitize_name(os.path.split(mediafile)[1])) try: newfile = newfile.encode(core.SYS_ENCODING) - except: + except Exception: pass # link file to its new path @@ -780,7 +787,7 @@ def remove_dir(dir_name): logger.info("Deleting {0}".format(dir_name)) try: shutil.rmtree(text_type(dir_name), onerror=onerror) - except: + except Exception: logger.error("Unable to delete folder {0}".format(dir_name)) @@ -797,7 +804,7 @@ def clean_dir(path, section, subsection): delete_ignored = int(cfg.get('delete_ignored', 0)) try: num_files = len(list_media_files(path, min_size=min_size, delete_ignored=delete_ignored)) - except: + except Exception: num_files = 'unknown' if num_files > 0: logger.info( @@ -808,7 +815,7 @@ def clean_dir(path, section, subsection): logger.info("Directory {0} has been processed, removing ...".format(path), 'CLEANDIRS') try: shutil.rmtree(path, onerror=onerror) - except: + except Exception: logger.error("Unable to delete directory {0}".format(path)) @@ -820,7 +827,7 @@ def create_torrent_class(client_agent): try: logger.debug("Connecting to {0}: {1}".format(client_agent, core.UTORRENTWEBUI)) tc = UTorrentClient(core.UTORRENTWEBUI, core.UTORRENTUSR, core.UTORRENTPWD) - except: + except Exception: logger.error("Failed to connect to uTorrent") if client_agent == 'transmission': @@ -830,7 +837,7 @@ def create_torrent_class(client_agent): tc = TransmissionClient(core.TRANSMISSIONHOST, core.TRANSMISSIONPORT, core.TRANSMISSIONUSR, core.TRANSMISSIONPWD) - except: + except Exception: logger.error("Failed to connect to Transmission") if client_agent == 'deluge': @@ -839,7 +846,7 @@ def create_torrent_class(client_agent): tc = DelugeClient() tc.connect(host=core.DELUGEHOST, port=core.DELUGEPORT, username=core.DELUGEUSR, password=core.DELUGEPWD) - except: + except Exception: logger.error("Failed to connect to Deluge") if client_agent == 'qbittorrent': @@ -847,7 +854,7 @@ def create_torrent_class(client_agent): logger.debug("Connecting to {0}: http://{1}:{2}".format(client_agent, core.QBITTORRENTHOST, core.QBITTORRENTPORT)) tc = qBittorrentClient("http://{0}:{1}/".format(core.QBITTORRENTHOST, core.QBITTORRENTPORT)) tc.login(core.QBITTORRENTUSR, core.QBITTORRENTPWD) - except: + except Exception: logger.error("Failed to connect to qBittorrent") return tc @@ -865,7 +872,7 @@ def pause_torrent(client_agent, input_hash, input_id, input_name): if client_agent == 'qbittorrent' and core.TORRENT_CLASS != "": core.TORRENT_CLASS.pause(input_hash) time.sleep(5) - except: + except Exception: logger.warning("Failed to stop torrent {0} in {1}".format(input_name, client_agent)) @@ -883,7 +890,7 @@ def resume_torrent(client_agent, input_hash, input_id, input_name): if client_agent == 'qbittorrent' and core.TORRENT_CLASS != "": core.TORRENT_CLASS.resume(input_hash) time.sleep(5) - except: + except Exception: logger.warning("Failed to start torrent {0} in {1}".format(input_name, client_agent)) @@ -901,7 +908,7 @@ def remove_torrent(client_agent, input_hash, input_id, input_name): if client_agent == 'qbittorrent' and core.TORRENT_CLASS != "": core.TORRENT_CLASS.delete_permanently(input_hash) time.sleep(5) - except: + except Exception: logger.warning("Failed to delete torrent {0} in {1}".format(input_name, client_agent)) else: resume_torrent(client_agent, input_hash, input_id, input_name) @@ -974,7 +981,7 @@ def get_nzoid(input_name): result = r.json() clean_name = os.path.splitext(os.path.split(input_name)[1])[0] slots.extend([(slot['nzo_id'], slot['filename']) for slot in result['queue']['slots']]) - except: + except Exception: logger.warning("Data from SABnzbd queue could not be parsed") params['mode'] = "history" try: @@ -986,7 +993,7 @@ def get_nzoid(input_name): result = r.json() clean_name = os.path.splitext(os.path.split(input_name)[1])[0] slots.extend([(slot['nzo_id'], slot['name']) for slot in result['history']['slots']]) - except: + except Exception: logger.warning("Data from SABnzbd history could not be parsed") try: for nzo_id, name in slots: @@ -994,7 +1001,7 @@ def get_nzoid(input_name): nzoid = nzo_id logger.debug("Found nzoid: {0}".format(nzoid)) break - except: + except Exception: logger.warning("Data from SABnzbd could not be parsed") return nzoid @@ -1007,13 +1014,13 @@ def clean_file_name(filename): space, but handles decimal numbers in string, for example: """ - filename = re.sub("(\D)\.(?!\s)(\D)", "\\1 \\2", filename) - filename = re.sub("(\d)\.(\d{4})", "\\1 \\2", filename) # if it ends in a year then don't keep the dot - filename = re.sub("(\D)\.(?!\s)", "\\1 ", filename) - filename = re.sub("\.(?!\s)(\D)", " \\1", filename) + filename = re.sub(r"(\D)\.(?!\s)(\D)", r"\1 \2", filename) + filename = re.sub(r"(\d)\.(\d{4})", r"\1 \2", filename) # if it ends in a year then don't keep the dot + filename = re.sub(r"(\D)\.(?!\s)", r"\1 ", filename) + filename = re.sub(r"\.(?!\s)(\D)", r" \1", filename) filename = filename.replace("_", " ") filename = re.sub("-$", "", filename) - filename = re.sub("^\[.*\]", "", filename) + filename = re.sub(r"^\[.*]", "", filename) return filename.strip() @@ -1032,7 +1039,7 @@ def is_media_file(mediafile, media=True, audio=True, meta=True, archives=True, o # ignore MAC OS's "resource fork" files if file_name.startswith('._'): return False - except: + except Exception: pass if (media and file_ext.lower() in core.MEDIACONTAINER) \ or (audio and file_ext.lower() in core.AUDIOCONTAINER) \ @@ -1057,7 +1064,7 @@ def list_media_files(path, min_size=0, delete_ignored=0, media=True, audio=True, os.unlink(path) logger.debug('Ignored file {0} has been removed ...'.format (cur_file)) - except: + except Exception: pass else: files.append(path) @@ -1079,7 +1086,7 @@ def list_media_files(path, min_size=0, delete_ignored=0, media=True, audio=True, os.unlink(full_cur_file) logger.debug('Ignored file {0} has been removed ...'.format (cur_file)) - except: + except Exception: pass continue @@ -1095,14 +1102,14 @@ def find_imdbid(dir_name, input_name, omdb_api_key): # find imdbid in dirName logger.info('Searching folder and file names for imdbID ...') - m = re.search('(tt\d{7})', dir_name + input_name) + m = re.search(r'(tt\d{7})', dir_name + input_name) if m: imdbid = m.group(1) logger.info("Found imdbID [{0}]".format(imdbid)) return imdbid if os.path.isdir(dir_name): for file in os.listdir(text_type(dir_name)): - m = re.search('(tt\d{7})', file) + m = re.search(r'(tt\d{7})', file) if m: imdbid = m.group(1) logger.info("Found imdbID [{0}] via file name".format(imdbid)) @@ -1119,7 +1126,7 @@ def find_imdbid(dir_name, input_name, omdb_api_key): logger.info('Searching IMDB for imdbID ...') try: guess = guessit.guessit(input_name) - except: + except Exception: guess = None if guess: # Movie Title @@ -1149,12 +1156,12 @@ def find_imdbid(dir_name, input_name, omdb_api_key): try: results = r.json() - except: + except Exception: logger.error("No json data returned from omdbapi.com") try: imdbid = results['imdbID'] - except: + except Exception: logger.error("No imdbID returned from omdbapi.com") if imdbid: @@ -1207,14 +1214,14 @@ def import_subs(filename): return try: subliminal.region.configure('dogpile.cache.dbm', arguments={'filename': 'cachefile.dbm'}) - except: + except Exception: pass languages = set() for item in core.SLANGUAGES: try: languages.add(Language(item)) - except: + except Exception: pass if not languages: return @@ -1309,6 +1316,7 @@ def get_download_info(input_name, status): return sql_results + class WindowsProcess(object): def __init__(self): self.mutex = None @@ -1353,7 +1361,7 @@ class PosixProcess(object): # Make sure it is not a "stale" pidFile try: pid = int(open(self.pidpath, 'r').read().strip()) - except: + except Exception: pid = None # Check list of running pids, if not running it is stale so overwrite if isinstance(pid, int): @@ -1373,7 +1381,7 @@ class PosixProcess(object): fp = open(self.pidpath, 'w') fp.write(str(os.getpid())) fp.close() - except: + except Exception: pass return self.lasterror @@ -1385,6 +1393,7 @@ class PosixProcess(object): if os.path.isfile(self.pidpath): os.unlink(self.pidpath) + if os.name == 'nt': RunningProcess = WindowsProcess else: diff --git a/core/version_check.py b/core/version_check.py index e8bad6ca..e818c907 100644 --- a/core/version_check.py +++ b/core/version_check.py @@ -16,7 +16,6 @@ from six.moves.urllib.request import urlretrieve import cleanup import core from core import github_api as github, logger -import libs.util class CheckVersion(object): @@ -285,7 +284,7 @@ class GitUpdateManager(UpdateManager): self._num_commits_behind = int(output.count("<")) self._num_commits_ahead = int(output.count(">")) - except: + except Exception: logger.log(u"git didn't return numbers for behind and ahead, not using it", logger.DEBUG) return diff --git a/libs/custom/synchronousdeluge/client.py b/libs/custom/synchronousdeluge/client.py index bc82f8d6..aa180bf7 100644 --- a/libs/custom/synchronousdeluge/client.py +++ b/libs/custom/synchronousdeluge/client.py @@ -26,18 +26,18 @@ class DelugeClient(object): def _get_local_auth(self): username = password = "" if platform.system() in ('Windows', 'Microsoft'): - appDataPath = os.environ.get("APPDATA") - if not appDataPath: + app_data_path = os.environ.get("APPDATA") + if not app_data_path: from six.moves import winreg hkey = winreg.OpenKey( winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", ) - appDataReg = winreg.QueryValueEx(hkey, "AppData") - appDataPath = appDataReg[0] + app_data_reg = winreg.QueryValueEx(hkey, "AppData") + app_data_path = app_data_reg[0] winreg.CloseKey(hkey) - auth_file = os.path.join(appDataPath, "deluge", "auth") + auth_file = os.path.join(app_data_path, "deluge", "auth") else: from xdg.BaseDirectory import save_config_path try: @@ -79,11 +79,13 @@ class DelugeClient(object): return func def _introspect(self): + def splitter(value): + return value.split(".") + self.modules = [] methods = self.remote_call("daemon.get_method_list").get() methodmap = defaultdict(dict) - splitter = lambda v: v.split(".") for module, method in imap(splitter, methods): methodmap[module][method] = self._create_module_method(module, method) diff --git a/libs/custom/utorrent/client.py b/libs/custom/utorrent/client.py index 44dd1679..c58023a0 100644 --- a/libs/custom/utorrent/client.py +++ b/libs/custom/utorrent/client.py @@ -19,6 +19,7 @@ try: except ImportError: import simplejson as json + class UTorrentClient(object): def __init__(self, base_url, username, password): @@ -27,7 +28,7 @@ class UTorrentClient(object): self.password = password self.opener = self._make_opener('uTorrent', base_url, username, password) self.token = self._get_token() - #TODO refresh token, when necessary + # TODO refresh token, when necessary def _make_opener(self, realm, base_url, username, password): '''uTorrent API need HTTP Basic Auth and cookie support for token verify.''' @@ -60,25 +61,25 @@ class UTorrentClient(object): return self._action(params) def start(self, *hashes): - params = [('action', 'start'),] + params = [('action', 'start'), ] for hash in hashes: params.append(('hash', hash)) return self._action(params) def stop(self, *hashes): - params = [('action', 'stop'),] + params = [('action', 'stop'), ] for hash in hashes: params.append(('hash', hash)) return self._action(params) def pause(self, *hashes): - params = [('action', 'pause'),] + params = [('action', 'pause'), ] for hash in hashes: params.append(('hash', hash)) return self._action(params) def forcestart(self, *hashes): - params = [('action', 'forcestart'),] + params = [('action', 'forcestart'), ] for hash in hashes: params.append(('hash', hash)) return self._action(params) @@ -94,8 +95,8 @@ class UTorrentClient(object): def setprops(self, hash, **kvpairs): params = [('action', 'setprops'), ('hash', hash)] for k, v in iteritems(kvpairs): - params.append( ("s", k) ) - params.append( ("v", v) ) + params.append(("s", k)) + params.append(("v", v)) return self._action(params) @@ -111,7 +112,7 @@ class UTorrentClient(object): form = MultiPartForm() if filepath is not None: - file_handler = open(filepath,'rb') + file_handler = open(filepath, 'rb') else: file_handler = StringIO(bytes) @@ -124,19 +125,19 @@ class UTorrentClient(object): self._action(params) def remove(self, *hashes): - params = [('action', 'remove'),] + params = [('action', 'remove'), ] for hash in hashes: params.append(('hash', hash)) return self._action(params) def removedata(self, *hashes): - params = [('action', 'removedata'),] + params = [('action', 'removedata'), ] for hash in hashes: params.append(('hash', hash)) return self._action(params) def _action(self, params, body=None, content_type=None): - #about token, see https://github.com/bittorrent/webui/wiki/TokenSystem + # about token, see https://github.com/bittorrent/webui/wiki/TokenSystem url = self.base_url + '?token=' + self.token + '&' + urlencode(params) request = Request(url) diff --git a/libs/custom/utorrent/upload.py b/libs/custom/utorrent/upload.py index f5659f41..03d58bcc 100644 --- a/libs/custom/utorrent/upload.py +++ b/libs/custom/utorrent/upload.py @@ -23,9 +23,9 @@ class MultiPartForm(object): self.form_fields.append((name, value)) return - def add_file(self, fieldname, filename, fileHandle, mimetype=None): + def add_file(self, fieldname, filename, file_handle, mimetype=None): """Add a file to be uploaded.""" - body = fileHandle.read() + body = file_handle.read() if mimetype is None: mimetype = mimetypes.guess_type(filename)[0] or 'application/octet-stream' self.files.append((fieldname, filename, mimetype, body)) @@ -42,29 +42,28 @@ class MultiPartForm(object): # Add the form fields parts.extend( - [ part_boundary, - 'Content-Disposition: form-data; name="%s"' % name, - '', - value, - ] + [part_boundary, + 'Content-Disposition: form-data; name="%s"' % name, + '', + value, + ] for name, value in self.form_fields - ) + ) # Add the files to upload parts.extend( - [ part_boundary, - 'Content-Disposition: file; name="%s"; filename="%s"' % \ - (field_name, filename), - 'Content-Type: %s' % content_type, - '', - body, - ] + [part_boundary, + 'Content-Disposition: file; name="%s"; filename="%s"' % (field_name, filename), + 'Content-Type: %s' % content_type, + '', + body, + ] for field_name, filename, content_type, body in self.files - ) + ) # Flatten the list and add closing boundary marker, # then return CR+LF separated data flattened = list(itertools.chain(*parts)) flattened.append('--' + self.boundary + '--') flattened.append('') - return '\r\n'.join(flattened) \ No newline at end of file + return '\r\n'.join(flattened) diff --git a/nzbToCouchPotato.py b/nzbToCouchPotato.py index 9b91f789..00ffbd13 100755 --- a/nzbToCouchPotato.py +++ b/nzbToCouchPotato.py @@ -1,259 +1,5 @@ #!/usr/bin/env python2 # coding=utf-8 -# -############################################################################## -### NZBGET POST-PROCESSING SCRIPT ### - -# Post-Process to CouchPotato, SickBeard, NzbDrone, Mylar, Gamez, HeadPhones. -# -# This script sends the download to your automated media management servers. -# -# NOTE: This script requires Python to be installed on your system. - -############################################################################## -### OPTIONS ### - -## General - -# Auto Update nzbToMedia (0, 1). -# -# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version -#auto_update=0 - -# Check Media for corruption (0, 1). -# -# Enable/Disable media file checking using ffprobe. -#check_media=1 - -# Safe Mode protection of DestDir (0, 1). -# -# Enable/Disable a safety check to ensure we don't process all downloads in the default_downloadDirectory by mistake. -#safe_mode=1 - -# Disable additional extraction checks for failed (0, 1). -# -# Turn this on to disable additional extraction attempts for failed downloads. Default = 0 this will attempt to extract and verify if media is present. -#no_extract_failed = 0 - -## CouchPotato - -# CouchPotato script category. -# -# category that gets called for post-processing with CouchPotatoServer. -#cpsCategory=movie - -# CouchPotato api key. -#cpsapikey= - -# CouchPotato host. -# -# The ipaddress for your CouchPotato server. e.g For the Same system use localhost or 127.0.0.1 -#cpshost=localhost - -# CouchPotato port. -#cpsport=5050 - -# CouchPotato uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#cpsssl=0 - -# CouchPotato URL_Base -# -# set this if using a reverse proxy. -#cpsweb_root= - -# CouchPotato watch directory. -# -# set this to where your CouchPotato completed downloads are. -#cpswatch_dir= - -# CouchPotato OMDB API Key. -# -# api key for www.omdbapi.com (used as alternative to imdb to assist with movie identification). -#cpsomdbapikey= - -# CouchPotato Postprocess Method (renamer, manage). -# -# use "renamer" for CPS renamer (default) or "manage" to call a manage update. -#cpsmethod=renamer - -# CouchPotato Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#cpsdelete_failed=0 - -# CouchPotato wait_for -# -# Set the number of minutes to wait after calling the renamer, to check the movie has changed status. -#cpswait_for=2 - -# CouchPotatoServer and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#cpsremote_path=0 - -## Network - -# Network Mount Points (Needed for remote path above) -# -# Enter Mount points as LocalPath,RemotePath and separate each pair with '|' -# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\ -#mountPoints= - -## Extensions - -# Media Extensions -# -# This is a list of media extensions that are used to verify that the download does contain valid media. -#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso,.ts - -## Posix - -# Niceness for external tasks Extractor and Transcoder. -# -# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). -#niceness=10 - -# ionice scheduling class (0, 1, 2, 3). -# -# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. -#ionice_class=2 - -# ionice scheduling class data. -# -# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data. -#ionice_classdata=4 - -## Transcoder - -# getSubs (0, 1). -# -# set to 1 to download subtitles. -#getSubs=0 - -# subLanguages. -# -# subLanguages. create a list of languages in the order you want them in your subtitles. -#subLanguages=eng,spa,fra - -# Transcode (0, 1). -# -# set to 1 to transcode, otherwise set to 0. -#transcode=0 - -# create a duplicate, or replace the original (0, 1). -# -# set to 1 to cretae a new file or 0 to replace the original -#duplicate=1 - -# ignore extensions. -# -# list of extensions that won't be transcoded. -#ignoreExtensions=.avi,.mkv - -# outputFastStart (0,1). -# -# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used. -#outputFastStart=0 - -# outputVideoPath. -# -# outputVideoPath. Set path you want transcoded videos moved to. Leave blank to disable. -#outputVideoPath= - -# processOutput (0,1). -# -# processOutput. 1 will send the outputVideoPath to SickBeard/CouchPotato. 0 will send original files. -#processOutput=0 - -# audioLanguage. -# -# audioLanguage. set the 3 letter language code you want as your primary audio track. -#audioLanguage=eng - -# allAudioLanguages (0,1). -# -# allAudioLanguages. 1 will keep all audio tracks (uses AudioCodec3) where available. -#allAudioLanguages=0 - -# allSubLanguages (0,1). -# -# allSubLanguages. 1 will keep all exisiting sub languages. 0 will discare those not in your list above. -#allSubLanguages=0 - -# embedSubs (0,1). -# -# embedSubs. 1 will embded external sub/srt subs into your video if this is supported. -#embedSubs=1 - -# burnInSubtitle (0,1). -# -# burnInSubtitle. burns the default sub language into your video (needed for players that don't support subs) -#burnInSubtitle=0 - -# extractSubs (0,1). -# -# extractSubs. 1 will extract subs from the video file and save these as external srt files. -#extractSubs=0 - -# externalSubDir. -# -# externalSubDir. set the directory where subs should be saved (if not the same directory as the video) -#externalSubDir= - -# outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p, mkv, mp4-scene-release, MKV-SD). -# -# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. -# If you want to use your own profile, set None and set the remaining options below. -#outputDefault=None - -# hwAccel (0,1). -# -# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg). -#hwAccel=0 - -# ffmpeg output settings. -#outputVideoExtension=.mp4 -#outputVideoCodec=libx264 -#VideoCodecAllow= -#outputVideoResolution=720:-1 -#outputVideoPreset=medium -#outputVideoFramerate=24 -#outputVideoBitrate=800k -#outputAudioCodec=ac3 -#AudioCodecAllow= -#outputAudioChannels=6 -#outputAudioBitrate=640k -#outputQualityPercent= -#outputAudioTrack2Codec=libfaac -#AudioCodec2Allow= -#outputAudioTrack2Channels=2 -#outputAudioTrack2Bitrate=160k -#outputAudioOtherCodec=libmp3lame -#AudioOtherCodecAllow= -#outputAudioOtherChannels=2 -#outputAudioOtherBitrate=128k -#outputSubtitleCodec= - -## WakeOnLan - -# use WOL (0, 1). -# -# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified. -#wolwake=0 - -# WOL MAC -# -# enter the mac address of the system to be woken. -#wolmac=00:01:2e:2D:64:e1 - -# Set the Host and Port of a server to verify system has woken. -#wolhost=192.168.1.37 -#wolport=80 - -### NZBGET POST-PROCESSING SCRIPT ### -############################################################################## import sys diff --git a/nzbToGamez.py b/nzbToGamez.py index 8b846c55..31a3512c 100755 --- a/nzbToGamez.py +++ b/nzbToGamez.py @@ -1,104 +1,5 @@ #!/usr/bin/env python2 # coding=utf-8 -# -############################################################################## -### NZBGET POST-PROCESSING SCRIPT ### - -# Post-Process to CouchPotato, SickBeard, NzbDrone, Mylar, Gamez, HeadPhones. -# -# This script sends the download to your automated media management servers. -# -# NOTE: This script requires Python to be installed on your system. - -############################################################################## -# -### OPTIONS ### - -## General - -# Auto Update nzbToMedia (0, 1). -# -# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version -#auto_update=0 - -# Safe Mode protection of DestDir (0, 1). -# -# Enable/Disable a safety check to ensure we don't process all downloads in the default_downloadDirectory by mistake. -#safe_mode=1 - -## Gamez - -# Gamez script category. -# -# category that gets called for post-processing with Gamez. -#gzCategory=games - -# Gamez api key. -#gzapikey= - -# Gamez host. -# -# The ipaddress for your Gamez server. e.g For the Same system use localhost or 127.0.0.1 -#gzhost=localhost - -# Gamez port. -#gzport=8085 - -# Gamez uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#gzssl=0 - -# Gamez library -# -# move downloaded games here. -#gzlibrary - -# Gamez web_root -# -# set this if using a reverse proxy. -#gzweb_root= - -# Gamez watch directory. -# -# set this to where your Gamez completed downloads are. -#gzwatch_dir= - -## Posix - -# Niceness for external tasks Extractor and Transcoder. -# -# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). -#niceness=10 - -# ionice scheduling class (0, 1, 2, 3). -# -# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. -#ionice_class=2 - -# ionice scheduling class data. -# -# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data. -#ionice_classdata=4 - -## WakeOnLan - -# use WOL (0, 1). -# -# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified. -#wolwake=0 - -# WOL MAC -# -# enter the mac address of the system to be woken. -#wolmac=00:01:2e:2D:64:e1 - -# Set the Host and Port of a server to verify system has woken. -#wolhost=192.168.1.37 -#wolport=80 - -### NZBGET POST-PROCESSING SCRIPT ### -############################################################################## import sys diff --git a/nzbToHeadPhones.py b/nzbToHeadPhones.py index 7ecdf701..0d85cdf4 100755 --- a/nzbToHeadPhones.py +++ b/nzbToHeadPhones.py @@ -1,126 +1,5 @@ #!/usr/bin/env python2 # coding=utf-8 -# -############################################################################## -### NZBGET POST-PROCESSING SCRIPT ### - -# Post-Process to HeadPhones. -# -# This script sends the download to your automated media management servers. -# -# NOTE: This script requires Python to be installed on your system. - -############################################################################## -### OPTIONS - -## General - -# Auto Update nzbToMedia (0, 1). -# -# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version -#auto_update=0 - -# Safe Mode protection of DestDir (0, 1). -# -# Enable/Disable a safety check to ensure we don't process all downloads in the default_downloadDirectory by mistake. -#safe_mode=1 - -# Disable additional extraction checks for failed (0, 1). -# -# Turn this on to disable additional extraction attempts for failed downloads. Default = 0 this will attempt to extract and verify if media is present. -#no_extract_failed = 0 - -## HeadPhones - -# HeadPhones script category. -# -# category that gets called for post-processing with HeadHones. -#hpCategory=music - -# HeadPhones api key. -#hpapikey= - -# HeadPhones host. -# -# The ipaddress for your HeadPhones server. e.g For the Same system use localhost or 127.0.0.1 -#hphost=localhost - -# HeadPhones port. -#hpport=8181 - -# HeadPhones uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#hpssl=0 - -# HeadPhones web_root -# -# set this if using a reverse proxy. -#hpweb_root= - -# HeadPhones Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#hpdelete_failed=0 - -# HeadPhones watch directory. -# -# set this to where your HeadPhones completed downloads are. -#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 - -# HeadPhones and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#hpremote_path=0 - -## Posix - -# Niceness for external tasks Extractor and Transcoder. -# -# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). -#niceness=10 - -# ionice scheduling class (0, 1, 2, 3). -# -# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. -#ionice_class=2 - -# ionice scheduling class data. -# -# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data. -#ionice_classdata=4 - -## Network - -# Network Mount Points (Needed for remote path above) -# -# Enter Mount points as LocalPath,RemotePath and separate each pair with '|' -# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\ -#mountPoints= - -## WakeOnLan - -# use WOL (0, 1). -# -# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified. -#wolwake=0 - -# WOL MAC -# -# enter the mac address of the system to be woken. -#wolmac=00:01:2e:2D:64:e1 - -# Set the Host and Port of a server to verify system has woken. -#wolhost=192.168.1.37 -#wolport=80 - -### NZBGET POST-PROCESSING SCRIPT ### -############################################################################## import sys diff --git a/nzbToLidarr.py b/nzbToLidarr.py index b9d1bf10..8567e658 100755 --- a/nzbToLidarr.py +++ b/nzbToLidarr.py @@ -1,241 +1,5 @@ #!/usr/bin/env python2 # coding=utf-8 -# -############################################################################## -### NZBGET POST-PROCESSING SCRIPT ### - -# Post-Process to Lidarr. -# -# This script sends the download to your automated media management servers. -# -# NOTE: This script requires Python to be installed on your system. - -############################################################################## -### OPTIONS ### - -## General - -# Auto Update nzbToMedia (0, 1). -# -# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version -#auto_update=0 - -# Check Media for corruption (0, 1). -# -# Enable/Disable media file checking using ffprobe. -#check_media=1 - -# Safe Mode protection of DestDir (0, 1). -# -# Enable/Disable a safety check to ensure we don't process all downloads in the default_downloadDirectory by mistake. -#safe_mode=1 - -# Disable additional extraction checks for failed (0, 1). -# -# Turn this on to disable additional extraction attempts for failed downloads. Default = 0 this will attempt to extract and verify if media is present. -#no_extract_failed = 0 - -## Lidarr - -# Lidarr script category. -# -# category that gets called for post-processing with NzbDrone. -#liCategory=music2 - -# Lidarr host. -# -# The ipaddress for your Lidarr server. e.g For the Same system use localhost or 127.0.0.1 -#lihost=localhost - -# Lidarr port. -#liport=8686 - -# Lidarr API key. -#liapikey= - -# Lidarr uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#lissl=0 - -# Lidarr web_root -# -# set this if using a reverse proxy. -#liweb_root= - -# Lidarr wait_for -# -# Set the number of minutes to wait after calling the renamer, to check the episode has changed status. -#liwait_for=6 - -# Lidarr Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#lidelete_failed=0 - -# Lidarr and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#liremote_path=0 - -## Network - -# Network Mount Points (Needed for remote path above) -# -# Enter Mount points as LocalPath,RemotePath and separate each pair with '|' -# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\ -#mountPoints= - -## Extensions - -# Media Extensions -# -# This is a list of media extensions that are used to verify that the download does contain valid media. -#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso,.ts - -## Posix - -# Niceness for external tasks Extractor and Transcoder. -# -# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). -#niceness=10 - -# ionice scheduling class (0, 1, 2, 3). -# -# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. -#ionice_class=2 - -# ionice scheduling class data. -# -# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data. -#ionice_classdata=4 - -## Transcoder - -# getSubs (0, 1). -# -# set to 1 to download subtitles. -#getSubs = 0 - -# subLanguages. -# -# subLanguages. create a list of languages in the order you want them in your subtitles. -#subLanguages = eng,spa,fra - -# Transcode (0, 1). -# -# set to 1 to transcode, otherwise set to 0. -#transcode=0 - -# create a duplicate, or replace the original (0, 1). -# -# set to 1 to cretae a new file or 0 to replace the original -#duplicate=1 - -# ignore extensions. -# -# list of extensions that won't be transcoded. -#ignoreExtensions=.avi,.mkv - -# outputFastStart (0,1). -# -# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used. -#outputFastStart = 0 - -# outputVideoPath. -# -# outputVideoPath. Set path you want transcoded videos moved to. Leave blank to disable. -#outputVideoPath = - -# processOutput (0,1). -# -# processOutput. 1 will send the outputVideoPath to SickBeard/CouchPotato. 0 will send original files. -#processOutput = 0 - -# audioLanguage. -# -# audioLanguage. set the 3 letter language code you want as your primary audio track. -#audioLanguage = eng - -# allAudioLanguages (0,1). -# -# allAudioLanguages. 1 will keep all audio tracks (uses AudioCodec3) where available. -#allAudioLanguages = 0 - -# allSubLanguages (0,1). -# -# allSubLanguages. 1 will keep all exisiting sub languages. 0 will discare those not in your list above. -#allSubLanguages = 0 - -# embedSubs (0,1). -# -# embedSubs. 1 will embded external sub/srt subs into your video if this is supported. -#embedSubs = 1 - -# burnInSubtitle (0,1). -# -# burnInSubtitle. burns the default sub language into your video (needed for players that don't support subs) -#burnInSubtitle = 0 - -# extractSubs (0,1). -# -# extractSubs. 1 will extract subs from the video file and save these as external srt files. -#extractSubs = 0 - -# externalSubDir. -# -# externalSubDir. set the directory where subs should be saved (if not the same directory as the video) -#externalSubDir = - -# outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p, mkv, mp4-scene-release, MKV-SD). -# -# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. -# If you want to use your own profile, set None and set the remaining options below. -#outputDefault = None - -# hwAccel (0,1). -# -# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg). -#hwAccel=0 - -# ffmpeg output settings. -#outputVideoExtension=.mp4 -#outputVideoCodec=libx264 -#VideoCodecAllow = -#outputVideoResolution=720:-1 -#outputVideoPreset=medium -#outputVideoFramerate=24 -#outputVideoBitrate=800k -#outputAudioCodec=libmp3lame -#AudioCodecAllow = -#outputAudioBitrate=128k -#outputQualityPercent = 0 -#outputAudioTrack2Codec = libfaac -#AudioCodec2Allow = -#outputAudioTrack2Bitrate = 128k -#outputAudioOtherCodec = libmp3lame -#AudioOtherCodecAllow = -#outputAudioOtherBitrate = 128k -#outputSubtitleCodec = - -## WakeOnLan - -# use WOL (0, 1). -# -# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified. -#wolwake=0 - -# WOL MAC -# -# enter the mac address of the system to be woken. -#wolmac=00:01:2e:2D:64:e1 - -# Set the Host and Port of a server to verify system has woken. -#wolhost=192.168.1.37 -#wolport=80 - -### NZBGET POST-PROCESSING SCRIPT ### -############################################################################## import sys diff --git a/nzbToMedia.py b/nzbToMedia.py index d3b09e7f..cfda2f0b 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -1,625 +1,5 @@ #!/usr/bin/env python2 # coding=utf-8 -# -############################################################################## -### NZBGET POST-PROCESSING SCRIPT ### - -# Post-Process to CouchPotato, SickBeard, NzbDrone, Mylar, Gamez, HeadPhones. -# -# This script sends the download to your automated media management servers. -# -# NOTE: This script requires Python to be installed on your system. - -############################################################################## -### OPTIONS ### - -## General - -# Auto Update nzbToMedia (0, 1). -# -# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version -#auto_update=0 - -# Check Media for corruption (0, 1). -# -# Enable/Disable media file checking using ffprobe. -#check_media=1 - -# Safe Mode protection of DestDir (0, 1). -# -# Enable/Disable a safety check to ensure we don't process all downloads in the default_downloadDirectory by mistake. -#safe_mode=1 - -# Disable additional extraction checks for failed (0, 1). -# -# Turn this on to disable additional extraction attempts for failed downloads. Default = 0 this will attempt to extract and verify if media is present. -#no_extract_failed = 0 - -## CouchPotato - -# CouchPotato script category. -# -# category that gets called for post-processing with CouchPotatoServer. -#cpsCategory=movie - -# CouchPotato api key. -#cpsapikey= - -# CouchPotato host. -# -# The ipaddress for your CouchPotato server. e.g For the Same system use localhost or 127.0.0.1 -#cpshost=localhost - -# CouchPotato port. -#cpsport=5050 - -# CouchPotato uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#cpsssl=0 - -# CouchPotato URL_Base -# -# set this if using a reverse proxy. -#cpsweb_root= - -# CouchPotato Postprocess Method (renamer, manage). -# -# use "renamer" for CPS renamer (default) or "manage" to call a manage update. -#cpsmethod=renamer - -# CouchPotato OMDB API Key. -# -# api key for www.omdbapi.com (used as alternative to imdb to assist with movie identification). -#cpsomdbapikey= - -# CouchPotato Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#cpsdelete_failed=0 - -# CouchPotato wait_for -# -# Set the number of minutes to wait after calling the renamer, to check the movie has changed status. -#cpswait_for=2 - -# Couchpotato and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#cpsremote_path=0 - -## Radarr - -# Radarr script category. -# -# category that gets called for post-processing with NzbDrone. -#raCategory=movies2 - -# Radarr host. -# -# The ipaddress for your Radarr server. e.g For the Same system use localhost or 127.0.0.1 -#rahost=localhost - -# Radarr port. -#raport=7878 - -# Radarr API key. -#raapikey= - -# Radarr uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#rassl=0 - -# Radarr web_root -# -# set this if using a reverse proxy. -#raweb_root= - -# Radarr wait_for -# -# Set the number of minutes to wait after calling the renamer, to check the episode has changed status. -#rawait_for=6 - -# Radarr OMDB API Key. -# -# api key for www.omdbapi.com (used as alternative to imdb to assist with movie identification). -#raomdbapikey= - -# Radarr import mode (Move, Copy). -# -# set to define import behaviour Move or Copy -#raimportmode=Copy - -# Radarr Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#radelete_failed=0 - -# Radarr and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#raremote_path=0 - -## SickBeard - -# SickBeard script category. -# -# category that gets called for post-processing with SickBeard. -#sbCategory=tv - -# SickBeard host. -# -# The ipaddress for your SickBeard/SickRage server. e.g For the Same system use localhost or 127.0.0.1 -#sbhost=localhost - -# SickBeard port. -#sbport=8081 - -# SickBeard api key. For SickChill, Medusa, SiCKRAGE only. -#sbapikey= - -# SickBeard username. -#sbusername= - -# SickBeard password. -#sbpassword= - -# SickBeard uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#sbssl=0 - -# SickBeard web_root -# -# set this if using a reverse proxy. -#sbweb_root= - -# SickBeard watch directory. -# -# set this if SickBeard and nzbGet are on different systems. -#sbwatch_dir= - -# SickBeard fork. -# -# set to default or auto to auto-detect the custom fork type. -#sbfork=auto - -# SickBeard Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#sbdelete_failed=0 - -# SickBeard Ignore associated subtitle check (0, 1). -# -# set to 1 to ignore subtitles check, or 0 to don't check. -#sbignore_subs=0 - -# SickBeard process method. -# -# set this to move, copy, hardlink, symlink as appropriate if you want to over-ride SB defaults. Leave blank to use SB default. -#sbprocess_method= - -# SickBeard and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#sbremote_path=0 - -## NzbDrone - -# NzbDrone script category. -# -# category that gets called for post-processing with NzbDrone. -#ndCategory=tv2 - -# NzbDrone host. -# -# The ipaddress for your NzbDrone/Sonarr server. e.g For the Same system use localhost or 127.0.0.1 -#ndhost=localhost - -# NzbDrone port. -#ndport=8989 - -# NzbDrone API key. -#ndapikey= - -# NzbDrone uses SSL (0, 1). -# -# Set to 1 if using SSL, else set to 0. -#ndssl=0 - -# NzbDrone web root. -# -# set this if using a reverse proxy. -#ndweb_root= - -# NzbDrone wait_for -# -# Set the number of minutes to wait after calling the renamer, to check the episode has changed status. -#ndwait_for=6 - -# NzbDrone import mode (Move, Copy). -# -# set to define import behaviour Move or Copy -#ndimportmode=Copy - -# NzbDrone Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#nddelete_failed=0 - -# NzbDrone and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#ndremote_path=0 - -## HeadPhones - -# HeadPhones script category. -# -# category that gets called for post-processing with HeadHones. -#hpCategory=music - -# HeadPhones api key. -#hpapikey= - -# HeadPhones host. -# -# The ipaddress for your HeadPhones server. e.g For the Same system use localhost or 127.0.0.1 -#hphost=localhost - -# HeadPhones port. -#hpport=8181 - -# HeadPhones uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#hpssl=0 - -# HeadPhones web_root -# -# set this if using a reverse proxy. -#hpweb_root= - -# HeadPhones Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#hpdelete_failed=0 - -# HeadPhones and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#hpremote_path=0 - -## Lidarr - -# Lidarr script category. -# -# category that gets called for post-processing with NzbDrone. -#liCategory=music2 - -# Lidarr host. -# -# The ipaddress for your Lidarr server. e.g For the Same system use localhost or 127.0.0.1 -#lihost=localhost - -# Lidarr port. -#liport=8686 - -# Lidarr API key. -#liapikey= - -# Lidarr uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#lissl=0 - -# Lidarr web_root -# -# set this if using a reverse proxy. -#liweb_root= - -# Lidarr wait_for -# -# Set the number of minutes to wait after calling the renamer, to check the episode has changed status. -#liwait_for=6 - -# Lidarr Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#lidelete_failed=0 - -# Lidarr and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#liremote_path=0 - -## Mylar - -# Mylar script category. -# -# category that gets called for post-processing with Mylar. -#myCategory=comics - -# Mylar host. -# -# The ipaddress for your Mylar server. e.g For the Same system use localhost or 127.0.0.1 -#myhost=localhost - -# Mylar port. -#myport=8090 - -# Mylar api key. -#myapikey= - -# Mylar uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#myssl=0 - -# Mylar web_root -# -# set this if using a reverse proxy. -#myweb_root= - -# Mylar wait_for -# -# Set the number of minutes to wait after calling the force process, to check the issue has changed status. -#myswait_for=1 - -# Mylar and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#myremote_path=0 - -## Gamez - -# Gamez script category. -# -# category that gets called for post-processing with Gamez. -#gzCategory=games - -# Gamez api key. -#gzapikey= - -# Gamez host. -# -# The ipaddress for your Gamez server. e.g For the Same system use localhost or 127.0.0.1 -#gzhost=localhost - -# Gamez port. -#gzport=8085 - -# Gamez uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#gzssl=0 - -# Gamez library -# -# move downloaded games here. -#gzlibrary - -# Gamez web_root -# -# set this if using a reverse proxy. -#gzweb_root= - -# Gamez and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#gzremote_path=0 - -## Network - -# Network Mount Points (Needed for remote path above) -# -# Enter Mount points as LocalPath,RemotePath and separate each pair with '|' -# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\ -#mountPoints= - -## Extensions - -# Media Extensions -# -# This is a list of media extensions that are used to verify that the download does contain valid media. -#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso,.ts - -## Posix - -# Niceness for external tasks Extractor and Transcoder. -# -# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). -#niceness=10 - -# ionice scheduling class (0, 1, 2, 3). -# -# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. -#ionice_class=2 - -# ionice scheduling class data. -# -# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data. -#ionice_classdata=4 - -## Transcoder - -# getSubs (0, 1). -# -# set to 1 to download subtitles. -#getSubs=0 - -# subLanguages. -# -# subLanguages. create a list of languages in the order you want them in your subtitles. -#subLanguages=eng,spa,fra - -# Transcode (0, 1). -# -# set to 1 to transcode, otherwise set to 0. -#transcode=0 - -# create a duplicate, or replace the original (0, 1). -# -# set to 1 to cretae a new file or 0 to replace the original -#duplicate=1 - -# ignore extensions. -# -# list of extensions that won't be transcoded. -#ignoreExtensions=.avi,.mkv - -# outputFastStart (0,1). -# -# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used. -#outputFastStart=0 - -# outputVideoPath. -# -# outputVideoPath. Set path you want transcoded videos moved to. Leave blank to disable. -#outputVideoPath= - -# processOutput (0,1). -# -# processOutput. 1 will send the outputVideoPath to SickBeard/CouchPotato. 0 will send original files. -#processOutput=0 - -# audioLanguage. -# -# audioLanguage. set the 3 letter language code you want as your primary audio track. -#audioLanguage=eng - -# allAudioLanguages (0,1). -# -# allAudioLanguages. 1 will keep all audio tracks (uses AudioCodec3) where available. -#allAudioLanguages=0 - -# allSubLanguages (0,1). -# -# allSubLanguages. 1 will keep all exisiting sub languages. 0 will discare those not in your list above. -#allSubLanguages=0 - -# embedSubs (0,1). -# -# embedSubs. 1 will embded external sub/srt subs into your video if this is supported. -#embedSubs=1 - -# burnInSubtitle (0,1). -# -# burnInSubtitle. burns the default sub language into your video (needed for players that don't support subs) -#burnInSubtitle=0 - -# extractSubs (0,1). -# -# extractSubs. 1 will extract subs from the video file and save these as external srt files. -#extractSubs=0 - -# externalSubDir. -# -# externalSubDir. set the directory where subs should be saved (if not the same directory as the video) -#externalSubDir= - -# outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p, mkv, mp4-scene-release). -# -# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. -# If you want to use your own profile, set None and set the remaining options below. -#outputDefault=None - -# hwAccel (0,1). -# -# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg). -#hwAccel=0 - -# ffmpeg output settings. -#outputVideoExtension=.mp4 -#outputVideoCodec=libx264 -#VideoCodecAllow= -#outputVideoResolution=720:-1 -#outputVideoPreset=medium -#outputVideoFramerate=24 -#outputVideoBitrate=800k -#outputAudioCodec=ac3 -#AudioCodecAllow= -#outputAudioChannels=6 -#outputAudioBitrate=640k -#outputQualityPercent= -#outputAudioTrack2Codec=libfaac -#AudioCodec2Allow= -#outputAudioTrack2Channels=2 -#outputAudioTrack2Bitrate=160k -#outputAudioOtherCodec=libmp3lame -#AudioOtherCodecAllow= -#outputAudioOtherChannels=2 -#outputAudioOtherBitrate=128k -#outputSubtitleCodec= - -## WakeOnLan - -# use WOL (0, 1). -# -# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified. -#wolwake=0 - -# WOL MAC -# -# enter the mac address of the system to be woken. -#wolmac=00:01:2e:2D:64:e1 - -# Set the Host and Port of a server to verify system has woken. -#wolhost=192.168.1.37 -#wolport=80 - -## UserScript - -# User Script category. -# -# category that gets called for post-processing with user script (accepts "UNCAT", "ALL", or a defined category). -#usCategory=mine - -# User Script Remote Path (0,1). -# -# Script calls commands on another system. -#usremote_path=0 - -# User Script extensions. -# -# What extension do you want to process? Specify all the extension, or use "ALL" to process all files. -#user_script_mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg - -# User Script Path -# -# Specify the path to your custom script. -#user_script_path=/nzbToMedia/userscripts/script.sh - -# User Script arguments. -# -# Specify the argument(s) passed to script, comma separated in order. -# for example FP,FN,DN, TN, TL for file path (absolute file name with path), file name, absolute directory name (with path), Torrent Name, Torrent Label/Category. -# So the result is /media/test/script/script.sh FP FN DN TN TL. Add other arguments as needed eg -f, -r -#user_script_param=FN - -# User Script Run Once (0,1). -# -# Set user_script_runOnce = 0 to run for each file, or 1 to only run once (presumably on teh entire directory). -#user_script_runOnce=0 - -# User Script Success Codes. -# -# Specify the successcodes returned by the user script as a comma separated list. Linux default is 0 -#user_script_successCodes=0 - -# User Script Clean After (0,1). -# -# Clean after? Note that delay function is used to prevent possible mistake :) Delay is intended as seconds -#user_script_clean=1 - -# User Script Delay. -# -# Delay in seconds after processing. -#usdelay=120 - -### NZBGET POST-PROCESSING SCRIPT ### -############################################################################## from __future__ import print_function @@ -664,17 +44,18 @@ def process(input_directory, input_name=None, status=0, client_agent='manual', d try: encoded, input_directory1 = char_replace(input_directory) encoded, input_name1 = char_replace(input_name) - except: + except Exception: pass control_value_dict = {"input_directory": text_type(input_directory1)} - new_value_dict = {"input_name": text_type(input_name1), - "input_hash": text_type(download_id), - "input_id": text_type(download_id), - "client_agent": text_type(client_agent), - "status": 0, - "last_update": datetime.date.today().toordinal() - } + new_value_dict = { + "input_name": text_type(input_name1), + "input_hash": text_type(download_id), + "input_id": text_type(download_id), + "client_agent": text_type(client_agent), + "status": 0, + "last_update": datetime.date.today().toordinal(), + } my_db.upsert("downloads", new_value_dict, control_value_dict) # auto-detect section @@ -715,7 +96,7 @@ def process(input_directory, input_name=None, status=0, client_agent='manual', d logger.error('Remote Path is enabled for {0}:{1} but no Network mount points are defined. Please check your autoProcessMedia.cfg, exiting!'.format( section_name, input_category)) return [-1, ""] - except: + except Exception: logger.error('Remote Path {0} is not valid for {1}:{2} Please set this to either 0 to disable or 1 to enable!'.format( core.get("remote_path"), section_name, input_category)) diff --git a/nzbToMylar.py b/nzbToMylar.py index 7440bfdf..57628cdc 100755 --- a/nzbToMylar.py +++ b/nzbToMylar.py @@ -1,117 +1,5 @@ #!/usr/bin/env python2 # coding=utf-8 -# -############################################################################## -### NZBGET POST-PROCESSING SCRIPT ### - -# Post-Process to Mylar. -# -# This script sends the download to your automated media management servers. -# -# NOTE: This script requires Python to be installed on your system. - -############################################################################## -# -### OPTIONS - -## General - -# Auto Update nzbToMedia (0, 1). -# -# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version -#auto_update=0 - -# Safe Mode protection of DestDir (0, 1). -# -# Enable/Disable a safety check to ensure we don't process all downloads in the default_downloadDirectory by mistake. -#safe_mode=1 - -## Mylar - -# Mylar script category. -# -# category that gets called for post-processing with Mylar. -#myCategory=comics - -# Mylar host. -# -# The ipaddress for your Mylar server. e.g For the Same system use localhost or 127.0.0.1 -#myhost=localhost - -# Mylar port. -#myport=8090 - -# Mylar api key. -#myapikey= - -# Mylar uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#myssl=0 - -# Mylar web_root -# -# set this if using a reverse proxy. -#myweb_root= - -# Mylar wait_for -# -# Set the number of minutes to wait after calling the force process, to check the issue has changed status. -#myswait_for=1 - -# Mylar watch directory. -# -# set this to where your Mylar completed downloads are. -#mywatch_dir= - -# Mylar and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#myremote_path=0 - -## Posix - -# Niceness for external tasks Extractor and Transcoder. -# -# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). -#niceness=10 - -# ionice scheduling class (0, 1, 2, 3). -# -# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. -#ionice_class=2 - -# ionice scheduling class data. -# -# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data. -#ionice_classdata=4 - -## Network - -# Network Mount Points (Needed for remote path above) -# -# Enter Mount points as LocalPath,RemotePath and separate each pair with '|' -# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\ -#mountPoints= - -## WakeOnLan - -# use WOL (0, 1). -# -# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified. -#wolwake=0 - -# WOL MAC -# -# enter the mac address of the system to be woken. -#wolmac=00:01:2e:2D:64:e1 - -# Set the Host and Port of a server to verify system has woken. -#wolhost=192.168.1.37 -#wolport=80 - -### NZBGET POST-PROCESSING SCRIPT ### -############################################################################## import sys diff --git a/nzbToNzbDrone.py b/nzbToNzbDrone.py index 78116c71..e300c764 100755 --- a/nzbToNzbDrone.py +++ b/nzbToNzbDrone.py @@ -1,246 +1,5 @@ #!/usr/bin/env python2 # coding=utf-8 -# -############################################################################## -### NZBGET POST-PROCESSING SCRIPT ### - -# Post-Process to NzbDrone/Sonarr. -# -# This script sends the download to your automated media management servers. -# -# NOTE: This script requires Python to be installed on your system. - -############################################################################## -### OPTIONS ### - -## General - -# Auto Update nzbToMedia (0, 1). -# -# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version -#auto_update=0 - -# Check Media for corruption (0, 1). -# -# Enable/Disable media file checking using ffprobe. -#check_media=1 - -# Safe Mode protection of DestDir (0, 1). -# -# Enable/Disable a safety check to ensure we don't process all downloads in the default_downloadDirectory by mistake. -#safe_mode=1 - -# Disable additional extraction checks for failed (0, 1). -# -# Turn this on to disable additional extraction attempts for failed downloads. Default = 0 this will attempt to extract and verify if media is present. -#no_extract_failed = 0 - -## NzbDrone - -# NzbDrone script category. -# -# category that gets called for post-processing with NzbDrone. -#ndCategory=tv2 - -# NzbDrone host. -# -# The ipaddress for your NzbDrone/Sonarr server. e.g For the Same system use localhost or 127.0.0.1 -#ndhost=localhost - -# NzbDrone port. -#ndport=8989 - -# NzbDrone API key. -#ndapikey= - -# NzbDrone uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#ndssl=0 - -# NzbDrone web_root -# -# set this if using a reverse proxy. -#ndweb_root= - -# NzbDrone wait_for -# -# Set the number of minutes to wait after calling the renamer, to check the episode has changed status. -#ndwait_for=6 - -# NzbDrone import mode (Move, Copy). -# -# set to define import behaviour Move or Copy -#ndimportmode=Copy - -# NzbDrone Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#nddelete_failed=0 - -# NzbDrone and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#ndremote_path=0 - -## Network - -# Network Mount Points (Needed for remote path above) -# -# Enter Mount points as LocalPath,RemotePath and separate each pair with '|' -# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\ -#mountPoints= - -## Extensions - -# Media Extensions -# -# This is a list of media extensions that are used to verify that the download does contain valid media. -#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso,.ts - -## Posix - -# Niceness for external tasks Extractor and Transcoder. -# -# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). -#niceness=10 - -# ionice scheduling class (0, 1, 2, 3). -# -# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. -#ionice_class=2 - -# ionice scheduling class data. -# -# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data. -#ionice_classdata=4 - -## Transcoder - -# getSubs (0, 1). -# -# set to 1 to download subtitles. -#getSubs = 0 - -# subLanguages. -# -# subLanguages. create a list of languages in the order you want them in your subtitles. -#subLanguages = eng,spa,fra - -# Transcode (0, 1). -# -# set to 1 to transcode, otherwise set to 0. -#transcode=0 - -# create a duplicate, or replace the original (0, 1). -# -# set to 1 to cretae a new file or 0 to replace the original -#duplicate=1 - -# ignore extensions. -# -# list of extensions that won't be transcoded. -#ignoreExtensions=.avi,.mkv - -# outputFastStart (0,1). -# -# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used. -#outputFastStart = 0 - -# outputVideoPath. -# -# outputVideoPath. Set path you want transcoded videos moved to. Leave blank to disable. -#outputVideoPath = - -# processOutput (0,1). -# -# processOutput. 1 will send the outputVideoPath to SickBeard/CouchPotato. 0 will send original files. -#processOutput = 0 - -# audioLanguage. -# -# audioLanguage. set the 3 letter language code you want as your primary audio track. -#audioLanguage = eng - -# allAudioLanguages (0,1). -# -# allAudioLanguages. 1 will keep all audio tracks (uses AudioCodec3) where available. -#allAudioLanguages = 0 - -# allSubLanguages (0,1). -# -# allSubLanguages. 1 will keep all exisiting sub languages. 0 will discare those not in your list above. -#allSubLanguages = 0 - -# embedSubs (0,1). -# -# embedSubs. 1 will embded external sub/srt subs into your video if this is supported. -#embedSubs = 1 - -# burnInSubtitle (0,1). -# -# burnInSubtitle. burns the default sub language into your video (needed for players that don't support subs) -#burnInSubtitle = 0 - -# extractSubs (0,1). -# -# extractSubs. 1 will extract subs from the video file and save these as external srt files. -#extractSubs = 0 - -# externalSubDir. -# -# externalSubDir. set the directory where subs should be saved (if not the same directory as the video) -#externalSubDir = - -# outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p, mkv, mp4-scene-release, MKV-SD). -# -# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. -# If you want to use your own profile, set None and set the remaining options below. -#outputDefault = None - -# hwAccel (0,1). -# -# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg). -#hwAccel=0 - -# ffmpeg output settings. -#outputVideoExtension=.mp4 -#outputVideoCodec=libx264 -#VideoCodecAllow = -#outputVideoResolution=720:-1 -#outputVideoPreset=medium -#outputVideoFramerate=24 -#outputVideoBitrate=800k -#outputAudioCodec=libmp3lame -#AudioCodecAllow = -#outputAudioBitrate=128k -#outputQualityPercent = 0 -#outputAudioTrack2Codec = libfaac -#AudioCodec2Allow = -#outputAudioTrack2Bitrate = 128k -#outputAudioOtherCodec = libmp3lame -#AudioOtherCodecAllow = -#outputAudioOtherBitrate = 128k -#outputSubtitleCodec = - -## WakeOnLan - -# use WOL (0, 1). -# -# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified. -#wolwake=0 - -# WOL MAC -# -# enter the mac address of the system to be woken. -#wolmac=00:01:2e:2D:64:e1 - -# Set the Host and Port of a server to verify system has woken. -#wolhost=192.168.1.37 -#wolport=80 - -### NZBGET POST-PROCESSING SCRIPT ### -############################################################################## import sys diff --git a/nzbToRadarr.py b/nzbToRadarr.py index f9d2e5da..d3c86006 100755 --- a/nzbToRadarr.py +++ b/nzbToRadarr.py @@ -1,251 +1,5 @@ #!/usr/bin/env python2 # coding=utf-8 -# -############################################################################## -### NZBGET POST-PROCESSING SCRIPT ### - -# Post-Process to Radarr. -# -# This script sends the download to your automated media management servers. -# -# NOTE: This script requires Python to be installed on your system. - -############################################################################## -### OPTIONS ### - -## General - -# Auto Update nzbToMedia (0, 1). -# -# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version -#auto_update=0 - -# Check Media for corruption (0, 1). -# -# Enable/Disable media file checking using ffprobe. -#check_media=1 - -# Safe Mode protection of DestDir (0, 1). -# -# Enable/Disable a safety check to ensure we don't process all downloads in the default_downloadDirectory by mistake. -#safe_mode=1 - -# Disable additional extraction checks for failed (0, 1). -# -# Turn this on to disable additional extraction attempts for failed downloads. Default = 0 this will attempt to extract and verify if media is present. -#no_extract_failed = 0 - -## Radarr - -# Radarr script category. -# -# category that gets called for post-processing with NzbDrone. -#raCategory=movies2 - -# Radarr host. -# -# The ipaddress for your Radarr server. e.g For the Same system use localhost or 127.0.0.1 -#rahost=localhost - -# Radarr port. -#raport=7878 - -# Radarr API key. -#raapikey= - -# Radarr uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#rassl=0 - -# Radarr web_root -# -# set this if using a reverse proxy. -#raweb_root= - -# Radarr OMDB API Key. -# -# api key for www.omdbapi.com (used as alternative to imdb to assist with movie identification). -#raomdbapikey= - -# Radarr wait_for -# -# Set the number of minutes to wait after calling the renamer, to check the episode has changed status. -#rawait_for=6 - -# Radarr import mode (Move, Copy). -# -# set to define import behaviour Move or Copy -#raimportmode=Copy - -# Radarr Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#radelete_failed=0 - -# Radarr and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#raremote_path=0 - -## Network - -# Network Mount Points (Needed for remote path above) -# -# Enter Mount points as LocalPath,RemotePath and separate each pair with '|' -# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\ -#mountPoints= - -## Extensions - -# Media Extensions -# -# This is a list of media extensions that are used to verify that the download does contain valid media. -#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso,.ts - -## Posix - -# Niceness for external tasks Extractor and Transcoder. -# -# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). -#niceness=10 - -# ionice scheduling class (0, 1, 2, 3). -# -# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. -#ionice_class=2 - -# ionice scheduling class data. -# -# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data. -#ionice_classdata=4 - -## Transcoder - -# getSubs (0, 1). -# -# set to 1 to download subtitles. -#getSubs = 0 - -# subLanguages. -# -# subLanguages. create a list of languages in the order you want them in your subtitles. -#subLanguages = eng,spa,fra - -# Transcode (0, 1). -# -# set to 1 to transcode, otherwise set to 0. -#transcode=0 - -# create a duplicate, or replace the original (0, 1). -# -# set to 1 to cretae a new file or 0 to replace the original -#duplicate=1 - -# ignore extensions. -# -# list of extensions that won't be transcoded. -#ignoreExtensions=.avi,.mkv - -# outputFastStart (0,1). -# -# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used. -#outputFastStart = 0 - -# outputVideoPath. -# -# outputVideoPath. Set path you want transcoded videos moved to. Leave blank to disable. -#outputVideoPath = - -# processOutput (0,1). -# -# processOutput. 1 will send the outputVideoPath to SickBeard/CouchPotato. 0 will send original files. -#processOutput = 0 - -# audioLanguage. -# -# audioLanguage. set the 3 letter language code you want as your primary audio track. -#audioLanguage = eng - -# allAudioLanguages (0,1). -# -# allAudioLanguages. 1 will keep all audio tracks (uses AudioCodec3) where available. -#allAudioLanguages = 0 - -# allSubLanguages (0,1). -# -# allSubLanguages. 1 will keep all exisiting sub languages. 0 will discare those not in your list above. -#allSubLanguages = 0 - -# embedSubs (0,1). -# -# embedSubs. 1 will embded external sub/srt subs into your video if this is supported. -#embedSubs = 1 - -# burnInSubtitle (0,1). -# -# burnInSubtitle. burns the default sub language into your video (needed for players that don't support subs) -#burnInSubtitle = 0 - -# extractSubs (0,1). -# -# extractSubs. 1 will extract subs from the video file and save these as external srt files. -#extractSubs = 0 - -# externalSubDir. -# -# externalSubDir. set the directory where subs should be saved (if not the same directory as the video) -#externalSubDir = - -# outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p, mkv, mp4-scene-release, MKV-SD). -# -# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. -# If you want to use your own profile, set None and set the remaining options below. -#outputDefault = None - -# hwAccel (0,1). -# -# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg). -#hwAccel=0 - -# ffmpeg output settings. -#outputVideoExtension=.mp4 -#outputVideoCodec=libx264 -#VideoCodecAllow = -#outputVideoResolution=720:-1 -#outputVideoPreset=medium -#outputVideoFramerate=24 -#outputVideoBitrate=800k -#outputAudioCodec=libmp3lame -#AudioCodecAllow = -#outputAudioBitrate=128k -#outputQualityPercent = 0 -#outputAudioTrack2Codec = libfaac -#AudioCodec2Allow = -#outputAudioTrack2Bitrate = 128k -#outputAudioOtherCodec = libmp3lame -#AudioOtherCodecAllow = -#outputAudioOtherBitrate = 128k -#outputSubtitleCodec = - -## WakeOnLan - -# use WOL (0, 1). -# -# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified. -#wolwake=0 - -# WOL MAC -# -# enter the mac address of the system to be woken. -#wolmac=00:01:2e:2D:64:e1 - -# Set the Host and Port of a server to verify system has woken. -#wolhost=192.168.1.37 -#wolport=80 - -### NZBGET POST-PROCESSING SCRIPT ### -############################################################################## import sys diff --git a/nzbToSickBeard.py b/nzbToSickBeard.py index e9b25ad2..294b6c69 100755 --- a/nzbToSickBeard.py +++ b/nzbToSickBeard.py @@ -1,260 +1,5 @@ #!/usr/bin/env python2 # coding=utf-8 -# -############################################################################## -### NZBGET POST-PROCESSING SCRIPT ### - -# Post-Process to SickBeard. -# -# This script sends the download to your automated media management servers. -# -# NOTE: This script requires Python to be installed on your system. - -############################################################################## -### OPTIONS ### - -## General - -# Auto Update nzbToMedia (0, 1). -# -# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version -#auto_update=0 - -# Check Media for corruption (0, 1). -# -# Enable/Disable media file checking using ffprobe. -#check_media=1 - -# Safe Mode protection of DestDir (0, 1). -# -# Enable/Disable a safety check to ensure we don't process all downloads in the default_downloadDirectory by mistake. -#safe_mode=1 - -# Disable additional extraction checks for failed (0, 1). -# -# Turn this on to disable additional extraction attempts for failed downloads. Default = 0 this will attempt to extract and verify if media is present. -#no_extract_failed = 0 - -## SickBeard - -# SickBeard script category. -# -# category that gets called for post-processing with SickBeard. -#sbCategory=tv - -# SickBeard host. -# -# The ipaddress for your SickBeard/SickRage server. e.g For the Same system use localhost or 127.0.0.1 -#sbhost=localhost - -# SickBeard port. -#sbport=8081 - -# SickBeard api key. For SickChill, Medusa, SiCKRAGE only. -#sbapikey= - -# SickBeard username. -#sbusername= - -# SickBeard password. -#sbpassword= - -# SickBeard uses ssl (0, 1). -# -# Set to 1 if using ssl, else set to 0. -#sbssl=0 - -# SickBeard web_root -# -# set this if using a reverse proxy. -#sbweb_root= - -# SickBeard watch directory. -# -# set this to where your SickBeard completed downloads are. -#sbwatch_dir= - -# SickBeard fork. -# -# set to default or auto to auto-detect the custom fork type. -#sbfork=auto - -# SickBeard Delete Failed Downloads (0, 1). -# -# set to 1 to delete failed, or 0 to leave files in place. -#sbdelete_failed=0 - -# SickBeard process method. -# -# set this to move, copy, hardlink, symlink as appropriate if you want to over-ride SB defaults. Leave blank to use SB default. -#sbprocess_method= - -# SickBeard and NZBGet are a different system (0, 1). -# -# Enable to replace local path with the path as per the mountPoints below. -#sbremote_path=0 - -## Network - -# Network Mount Points (Needed for remote path above) -# -# Enter Mount points as LocalPath,RemotePath and separate each pair with '|' -# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\ -#mountPoints= - -## Extensions - -# Media Extensions -# -# This is a list of media extensions that are used to verify that the download does contain valid media. -#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso,.ts - -## Posix - -# Niceness for external tasks Extractor and Transcoder. -# -# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). -#niceness=10 - -# ionice scheduling class (0, 1, 2, 3). -# -# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle. -#ionice_class=2 - -# ionice scheduling class data. -# -# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data. -#ionice_classdata=4 - -## Transcoder - -# getSubs (0, 1). -# -# set to 1 to download subtitles. -#getSubs=0 - -# subLanguages. -# -# subLanguages. create a list of languages in the order you want them in your subtitles. -#subLanguages=eng,spa,fra - -# Transcode (0, 1). -# -# set to 1 to transcode, otherwise set to 0. -#transcode=0 - -# create a duplicate, or replace the original (0, 1). -# -# set to 1 to cretae a new file or 0 to replace the original -#duplicate=1 - -# ignore extensions. -# -# list of extensions that won't be transcoded. -#ignoreExtensions=.avi,.mkv - -# outputFastStart (0,1). -# -# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used. -#outputFastStart=0 - -# outputVideoPath. -# -# outputVideoPath. Set path you want transcoded videos moved to. Leave blank to disable. -#outputVideoPath= - -# processOutput (0,1). -# -# processOutput. 1 will send the outputVideoPath to SickBeard/CouchPotato. 0 will send original files. -#processOutput=0 - -# audioLanguage. -# -# audioLanguage. set the 3 letter language code you want as your primary audio track. -#audioLanguage=eng - -# allAudioLanguages (0,1). -# -# allAudioLanguages. 1 will keep all audio tracks (uses AudioCodec3) where available. -#allAudioLanguages=0 - -# allSubLanguages (0,1). -# -# allSubLanguages. 1 will keep all exisiting sub languages. 0 will discare those not in your list above. -#allSubLanguages=0 - -# embedSubs (0,1). -# -# embedSubs. 1 will embded external sub/srt subs into your video if this is supported. -#embedSubs=1 - -# burnInSubtitle (0,1). -# -# burnInSubtitle. burns the default sub language into your video (needed for players that don't support subs) -#burnInSubtitle=0 - -# extractSubs (0,1). -# -# extractSubs. 1 will extract subs from the video file and save these as external srt files. -#extractSubs=0 - -# externalSubDir. -# -# externalSubDir. set the directory where subs should be saved (if not the same directory as the video) -#externalSubDir= - -# outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p, mkv, mp4-scene-release, MKV-SD). -# -# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. -# If you want to use your own profile, set None and set the remaining options below. -#outputDefault=None - -# hwAccel (0,1). -# -# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg). -#hwAccel=0 - -# ffmpeg output settings. -#outputVideoExtension=.mp4 -#outputVideoCodec=libx264 -#VideoCodecAllow= -#outputVideoResolution=720:-1 -#outputVideoPreset=medium -#outputVideoFramerate=24 -#outputVideoBitrate=800k -#outputAudioCodec=ac3 -#AudioCodecAllow= -#outputAudioChannels=6 -#outputAudioBitrate=640k -#outputQualityPercent= -#outputAudioTrack2Codec=libfaac -#AudioCodec2Allow= -#outputAudioTrack2Channels=2 -#outputAudioTrack2Bitrate=160k -#outputAudioOtherCodec=libmp3lame -#AudioOtherCodecAllow= -#outputAudioOtherChannels=2 -#outputAudioOtherBitrate=128k -#outputSubtitleCodec= - -## WakeOnLan - -# use WOL (0, 1). -# -# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified. -#wolwake=0 - -# WOL MAC -# -# enter the mac address of the system to be woken. -#wolmac=00:01:2e:2D:64:e1 - -# Set the Host and Port of a server to verify system has woken. -#wolhost=192.168.1.37 -#wolport=80 - -### NZBGET POST-PROCESSING SCRIPT ### -############################################################################## import sys diff --git a/tests/general.py b/tests/general.py index 8692d430..5552e196 100755 --- a/tests/general.py +++ b/tests/general.py @@ -14,15 +14,15 @@ from core.utils import server_responding # Initialize the config core.initialize() -#label = core.TORRENT_CLASS.core.get_torrent_status("f33a9c4b15cbd9170722d700069af86746817ade", ["label"]).get()['label'] -#print label +# label = core.TORRENT_CLASS.core.get_torrent_status("f33a9c4b15cbd9170722d700069af86746817ade", ["label"]).get()['label'] +# print(label) if transcoder.is_video_good(core.TEST_FILE, 0): print("FFPROBE Works") else: print("FFPROBE FAILED") -test = core.CFG['SickBeard','NzbDrone']['tv'].isenabled() +test = core.CFG['SickBeard', 'NzbDrone']['tv'].isenabled() print(test) section = core.CFG.findsection('tv').isenabled() print(section)