Fix configfile for pathlib.Path as infile

This commit is contained in:
Labrys of Knossos 2022-12-14 04:37:31 -05:00
commit d889cbdfe3
2 changed files with 9 additions and 9 deletions

View file

@ -90,10 +90,10 @@ class Section(configobj.Section):
class ConfigObj(configobj.ConfigObj, Section):
def __init__(self, *args, **kw):
if len(args) == 0:
args = (core.CONFIG_FILE,)
super().__init__(*args, **kw)
def __init__(self, infile=None, *args, **kw):
if infile is None:
infile = core.CONFIG_FILE
super().__init__(os.fspath(infile), *args, **kw)
self.interpolation = False
@staticmethod
@ -115,7 +115,7 @@ class ConfigObj(configobj.ConfigObj, Section):
try:
# check for autoProcessMedia.cfg and create if it does not exist
if not os.path.isfile(core.CONFIG_FILE):
if not core.CONFIG_FILE.is_file():
shutil.copyfile(core.CONFIG_SPEC_FILE, core.CONFIG_FILE)
CFG_OLD = config(core.CONFIG_FILE)
except Exception as error:
@ -123,7 +123,7 @@ class ConfigObj(configobj.ConfigObj, Section):
try:
# check for autoProcessMedia.cfg.spec and create if it does not exist
if not os.path.isfile(core.CONFIG_SPEC_FILE):
if not core.CONFIG_SPEC_FILE.is_file():
shutil.copyfile(core.CONFIG_FILE, core.CONFIG_SPEC_FILE)
CFG_NEW = config(core.CONFIG_SPEC_FILE)
except Exception as error:

View file

@ -57,9 +57,9 @@ def is_video_good(video: pathlib.Path, status, require_lan=None):
'TRANSCODER',
)
if disable:
if (
status
): # if the download was 'failed', assume bad. If it was successful, assume good.
if status:
# if the download was 'failed', assume bad.
# If it was successful, assume good.
return False
else:
return True