Merge branch 'nightly' into dev

This commit is contained in:
clinton-hall 2020-09-08 10:42:34 +12:00
commit 8c8ea0f6fe
8 changed files with 52 additions and 44 deletions

View file

@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 12.1.05 current_version = 12.1.06
commit = True commit = True
tag = False tag = False

View file

@ -83,7 +83,7 @@ from core.utils import (
wake_up, wake_up,
) )
__version__ = '12.1.05' __version__ = '12.1.06'
# Client Agents # Client Agents
NZB_CLIENTS = ['sabnzbd', 'nzbget', 'manual'] NZB_CLIENTS = ['sabnzbd', 'nzbget', 'manual']
@ -113,12 +113,12 @@ FORKS = {
FORK_FAILED_TORRENT: {'dir': None, 'failed': None, 'process_method': None}, 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_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: {'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_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}, 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: {'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: {'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}, 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()])))} ALL_FORKS = {k: None for k in set(list(itertools.chain.from_iterable([FORKS[x].keys() for x in FORKS.keys()])))}

View file

@ -200,6 +200,7 @@ def process(section, dir_name, input_name=None, failed=False, client_agent='manu
del fork_params['quiet'] del fork_params['quiet']
if param == 'type': if param == 'type':
if 'type' in fork_params: # only set if we haven't already deleted for 'failed' above.
fork_params[param] = 'manual' fork_params[param] = 'manual'
if 'proc_type' in fork_params: if 'proc_type' in fork_params:
del fork_params['proc_type'] del fork_params['proc_type']

View file

@ -127,7 +127,7 @@ class ConfigObj(configobj.ConfigObj, Section):
shutil.copyfile(core.CONFIG_SPEC_FILE, core.CONFIG_FILE) shutil.copyfile(core.CONFIG_SPEC_FILE, core.CONFIG_FILE)
CFG_OLD = config(core.CONFIG_FILE) CFG_OLD = config(core.CONFIG_FILE)
except Exception as error: 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: try:
# check for autoProcessMedia.cfg.spec and create if it does not exist # 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) shutil.copyfile(core.CONFIG_FILE, core.CONFIG_SPEC_FILE)
CFG_NEW = config(core.CONFIG_SPEC_FILE) CFG_NEW = config(core.CONFIG_SPEC_FILE)
except Exception as error: 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 # 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: if CFG_NEW is None or CFG_OLD is None:

View file

@ -41,6 +41,7 @@ def api_check(r, params, rem_params):
optional_parameters = json_data['optionalParameters'].keys() optional_parameters = json_data['optionalParameters'].keys()
# Find excess parameters # Find excess parameters
excess_parameters = set(params).difference(optional_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))) logger.debug('Removing excess parameters: {}'.format(sorted(excess_parameters)))
rem_params.extend(excess_parameters) rem_params.extend(excess_parameters)
return rem_params, True return rem_params, True
@ -111,13 +112,15 @@ def auto_fork(section, input_category):
# then in order of most unique parameters. # then in order of most unique parameters.
if apikey: 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, protocol=protocol, host=host, port=port, root=web_root, apikey=apikey,
) )
api_params = {'cmd': 'sg.postprocess', 'help': '1'}
else: else:
url = '{protocol}{host}:{port}{root}/home/postprocess/'.format( url = '{protocol}{host}:{port}{root}/home/postprocess/'.format(
protocol=protocol, host=host, port=port, root=web_root, protocol=protocol, host=host, port=port, root=web_root,
) )
api_params = {}
# attempting to auto-detect fork # attempting to auto-detect fork
try: try:
@ -130,7 +133,7 @@ def auto_fork(section, input_category):
if r.status_code in [401, 403] and r.cookies.get('_xsrf'): if r.status_code in [401, 403] and r.cookies.get('_xsrf'):
login_params['_xsrf'] = r.cookies.get('_xsrf') login_params['_xsrf'] = r.cookies.get('_xsrf')
s.post(login, data=login_params, stream=True, verify=False) 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: except requests.ConnectionError:
logger.info('Could not connect to {section}:{category} to perform auto-fork detection!'.format logger.info('Could not connect to {section}:{category} to perform auto-fork detection!'.format
(section=section, category=input_category)) (section=section, category=input_category))
@ -141,11 +144,9 @@ def auto_fork(section, input_category):
if found: if found:
params['cmd'] = 'sg.postprocess' params['cmd'] = 'sg.postprocess'
else: # try different api set for non-SickGear forks. else: # try different api set for non-SickGear forks.
url = '{protocol}{host}:{port}{root}/api/{apikey}/?cmd=help&subject=postprocess'.format( api_params = {'cmd': 'help', 'subject': 'postprocess'}
protocol=protocol, host=host, port=port, root=web_root, apikey=apikey,
)
try: 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: except requests.ConnectionError:
logger.info('Could not connect to {section}:{category} to perform auto-fork detection!'.format logger.info('Could not connect to {section}:{category} to perform auto-fork detection!'.format
(section=section, category=input_category)) (section=section, category=input_category))

