Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include fonts when copying/moving retail data #213

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion knossos/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,14 @@ 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
# retail fonts end in .VF and not .vf
fonts = 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)
Expand Down Expand Up @@ -1926,9 +1934,16 @@ def work(self, paths):
self._reason = 'vps'
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'))
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')):
Expand All @@ -1938,12 +1953,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:
Expand Down