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): class ConfigObj(configobj.ConfigObj, Section):
def __init__(self, *args, **kw): def __init__(self, infile=None, *args, **kw):
if len(args) == 0: if infile is None:
args = (core.CONFIG_FILE,) infile = core.CONFIG_FILE
super().__init__(*args, **kw) super().__init__(os.fspath(infile), *args, **kw)
self.interpolation = False self.interpolation = False
@staticmethod @staticmethod
@ -115,7 +115,7 @@ class ConfigObj(configobj.ConfigObj, Section):
try: try:
# check for autoProcessMedia.cfg and create if it does not exist # 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) 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:
@ -123,7 +123,7 @@ class ConfigObj(configobj.ConfigObj, Section):
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
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) 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:

View file

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