mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-22 06:13:19 -07:00
Standardize auto-processors configuration
This commit is contained in:
parent
92ceab0e7c
commit
225f47ac64
6 changed files with 114 additions and 71 deletions
|
@ -46,17 +46,25 @@ def process(
|
||||||
input_category: str = '',
|
input_category: str = '',
|
||||||
failure_link: str = '',
|
failure_link: str = '',
|
||||||
) -> ProcessResult:
|
) -> ProcessResult:
|
||||||
|
# Get configuration
|
||||||
|
cfg = core.CFG[section][input_category]
|
||||||
|
|
||||||
cfg = dict(core.CFG[section][input_category])
|
# Base URL
|
||||||
|
ssl = int(cfg.get('ssl', 0))
|
||||||
|
scheme = 'https' if ssl else 'http'
|
||||||
host = cfg['host']
|
host = cfg['host']
|
||||||
port = cfg['port']
|
port = cfg['port']
|
||||||
apikey = cfg['apikey']
|
|
||||||
ssl = int(cfg.get('ssl', 0))
|
|
||||||
web_root = cfg.get('web_root', '')
|
web_root = cfg.get('web_root', '')
|
||||||
scheme = 'https' if ssl else 'http'
|
|
||||||
|
# Authentication
|
||||||
|
apikey = cfg.get('apikey', '')
|
||||||
|
|
||||||
|
# Params
|
||||||
remote_path = int(cfg.get('remote_path', 0))
|
remote_path = int(cfg.get('remote_path', 0))
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
|
||||||
|
# Begin processing
|
||||||
url = core.utils.common.create_url(scheme, host, port, web_root)
|
url = core.utils.common.create_url(scheme, host, port, web_root)
|
||||||
if not server_responding(url):
|
if not server_responding(url):
|
||||||
logger.error('Server did not respond. Exiting', section)
|
logger.error('Server did not respond. Exiting', section)
|
||||||
|
@ -71,6 +79,7 @@ def process(
|
||||||
'cmd': 'forceProcess',
|
'cmd': 'forceProcess',
|
||||||
'dir': remote_dir(dir_name) if remote_path else dir_name,
|
'dir': remote_dir(dir_name) if remote_path else dir_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug('Opening URL: {0} with params: {1}'.format(url, params), section)
|
logger.debug('Opening URL: {0} with params: {1}'.format(url, params), section)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -46,19 +46,27 @@ def process(
|
||||||
input_category: str = '',
|
input_category: str = '',
|
||||||
failure_link: str = '',
|
failure_link: str = '',
|
||||||
) -> ProcessResult:
|
) -> ProcessResult:
|
||||||
|
# Get configuration
|
||||||
|
cfg = core.CFG[section][input_category]
|
||||||
|
|
||||||
|
# Base URL
|
||||||
|
ssl = int(cfg.get('ssl', 0))
|
||||||
|
scheme = 'https' if ssl else 'http'
|
||||||
|
host = cfg['host']
|
||||||
|
port = cfg['port']
|
||||||
|
web_root = cfg.get('web_root', '')
|
||||||
|
|
||||||
|
# Authentication
|
||||||
|
apikey = cfg.get('apikey', '')
|
||||||
|
|
||||||
|
# Params
|
||||||
|
remote_path = int(cfg.get('remote_path', 0))
|
||||||
|
|
||||||
|
# Misc
|
||||||
apc_version = '2.04'
|
apc_version = '2.04'
|
||||||
comicrn_version = '1.01'
|
comicrn_version = '1.01'
|
||||||
|
|
||||||
cfg = dict(core.CFG[section][input_category])
|
# Begin processing
|
||||||
|
|
||||||
host = cfg['host']
|
|
||||||
port = cfg['port']
|
|
||||||
apikey = cfg['apikey']
|
|
||||||
ssl = int(cfg.get('ssl', 0))
|
|
||||||
web_root = cfg.get('web_root', '')
|
|
||||||
remote_path = int(cfg.get('remote_path'), 0)
|
|
||||||
scheme = 'https' if ssl else 'http'
|
|
||||||
|
|
||||||
url = core.utils.common.create_url(scheme, host, port, web_root)
|
url = core.utils.common.create_url(scheme, host, port, web_root)
|
||||||
if not server_responding(url):
|
if not server_responding(url):
|
||||||
logger.error('Server did not respond. Exiting', section)
|
logger.error('Server did not respond. Exiting', section)
|
||||||
|
|
|
@ -46,17 +46,25 @@ def process(
|
||||||
input_category: str = '',
|
input_category: str = '',
|
||||||
failure_link: str = '',
|
failure_link: str = '',
|
||||||
) -> ProcessResult:
|
) -> ProcessResult:
|
||||||
|
# Get configuration
|
||||||
|
cfg = core.CFG[section][input_category]
|
||||||
|
|
||||||
cfg = dict(core.CFG[section][input_category])
|
# Base URL
|
||||||
|
ssl = int(cfg.get('ssl', 0))
|
||||||
|
scheme = 'https' if ssl else 'http'
|
||||||
host = cfg['host']
|
host = cfg['host']
|
||||||
port = cfg['port']
|
port = cfg['port']
|
||||||
apikey = cfg['apikey']
|
|
||||||
library = cfg.get('library')
|
|
||||||
ssl = int(cfg.get('ssl', 0))
|
|
||||||
web_root = cfg.get('web_root', '')
|
web_root = cfg.get('web_root', '')
|
||||||
scheme = 'https' if ssl else 'http'
|
|
||||||
|
|
||||||
|
# Authentication
|
||||||
|
apikey = cfg.get('apikey', '')
|
||||||
|
|
||||||
|
# Params
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
library = cfg.get('library')
|
||||||
|
|
||||||
|
# Begin processing
|
||||||
url = core.utils.common.create_url(scheme, host, port, web_root)
|
url = core.utils.common.create_url(scheme, host, port, web_root)
|
||||||
if not server_responding(url):
|
if not server_responding(url):
|
||||||
logger.error('Server did not respond. Exiting', section)
|
logger.error('Server did not respond. Exiting', section)
|
||||||
|
|
|
@ -46,35 +46,40 @@ def process(
|
||||||
input_category: str = '',
|
input_category: str = '',
|
||||||
failure_link: str = '',
|
failure_link: str = '',
|
||||||
) -> ProcessResult:
|
) -> ProcessResult:
|
||||||
|
# Get configuration
|
||||||
|
cfg = core.CFG[section][input_category]
|
||||||
|
|
||||||
cfg = dict(core.CFG[section][input_category])
|
# Base URL
|
||||||
|
ssl = int(cfg.get('ssl', 0))
|
||||||
|
scheme = 'https' if ssl else 'http'
|
||||||
host = cfg['host']
|
host = cfg['host']
|
||||||
port = cfg['port']
|
port = cfg['port']
|
||||||
apikey = cfg['apikey']
|
|
||||||
if section == 'CouchPotato':
|
|
||||||
method = cfg['method']
|
|
||||||
else:
|
|
||||||
method = None
|
|
||||||
# added importMode for Radarr config
|
|
||||||
if section == 'Radarr':
|
|
||||||
import_mode = cfg.get('importMode', 'Move')
|
|
||||||
else:
|
|
||||||
import_mode = None
|
|
||||||
delete_failed = int(cfg['delete_failed'])
|
|
||||||
wait_for = int(cfg['wait_for'])
|
|
||||||
ssl = int(cfg.get('ssl', 0))
|
|
||||||
web_root = cfg.get('web_root', '')
|
web_root = cfg.get('web_root', '')
|
||||||
remote_path = int(cfg.get('remote_path', 0))
|
|
||||||
scheme = 'https' if ssl else 'http'
|
# Authentication
|
||||||
|
apikey = cfg.get('apikey', '')
|
||||||
omdbapikey = cfg.get('omdbapikey', '')
|
omdbapikey = cfg.get('omdbapikey', '')
|
||||||
no_status_check = int(cfg.get('no_status_check', 0))
|
|
||||||
status = int(status)
|
# Params
|
||||||
|
delete_failed = int(cfg.get('delete_failed', 0))
|
||||||
|
remote_path = int(cfg.get('remote_path', 0))
|
||||||
|
wait_for = int(cfg.get('wait_for', 2))
|
||||||
|
|
||||||
|
# Misc
|
||||||
if status > 0 and core.NOEXTRACTFAILED:
|
if status > 0 and core.NOEXTRACTFAILED:
|
||||||
extract = 0
|
extract = 0
|
||||||
else:
|
else:
|
||||||
extract = int(cfg.get('extract', 0))
|
extract = int(cfg.get('extract', 0))
|
||||||
|
chmod_directory = int(str(cfg.get('chmodDirectory', '0')), 8)
|
||||||
|
import_mode = cfg.get('importMode', 'Move')
|
||||||
|
if section != 'Radarr':
|
||||||
|
import_mode = None
|
||||||
|
no_status_check = int(cfg.get('no_status_check', 0))
|
||||||
|
method = cfg.get('method', None)
|
||||||
|
if section != 'CouchPotato':
|
||||||
|
method = None
|
||||||
|
|
||||||
|
# Begin processing
|
||||||
imdbid = find_imdbid(dir_name, input_name, omdbapikey)
|
imdbid = find_imdbid(dir_name, input_name, omdbapikey)
|
||||||
if section == 'CouchPotato':
|
if section == 'CouchPotato':
|
||||||
route = f'{web_root}/api/{apikey}/'
|
route = f'{web_root}/api/{apikey}/'
|
||||||
|
@ -181,7 +186,6 @@ def process(
|
||||||
logger.debug('Transcoding succeeded for files in {0}'.format(dir_name), section)
|
logger.debug('Transcoding succeeded for files in {0}'.format(dir_name), section)
|
||||||
dir_name = new_dir_name
|
dir_name = new_dir_name
|
||||||
|
|
||||||
chmod_directory = int(str(cfg.get('chmodDirectory', '0')), 8)
|
|
||||||
logger.debug('Config setting \'chmodDirectory\' currently set to {0}'.format(oct(chmod_directory)), section)
|
logger.debug('Config setting \'chmodDirectory\' currently set to {0}'.format(oct(chmod_directory)), section)
|
||||||
if chmod_directory:
|
if chmod_directory:
|
||||||
logger.info('Attempting to set the octal permission of \'{0}\' on directory \'{1}\''.format(oct(chmod_directory), dir_name), section)
|
logger.info('Attempting to set the octal permission of \'{0}\' on directory \'{1}\''.format(oct(chmod_directory), dir_name), section)
|
||||||
|
|
|
@ -46,24 +46,31 @@ def process(
|
||||||
input_category: str = '',
|
input_category: str = '',
|
||||||
failure_link: str = '',
|
failure_link: str = '',
|
||||||
) -> ProcessResult:
|
) -> ProcessResult:
|
||||||
|
# Get configuration
|
||||||
|
cfg = core.CFG[section][input_category]
|
||||||
|
|
||||||
cfg = dict(core.CFG[section][input_category])
|
# Base URL
|
||||||
|
ssl = int(cfg.get('ssl', 0))
|
||||||
|
scheme = 'https' if ssl else 'http'
|
||||||
host = cfg['host']
|
host = cfg['host']
|
||||||
port = cfg['port']
|
port = cfg['port']
|
||||||
apikey = cfg['apikey']
|
|
||||||
wait_for = int(cfg['wait_for'])
|
|
||||||
ssl = int(cfg.get('ssl', 0))
|
|
||||||
delete_failed = int(cfg['delete_failed'])
|
|
||||||
web_root = cfg.get('web_root', '')
|
web_root = cfg.get('web_root', '')
|
||||||
|
|
||||||
|
# Authentication
|
||||||
|
apikey = cfg.get('apikey', '')
|
||||||
|
|
||||||
|
# Params
|
||||||
|
delete_failed = int(cfg.get('delete_failed', 0))
|
||||||
remote_path = int(cfg.get('remote_path', 0))
|
remote_path = int(cfg.get('remote_path', 0))
|
||||||
scheme = 'https' if ssl else 'http'
|
wait_for = int(cfg.get('wait_for', 2))
|
||||||
status = int(status)
|
|
||||||
|
# Misc
|
||||||
if status > 0 and core.NOEXTRACTFAILED:
|
if status > 0 and core.NOEXTRACTFAILED:
|
||||||
extract = 0
|
extract = 0
|
||||||
else:
|
else:
|
||||||
extract = int(cfg.get('extract', 0))
|
extract = int(cfg.get('extract', 0))
|
||||||
|
|
||||||
|
# Begin processing
|
||||||
route = f'{web_root}/api/v1' if section == 'Lidarr' else f'{web_root}/api'
|
route = f'{web_root}/api/v1' if section == 'Lidarr' else f'{web_root}/api'
|
||||||
url = core.utils.common.create_url(scheme, host, port, route)
|
url = core.utils.common.create_url(scheme, host, port, route)
|
||||||
if not server_responding(url):
|
if not server_responding(url):
|
||||||
|
|
|
@ -46,21 +46,45 @@ def process(
|
||||||
input_category: str = '',
|
input_category: str = '',
|
||||||
failure_link: str = '',
|
failure_link: str = '',
|
||||||
) -> ProcessResult:
|
) -> ProcessResult:
|
||||||
|
# Get configuration
|
||||||
|
cfg = core.CFG[section][input_category]
|
||||||
|
|
||||||
cfg = dict(core.CFG[section][input_category])
|
# Base URL
|
||||||
|
ssl = int(cfg.get('ssl', 0))
|
||||||
|
scheme = 'https' if ssl else 'http'
|
||||||
host = cfg['host']
|
host = cfg['host']
|
||||||
port = cfg['port']
|
port = cfg['port']
|
||||||
ssl = int(cfg.get('ssl', 0))
|
|
||||||
web_root = cfg.get('web_root', '')
|
web_root = cfg.get('web_root', '')
|
||||||
scheme = 'https' if ssl else 'http'
|
|
||||||
|
# Authentication
|
||||||
|
apikey = cfg.get('apikey', '')
|
||||||
username = cfg.get('username', '')
|
username = cfg.get('username', '')
|
||||||
password = cfg.get('password', '')
|
password = cfg.get('password', '')
|
||||||
apikey = cfg.get('apikey', '')
|
|
||||||
api_version = int(cfg.get('api_version', 2))
|
api_version = int(cfg.get('api_version', 2))
|
||||||
sso_username = cfg.get('sso_username', '')
|
sso_username = cfg.get('sso_username', '')
|
||||||
sso_password = cfg.get('sso_password', '')
|
sso_password = cfg.get('sso_password', '')
|
||||||
|
|
||||||
|
# Params
|
||||||
|
delete_failed = int(cfg.get('delete_failed', 0))
|
||||||
|
remote_path = int(cfg.get('remote_path', 0))
|
||||||
|
wait_for = int(cfg.get('wait_for', 2))
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
if status > 0 and core.NOEXTRACTFAILED:
|
||||||
|
extract = 0
|
||||||
|
else:
|
||||||
|
extract = int(cfg.get('extract', 0))
|
||||||
|
chmod_directory = int(str(cfg.get('chmodDirectory', '0')), 8)
|
||||||
|
import_mode = cfg.get('importMode', 'Move')
|
||||||
|
nzb_extraction_by = cfg.get('nzbExtractionBy', 'Downloader')
|
||||||
|
process_method = cfg.get('process_method')
|
||||||
|
force = int(cfg.get('force', 0))
|
||||||
|
delete_on = int(cfg.get('delete_on', 0))
|
||||||
|
ignore_subs = int(cfg.get('ignore_subs', 0))
|
||||||
|
status = int(failed)
|
||||||
|
|
||||||
|
# Begin processing
|
||||||
|
|
||||||
# Refactor into an OO structure.
|
# Refactor into an OO structure.
|
||||||
# For now let's do botch the OO and the serialized code, until everything has been migrated.
|
# For now let's do botch the OO and the serialized code, until everything has been migrated.
|
||||||
init_sickbeard = InitSickBeard(cfg, section, input_category)
|
init_sickbeard = InitSickBeard(cfg, section, input_category)
|
||||||
|
@ -80,24 +104,8 @@ def process(
|
||||||
f'{section}: Failed to post-process - {section} did not respond.'
|
f'{section}: Failed to post-process - {section} did not respond.'
|
||||||
)
|
)
|
||||||
|
|
||||||
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_CLIENT_AGENT and core.USE_LINK == 'move-sym':
|
if client_agent == core.TORRENT_CLIENT_AGENT and core.USE_LINK == 'move-sym':
|
||||||
process_method = 'symlink'
|
process_method = 'symlink'
|
||||||
remote_path = int(cfg.get('remote_path', 0))
|
|
||||||
wait_for = int(cfg.get('wait_for', 2))
|
|
||||||
force = int(cfg.get('force', 0))
|
|
||||||
delete_on = int(cfg.get('delete_on', 0))
|
|
||||||
ignore_subs = int(cfg.get('ignore_subs', 0))
|
|
||||||
status = int(failed)
|
|
||||||
if status > 0 and core.NOEXTRACTFAILED:
|
|
||||||
extract = 0
|
|
||||||
else:
|
|
||||||
extract = int(cfg.get('extract', 0))
|
|
||||||
# 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.
|
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]
|
dir_name = os.path.split(os.path.normpath(dir_name))[0]
|
||||||
|
|
||||||
|
@ -190,7 +198,6 @@ def process(
|
||||||
logger.debug('SUCCESS: Transcoding succeeded for files in {0}'.format(dir_name), section)
|
logger.debug('SUCCESS: Transcoding succeeded for files in {0}'.format(dir_name), section)
|
||||||
dir_name = new_dir_name
|
dir_name = new_dir_name
|
||||||
|
|
||||||
chmod_directory = int(str(cfg.get('chmodDirectory', '0')), 8)
|
|
||||||
logger.debug('Config setting \'chmodDirectory\' currently set to {0}'.format(oct(chmod_directory)), section)
|
logger.debug('Config setting \'chmodDirectory\' currently set to {0}'.format(oct(chmod_directory)), section)
|
||||||
if chmod_directory:
|
if chmod_directory:
|
||||||
logger.info('Attempting to set the octal permission of \'{0}\' on directory \'{1}\''.format(oct(chmod_directory), dir_name), section)
|
logger.info('Attempting to set the octal permission of \'{0}\' on directory \'{1}\''.format(oct(chmod_directory), dir_name), section)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue