mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -07:00
Fix quotes - standardize to single-quoted strings
This commit is contained in:
parent
85b4e22046
commit
c5343889fb
30 changed files with 1257 additions and 1257 deletions
|
@ -120,7 +120,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.debug('Error {msg} when copying to .cfg'.format(msg=error))
|
||||
|
||||
try:
|
||||
# check for autoProcessMedia.cfg.spec and create if it does not exist
|
||||
|
@ -128,7 +128,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.debug('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:
|
||||
|
@ -143,7 +143,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
if CFG_OLD[section].sections:
|
||||
subsections.update({section: CFG_OLD[section].sections})
|
||||
for option, value in CFG_OLD[section].items():
|
||||
if option in ["category", "cpsCategory", "sbCategory", "hpCategory", "mlCategory", "gzCategory", "raCategory", "ndCategory"]:
|
||||
if option in ['category', 'cpsCategory', 'sbCategory', 'hpCategory', 'mlCategory', 'gzCategory', 'raCategory', 'ndCategory']:
|
||||
if not isinstance(value, list):
|
||||
value = [value]
|
||||
|
||||
|
@ -161,34 +161,34 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
if section in ['CouchPotato', 'HeadPhones', 'Gamez', 'Mylar']:
|
||||
if option in ['username', 'password']:
|
||||
values.pop(option)
|
||||
if section in ["SickBeard", "Mylar"]:
|
||||
if option == "wait_for": # remove old format
|
||||
if section in ['SickBeard', 'Mylar']:
|
||||
if option == 'wait_for': # remove old format
|
||||
values.pop(option)
|
||||
if section in ["SickBeard", "NzbDrone"]:
|
||||
if option == "failed_fork": # change this old format
|
||||
if section in ['SickBeard', 'NzbDrone']:
|
||||
if option == 'failed_fork': # change this old format
|
||||
values['failed'] = 'auto'
|
||||
values.pop(option)
|
||||
if option == "outputDirectory": # move this to new location format
|
||||
if option == 'outputDirectory': # move this to new location format
|
||||
CFG_NEW['Torrent'][option] = os.path.split(os.path.normpath(value))[0]
|
||||
values.pop(option)
|
||||
if section in ["Torrent"]:
|
||||
if option in ["compressedExtensions", "mediaExtensions", "metaExtensions", "minSampleSize"]:
|
||||
if section in ['Torrent']:
|
||||
if option in ['compressedExtensions', 'mediaExtensions', 'metaExtensions', 'minSampleSize']:
|
||||
CFG_NEW['Extensions'][option] = value
|
||||
values.pop(option)
|
||||
if option == "useLink": # Sym links supported now as well.
|
||||
if option == 'useLink': # Sym links supported now as well.
|
||||
if value in ['1', 1]:
|
||||
value = 'hard'
|
||||
elif value in ['0', 0]:
|
||||
value = 'no'
|
||||
values[option] = value
|
||||
if option == "forceClean":
|
||||
if option == 'forceClean':
|
||||
CFG_NEW['General']['force_clean'] = value
|
||||
values.pop(option)
|
||||
if section in ["Transcoder"]:
|
||||
if option in ["niceness"]:
|
||||
if section in ['Transcoder']:
|
||||
if option in ['niceness']:
|
||||
CFG_NEW['Posix'][option] = value
|
||||
values.pop(option)
|
||||
if option == "remote_path":
|
||||
if option == 'remote_path':
|
||||
if value and value not in ['0', '1', 0, 1]:
|
||||
value = 1
|
||||
elif not value:
|
||||
|
@ -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
|
||||
|
@ -256,27 +256,27 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
try:
|
||||
if 'NZBPO_NDCATEGORY' in os.environ and 'NZBPO_SBCATEGORY' in os.environ:
|
||||
if os.environ['NZBPO_NDCATEGORY'] == os.environ['NZBPO_SBCATEGORY']:
|
||||
logger.warning("{x} category is set for SickBeard and Sonarr. "
|
||||
"Please check your config in NZBGet".format
|
||||
logger.warning('{x} category is set for SickBeard and Sonarr. '
|
||||
'Please check your config in NZBGet'.format
|
||||
(x=os.environ['NZBPO_NDCATEGORY']))
|
||||
if 'NZBPO_RACATEGORY' in os.environ and 'NZBPO_CPSCATEGORY' in os.environ:
|
||||
if os.environ['NZBPO_RACATEGORY'] == os.environ['NZBPO_CPSCATEGORY']:
|
||||
logger.warning("{x} category is set for CouchPotato and Radarr. "
|
||||
"Please check your config in NZBGet".format
|
||||
logger.warning('{x} category is set for CouchPotato and Radarr. '
|
||||
'Please check your config in NZBGet'.format
|
||||
(x=os.environ['NZBPO_RACATEGORY']))
|
||||
if 'NZBPO_LICATEGORY' in os.environ and 'NZBPO_HPCATEGORY' in os.environ:
|
||||
if os.environ['NZBPO_LICATEGORY'] == os.environ['NZBPO_HPCATEGORY']:
|
||||
logger.warning("{x} category is set for HeadPhones and Lidarr. "
|
||||
"Please check your config in NZBGet".format
|
||||
logger.warning('{x} category is set for HeadPhones and Lidarr. '
|
||||
'Please check your config in NZBGet'.format
|
||||
(x=os.environ['NZBPO_LICATEGORY']))
|
||||
section = "Nzb"
|
||||
section = 'Nzb'
|
||||
key = 'NZBOP_DESTDIR'
|
||||
if key in os.environ:
|
||||
option = 'default_downloadDirectory'
|
||||
value = os.environ[key]
|
||||
cfg_new[section][option] = value
|
||||
|
||||
section = "General"
|
||||
section = 'General'
|
||||
env_keys = ['AUTO_UPDATE', 'CHECK_MEDIA', 'SAFE_MODE', 'NO_EXTRACT_FAILED']
|
||||
cfg_keys = ['auto_update', 'check_media', 'safe_mode', 'no_extract_failed']
|
||||
for index in range(len(env_keys)):
|
||||
|
@ -286,7 +286,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
value = os.environ[key]
|
||||
cfg_new[section][option] = value
|
||||
|
||||
section = "Network"
|
||||
section = 'Network'
|
||||
env_keys = ['MOUNTPOINTS']
|
||||
cfg_keys = ['mount_points']
|
||||
for index in range(len(env_keys)):
|
||||
|
@ -296,7 +296,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
value = os.environ[key]
|
||||
cfg_new[section][option] = value
|
||||
|
||||
section = "CouchPotato"
|
||||
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']
|
||||
|
@ -315,7 +315,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
if os.environ[env_cat_key] in cfg_new['Radarr'].sections:
|
||||
cfg_new['Radarr'][env_cat_key]['enabled'] = 0
|
||||
|
||||
section = "SickBeard"
|
||||
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']
|
||||
|
@ -334,7 +334,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
if os.environ[env_cat_key] in cfg_new['NzbDrone'].sections:
|
||||
cfg_new['NzbDrone'][env_cat_key]['enabled'] = 0
|
||||
|
||||
section = "HeadPhones"
|
||||
section = 'HeadPhones'
|
||||
env_cat_key = 'NZBPO_HPCATEGORY'
|
||||
env_keys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'WAIT_FOR', 'WATCH_DIR', 'REMOTE_PATH', 'DELETE_FAILED']
|
||||
cfg_keys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'wait_for', 'watch_dir', 'remote_path', 'delete_failed']
|
||||
|
@ -351,7 +351,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
if os.environ[env_cat_key] in cfg_new['Lidarr'].sections:
|
||||
cfg_new['Lidarr'][env_cat_key]['enabled'] = 0
|
||||
|
||||
section = "Mylar"
|
||||
section = 'Mylar'
|
||||
env_cat_key = 'NZBPO_MYCATEGORY'
|
||||
env_keys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'APIKEY', 'SSL', 'WEB_ROOT', 'WATCH_DIR',
|
||||
'REMOTE_PATH']
|
||||
|
@ -368,7 +368,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
cfg_new[section][os.environ[env_cat_key]][option] = value
|
||||
cfg_new[section][os.environ[env_cat_key]]['enabled'] = 1
|
||||
|
||||
section = "Gamez"
|
||||
section = 'Gamez'
|
||||
env_cat_key = 'NZBPO_GZCATEGORY'
|
||||
env_keys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'LIBRARY', 'REMOTE_PATH']
|
||||
cfg_keys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'watch_dir', 'library', 'remote_path']
|
||||
|
@ -383,7 +383,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
cfg_new[section][os.environ[env_cat_key]][option] = value
|
||||
cfg_new[section][os.environ[env_cat_key]]['enabled'] = 1
|
||||
|
||||
section = "NzbDrone"
|
||||
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']
|
||||
|
@ -403,7 +403,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
if os.environ[env_cat_key] in cfg_new['SickBeard'].sections:
|
||||
cfg_new['SickBeard'][env_cat_key]['enabled'] = 0
|
||||
|
||||
section = "Radarr"
|
||||
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']
|
||||
|
@ -423,7 +423,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
if os.environ[env_cat_key] in cfg_new['CouchPotato'].sections:
|
||||
cfg_new['CouchPotato'][env_cat_key]['enabled'] = 0
|
||||
|
||||
section = "Lidarr"
|
||||
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']
|
||||
|
@ -442,7 +442,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
if os.environ[env_cat_key] in cfg_new['HeadPhones'].sections:
|
||||
cfg_new['HeadPhones'][env_cat_key]['enabled'] = 0
|
||||
|
||||
section = "Extensions"
|
||||
section = 'Extensions'
|
||||
env_keys = ['COMPRESSEDEXTENSIONS', 'MEDIAEXTENSIONS', 'METAEXTENSIONS']
|
||||
cfg_keys = ['compressedExtensions', 'mediaExtensions', 'metaExtensions']
|
||||
for index in range(len(env_keys)):
|
||||
|
@ -452,7 +452,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
value = os.environ[key]
|
||||
cfg_new[section][option] = value
|
||||
|
||||
section = "Posix"
|
||||
section = 'Posix'
|
||||
env_keys = ['NICENESS', 'IONICE_CLASS', 'IONICE_CLASSDATA']
|
||||
cfg_keys = ['niceness', 'ionice_class', 'ionice_classdata']
|
||||
for index in range(len(env_keys)):
|
||||
|
@ -462,7 +462,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
value = os.environ[key]
|
||||
cfg_new[section][option] = value
|
||||
|
||||
section = "Transcoder"
|
||||
section = 'Transcoder'
|
||||
env_keys = ['TRANSCODE', 'DUPLICATE', 'IGNOREEXTENSIONS', 'OUTPUTFASTSTART', 'OUTPUTVIDEOPATH',
|
||||
'PROCESSOUTPUT', 'AUDIOLANGUAGE', 'ALLAUDIOLANGUAGES', 'SUBLANGUAGES',
|
||||
'ALLSUBLANGUAGES', 'EMBEDSUBS', 'BURNINSUBTITLE', 'EXTRACTSUBS', 'EXTERNALSUBDIR',
|
||||
|
@ -490,7 +490,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
value = os.environ[key]
|
||||
cfg_new[section][option] = value
|
||||
|
||||
section = "WakeOnLan"
|
||||
section = 'WakeOnLan'
|
||||
env_keys = ['WAKE', 'HOST', 'PORT', 'MAC']
|
||||
cfg_keys = ['wake', 'host', 'port', 'mac']
|
||||
for index in range(len(env_keys)):
|
||||
|
@ -500,7 +500,7 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
value = os.environ[key]
|
||||
cfg_new[section][option] = value
|
||||
|
||||
section = "UserScript"
|
||||
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']
|
||||
|
@ -518,14 +518,14 @@ class ConfigObj(configobj.ConfigObj, Section):
|
|||
cfg_new[section][os.environ[env_cat_key]]['enabled'] = 1
|
||||
|
||||
except Exception as error:
|
||||
logger.debug("Error {msg} when applying NZBGet config".format(msg=error))
|
||||
logger.debug('Error {msg} when applying NZBGet config'.format(msg=error))
|
||||
|
||||
try:
|
||||
# write our new config to autoProcessMedia.cfg
|
||||
cfg_new.filename = core.CONFIG_FILE
|
||||
cfg_new.write()
|
||||
except Exception as error:
|
||||
logger.debug("Error {msg} when writing changes to .cfg".format(msg=error))
|
||||
logger.debug('Error {msg} when writing changes to .cfg'.format(msg=error))
|
||||
|
||||
return cfg_new
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue