From 850ba6dcea52df4d6027491545bb5a05ed00a002 Mon Sep 17 00:00:00 2001 From: Clinton Hall Date: Thu, 23 Apr 2020 10:07:16 +1200 Subject: [PATCH 1/5] Fix auto detection of forks. #1738 --- core/__init__.py | 8 ++++---- core/auto_process/tv.py | 3 ++- core/forks.py | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/__init__.py b/core/__init__.py index 3cdc3c9b..67e4e52e 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -113,12 +113,12 @@ FORKS = { FORK_FAILED_TORRENT: {'dir': None, 'failed': None, 'process_method': None}, FORK_SICKRAGE: {'proc_dir': None, 'failed': None, 'process_method': None, 'force': None, 'delete_on': None}, FORK_SICKCHILL: {'proc_dir': None, 'failed': None, 'process_method': None, 'force': None, 'delete_on': None, 'force_next': None}, - FORK_SICKCHILL_API: {'path': None, 'failed': None, 'process_method': None, 'force_replace': None, 'return_data': None, 'type': None, 'delete': None, 'force_next': None, 'is_priority': None}, - FORK_SICKBEARD_API: {'path': None, 'failed': None, 'process_method': None, 'force_replace': None, 'return_data': None, 'type': None, 'delete': None, 'force_next': None}, + FORK_SICKCHILL_API: {'path': None, 'failed': None, 'process_method': None, 'force_replace': None, 'return_data': None, 'type': None, 'delete': None, 'force_next': None, 'is_priority': None, 'cmd': 'postprocess'}, + FORK_SICKBEARD_API: {'path': None, 'failed': None, 'process_method': None, 'force_replace': None, 'return_data': None, 'type': None, 'delete': None, 'force_next': None, 'cmd': 'postprocess'}, FORK_MEDUSA: {'proc_dir': None, 'failed': None, 'process_method': None, 'force': None, 'delete_on': None, 'ignore_subs': None}, - FORK_MEDUSA_API: {'path': None, 'failed': None, 'process_method': None, 'force_replace': None, 'return_data': None, 'type': None, 'delete_files': None, 'is_priority': None}, + FORK_MEDUSA_API: {'path': None, 'failed': None, 'process_method': None, 'force_replace': None, 'return_data': None, 'type': None, 'delete_files': None, 'is_priority': None, 'cmd': 'postprocess'}, FORK_SICKGEAR: {'dir': None, 'failed': None, 'process_method': None, 'force': None}, - FORK_SICKGEAR_API: {'path': None, 'process_method': None, 'force_replace': None, 'return_data': None, 'type': None, 'is priority': None}, + FORK_SICKGEAR_API: {'path': None, 'process_method': None, 'force_replace': None, 'return_data': None, 'type': None, 'is priority': None, 'cmd': 'sg.postprocess'}, FORK_STHENO: {'proc_dir': None, 'failed': None, 'process_method': None, 'force': None, 'delete_on': None, 'ignore_subs': None}, } ALL_FORKS = {k: None for k in set(list(itertools.chain.from_iterable([FORKS[x].keys() for x in FORKS.keys()])))} diff --git a/core/auto_process/tv.py b/core/auto_process/tv.py index b6c4f21d..a06a1985 100644 --- a/core/auto_process/tv.py +++ b/core/auto_process/tv.py @@ -200,7 +200,8 @@ def process(section, dir_name, input_name=None, failed=False, client_agent='manu del fork_params['quiet'] if param == 'type': - fork_params[param] = 'manual' + if 'type' in fork_params: # only set if we haven't already deleted for 'failed' above. + fork_params[param] = 'manual' if 'proc_type' in fork_params: del fork_params['proc_type'] diff --git a/core/forks.py b/core/forks.py index b9fe4edd..a6f0512c 100644 --- a/core/forks.py +++ b/core/forks.py @@ -41,6 +41,7 @@ def api_check(r, params, rem_params): optional_parameters = json_data['optionalParameters'].keys() # Find excess parameters excess_parameters = set(params).difference(optional_parameters) + excess_parameters.remove('cmd') # Don't remove cmd from api params logger.debug('Removing excess parameters: {}'.format(sorted(excess_parameters))) rem_params.extend(excess_parameters) return rem_params, True From 7f8397b516acc620e2acdb93f923177be280f51c Mon Sep 17 00:00:00 2001 From: Jelle Breuer Date: Thu, 23 Jul 2020 12:01:50 +0200 Subject: [PATCH 2/5] Added missing ffmpeg settings to nzbToRadarr and nzbToNzbDrone (#1757) --- nzbToNzbDrone.py | 31 +++++++++++++++++-------------- nzbToRadarr.py | 31 +++++++++++++++++-------------- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/nzbToNzbDrone.py b/nzbToNzbDrone.py index b99ed190..1a49233f 100755 --- a/nzbToNzbDrone.py +++ b/nzbToNzbDrone.py @@ -102,8 +102,8 @@ # 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). -# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default). +# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). +# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default). # If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer). #niceness=nice,-n0 @@ -208,22 +208,25 @@ # ffmpeg output settings. #outputVideoExtension=.mp4 #outputVideoCodec=libx264 -#VideoCodecAllow = +#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 = +#outputAudioCodec=ac3 +#AudioCodecAllow= +#outputAudioChannels=6 +#outputAudioBitrate=640k +#outputQualityPercent= +#outputAudioTrack2Codec=libfaac +#AudioCodec2Allow= +#outputAudioTrack2Channels=2 +#outputAudioTrack2Bitrate=160k +#outputAudioOtherCodec=libmp3lame +#AudioOtherCodecAllow= +#outputAudioOtherChannels=2 +#outputAudioOtherBitrate=128k +#outputSubtitleCodec= ## WakeOnLan diff --git a/nzbToRadarr.py b/nzbToRadarr.py index a7e02f93..2c4e1810 100755 --- a/nzbToRadarr.py +++ b/nzbToRadarr.py @@ -107,8 +107,8 @@ # 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). -# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default). +# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process). +# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default). # If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer). #niceness=nice,-n0 @@ -213,22 +213,25 @@ # ffmpeg output settings. #outputVideoExtension=.mp4 #outputVideoCodec=libx264 -#VideoCodecAllow = +#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 = +#outputAudioCodec=ac3 +#AudioCodecAllow= +#outputAudioChannels=6 +#outputAudioBitrate=640k +#outputQualityPercent= +#outputAudioTrack2Codec=libfaac +#AudioCodec2Allow= +#outputAudioTrack2Channels=2 +#outputAudioTrack2Bitrate=160k +#outputAudioOtherCodec=libmp3lame +#AudioOtherCodecAllow= +#outputAudioOtherChannels=2 +#outputAudioOtherBitrate=128k +#outputSubtitleCodec= ## WakeOnLan From f10fa0315955d1ab655ef3c7f977d05ff404f2bb Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sat, 15 Aug 2020 19:24:52 +1200 Subject: [PATCH 3/5] Use params for auto fork. #1765 --- core/forks.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/forks.py b/core/forks.py index a6f0512c..ba44fdae 100644 --- a/core/forks.py +++ b/core/forks.py @@ -112,13 +112,15 @@ def auto_fork(section, input_category): # then in order of most unique parameters. if apikey: - url = '{protocol}{host}:{port}{root}/api/{apikey}/?cmd=sg.postprocess&help=1'.format( + url = '{protocol}{host}:{port}{root}/api/{apikey}/'.format( protocol=protocol, host=host, port=port, root=web_root, apikey=apikey, ) + api_params = {'cmd': 'sg.postprocess', 'help': '1'} else: url = '{protocol}{host}:{port}{root}/home/postprocess/'.format( protocol=protocol, host=host, port=port, root=web_root, ) + api_params = {} # attempting to auto-detect fork try: @@ -131,7 +133,7 @@ def auto_fork(section, input_category): if r.status_code in [401, 403] and r.cookies.get('_xsrf'): login_params['_xsrf'] = r.cookies.get('_xsrf') s.post(login, data=login_params, stream=True, verify=False) - r = s.get(url, auth=(username, password), verify=False) + r = s.get(url, auth=(username, password), params=api_params, verify=False) except requests.ConnectionError: logger.info('Could not connect to {section}:{category} to perform auto-fork detection!'.format (section=section, category=input_category)) @@ -142,11 +144,9 @@ def auto_fork(section, input_category): if found: params['cmd'] = 'sg.postprocess' else: # try different api set for non-SickGear forks. - url = '{protocol}{host}:{port}{root}/api/{apikey}/?cmd=help&subject=postprocess'.format( - protocol=protocol, host=host, port=port, root=web_root, apikey=apikey, - ) + api_params = {'cmd': 'help', 'subject': 'postprocess'} try: - r = s.get(url, auth=(username, password), verify=False) + r = s.get(url, auth=(username, password), params=api_params, verify=False) except requests.ConnectionError: logger.info('Could not connect to {section}:{category} to perform auto-fork detection!'.format (section=section, category=input_category)) From 2dfdc69487f9bfa3c5f3b14b7cc97193f6c3956a Mon Sep 17 00:00:00 2001 From: Clinton Hall Date: Wed, 26 Aug 2020 20:27:38 +1200 Subject: [PATCH 4/5] log error when migrating #850 (#1768) Can't display debug logging until the config is loaded to enable debugging! So log as error to get details of the migration fault. --- core/configuration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/configuration.py b/core/configuration.py index 134c05d5..0a6f0d4b 100644 --- a/core/configuration.py +++ b/core/configuration.py @@ -127,7 +127,7 @@ class ConfigObj(configobj.ConfigObj, Section): shutil.copyfile(core.CONFIG_SPEC_FILE, core.CONFIG_FILE) CFG_OLD = config(core.CONFIG_FILE) except Exception as error: - logger.debug('Error {msg} when copying to .cfg'.format(msg=error)) + logger.error('Error {msg} when copying to .cfg'.format(msg=error)) try: # check for autoProcessMedia.cfg.spec and create if it does not exist @@ -135,7 +135,7 @@ class ConfigObj(configobj.ConfigObj, Section): shutil.copyfile(core.CONFIG_FILE, core.CONFIG_SPEC_FILE) CFG_NEW = config(core.CONFIG_SPEC_FILE) except Exception as error: - logger.debug('Error {msg} when copying to .spec'.format(msg=error)) + logger.error('Error {msg} when copying to .spec'.format(msg=error)) # check for autoProcessMedia.cfg and autoProcessMedia.cfg.spec and if they don't exist return and fail if CFG_NEW is None or CFG_OLD is None: From b3388f959dba931ffadf8bf0c9569f0147992059 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Tue, 8 Sep 2020 10:40:57 +1200 Subject: [PATCH 5/5] update to version 12.1.06 --- .bumpversion.cfg | 2 +- core/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 4a55bc33..579736dd 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 12.1.05 +current_version = 12.1.06 commit = True tag = False diff --git a/core/__init__.py b/core/__init__.py index 67e4e52e..04c9dbf5 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -83,7 +83,7 @@ from core.utils import ( wake_up, ) -__version__ = '12.1.05' +__version__ = '12.1.06' # Client Agents NZB_CLIENTS = ['sabnzbd', 'nzbget', 'manual'] diff --git a/setup.py b/setup.py index 6cb9d5dc..3de2a100 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ def read(*names, **kwargs): setup( name='nzbToMedia', - version='12.1.05', + version='12.1.06', license='GPLv3', description='Efficient on demand post processing', long_description="""