View file

@ -208,22 +208,25 @@
# ffmpeg output settings. # ffmpeg output settings.
#outputVideoExtension=.mp4 #outputVideoExtension=.mp4
#outputVideoCodec=libx264 #outputVideoCodec=libx264
#VideoCodecAllow = #VideoCodecAllow=
#outputVideoResolution=720:-1 #outputVideoResolution=720:-1
#outputVideoPreset=medium #outputVideoPreset=medium
#outputVideoFramerate=24 #outputVideoFramerate=24
#outputVideoBitrate=800k #outputVideoBitrate=800k
#outputAudioCodec=libmp3lame #outputAudioCodec=ac3
#AudioCodecAllow = #AudioCodecAllow=
#outputAudioBitrate=128k #outputAudioChannels=6
#outputQualityPercent = 0 #outputAudioBitrate=640k
#outputAudioTrack2Codec = libfaac #outputQualityPercent=
#AudioCodec2Allow = #outputAudioTrack2Codec=libfaac
#outputAudioTrack2Bitrate = 128k #AudioCodec2Allow=
#outputAudioOtherCodec = libmp3lame #outputAudioTrack2Channels=2
#AudioOtherCodecAllow = #outputAudioTrack2Bitrate=160k
#outputAudioOtherBitrate = 128k #outputAudioOtherCodec=libmp3lame
#outputSubtitleCodec = #AudioOtherCodecAllow=
#outputAudioOtherChannels=2
#outputAudioOtherBitrate=128k
#outputSubtitleCodec=
## WakeOnLan ## WakeOnLan

View file

@ -213,22 +213,25 @@
# ffmpeg output settings. # ffmpeg output settings.
#outputVideoExtension=.mp4 #outputVideoExtension=.mp4
#outputVideoCodec=libx264 #outputVideoCodec=libx264
#VideoCodecAllow = #VideoCodecAllow=
#outputVideoResolution=720:-1 #outputVideoResolution=720:-1
#outputVideoPreset=medium #outputVideoPreset=medium
#outputVideoFramerate=24 #outputVideoFramerate=24
#outputVideoBitrate=800k #outputVideoBitrate=800k
#outputAudioCodec=libmp3lame #outputAudioCodec=ac3
#AudioCodecAllow = #AudioCodecAllow=
#outputAudioBitrate=128k #outputAudioChannels=6
#outputQualityPercent = 0 #outputAudioBitrate=640k
#outputAudioTrack2Codec = libfaac #outputQualityPercent=
#AudioCodec2Allow = #outputAudioTrack2Codec=libfaac
#outputAudioTrack2Bitrate = 128k #AudioCodec2Allow=
#outputAudioOtherCodec = libmp3lame #outputAudioTrack2Channels=2
#AudioOtherCodecAllow = #outputAudioTrack2Bitrate=160k
#outputAudioOtherBitrate = 128k #outputAudioOtherCodec=libmp3lame
#outputSubtitleCodec = #AudioOtherCodecAllow=
#outputAudioOtherChannels=2
#outputAudioOtherBitrate=128k
#outputSubtitleCodec=
## WakeOnLan ## WakeOnLan

View file

@ -23,7 +23,7 @@ def read(*names, **kwargs):
setup( setup(
name='nzbToMedia', name='nzbToMedia',
version='12.1.05', version='12.1.06',
license='GPLv3', license='GPLv3',
description='Efficient on demand post processing', description='Efficient on demand post processing',
long_description=""" long_description="""