From a4b8add91d2e562f56a7674d7ec87fb1afdebcaa Mon Sep 17 00:00:00 2001 From: Joshua Glatt Date: Sun, 11 Oct 2020 12:12:58 -0700 Subject: [PATCH 1/2] include fonts when copying/moving retail data --- knossos/tasks.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/knossos/tasks.py b/knossos/tasks.py index 51bd808..f3bc61f 100644 --- a/knossos/tasks.py +++ b/knossos/tasks.py @@ -1837,6 +1837,15 @@ def work(self, paths): for item in glob.glob(os.path.join(extract_path, 'data3', '*.mve')): shutil.move(item, os.path.join(dest_path, 'data/movies', os.path.basename(item))) + # for issue #211, move retail fonts, if there ar any + fonts = glob.glob(os.path.join(extract_path, 'data/fonts', '*.VF')) + # retail fonts end in .VF, adding *.vf to future-proof + fonts.extend(glob.glob(os.path.join(extract_path, 'data/fonts', '*.vf'))) + if len(fonts) > 0: + self._makedirs(os.path.join(dest_path, 'data/fonts')) + for item in fonts: + shutil.move(item, os.path.join(dest_path, 'data/fonts', os.path.basename(item))) + progress.update(0.99, 'Cleanup...') os.unlink(inno) shutil.rmtree(os.path.join(dest_path, 'app'), ignore_errors=True) @@ -1926,9 +1935,17 @@ def work(self, paths): self._reason = 'vps' return + # for issue #211, copy retail fonts, if there ar any + fonts = glob.glob(os.path.join(gog_path, 'data/fonts', '*.VF')) + # retail fonts end in .VF, adding *.vf to future-proof + fonts.extend(glob.glob(os.path.join(gog_path, 'data/fonts', '*.vf'))) + has_fonts = len(fonts) > 0 + progress.update(0, 'Creating directories...') self._makedirs(os.path.join(dest_path, 'data/players')) self._makedirs(os.path.join(dest_path, 'data/movies')) + if has_fonts: + self._makedirs(os.path.join(dest_path, 'data/fonts')) progress.update(1 / 4., 'Copying VPs...') for item in glob.glob(os.path.join(gog_path, '*.vp')): @@ -1938,12 +1955,18 @@ def work(self, paths): for item in glob.glob(os.path.join(gog_path, 'data/players', '*.hcf')): shutil.copyfile(item, os.path.join(dest_path, 'data/players', os.path.basename(item))) - progress.update(3 / 4., 'Copying cutscenes...') + fonts_msg = ' and fonts' if has_fonts else '' + progress.update(3 / 4., 'Copying cutscenes{0}...'.format(fonts_msg)) for ext in ('mve', 'ogg'): for sub in ('data', 'data2', 'data3'): for item in glob.glob(os.path.join(gog_path, sub, '*.' + ext)): shutil.copyfile(item, os.path.join(dest_path, 'data/movies', os.path.basename(item))) + # the if-check isn't required but included for readability + if has_fonts: + for item in fonts: + shutil.copyfile(item, os.path.join(dest_path, 'data/fonts', os.path.basename(item))) + progress.update(1, 'Done') self._reason = 'done' except Exception: From 08d8b654ebaf1bf9cf2779fe4d76682b62feb59c Mon Sep 17 00:00:00 2001 From: Joshua Glatt Date: Sun, 11 Oct 2020 12:41:31 -0700 Subject: [PATCH 2/2] look only for .VF font files and not .vf --- knossos/tasks.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/knossos/tasks.py b/knossos/tasks.py index f3bc61f..26bf297 100644 --- a/knossos/tasks.py +++ b/knossos/tasks.py @@ -1838,9 +1838,8 @@ def work(self, paths): shutil.move(item, os.path.join(dest_path, 'data/movies', os.path.basename(item))) # for issue #211, move retail fonts, if there ar any + # retail fonts end in .VF and not .vf fonts = glob.glob(os.path.join(extract_path, 'data/fonts', '*.VF')) - # retail fonts end in .VF, adding *.vf to future-proof - fonts.extend(glob.glob(os.path.join(extract_path, 'data/fonts', '*.vf'))) if len(fonts) > 0: self._makedirs(os.path.join(dest_path, 'data/fonts')) for item in fonts: @@ -1936,9 +1935,8 @@ def work(self, paths): return # for issue #211, copy retail fonts, if there ar any + # retail fonts end in .VF and not .vf fonts = glob.glob(os.path.join(gog_path, 'data/fonts', '*.VF')) - # retail fonts end in .VF, adding *.vf to future-proof - fonts.extend(glob.glob(os.path.join(gog_path, 'data/fonts', '*.vf'))) has_fonts = len(fonts) > 0 progress.update(0, 'Creating directories...')