Created
October 8, 2017 06:41
-
-
Save apocalyptech/41293f21758312481237c1dc1429043f to your computer and use it in GitHub Desktop.
Create symlinks in The Inner World's audio file directory to allow a few cutscenes to play properly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vim: set expandtab tabstop=4 shiftwidth=4: | |
# At least two cutscenes in the Linux version of The Inner World have audio | |
# files which have a letter with the wrong case in them. Since filenames | |
# in Linux are case-sensitive, and the media player portion of the game | |
# doesn't work at all if a specified file is missing, this causes the | |
# cutscenes to not play at all. This utility just looks for any audio file | |
# with one of those letters and creates a symlink so that both cases exist. | |
# | |
# I'm not sure if there's more than two; the two that I'm aware of are | |
# (spoilers, I guess) right near the end when you're trying to have your | |
# crashed Basylian fire its eyes at things. For the first one, it's the | |
# symlink from MOV_920c.mp3 -> MOV_920C.mp3 which lets the cutscene play. | |
# | |
# Must be run directly from the media/audio/MOV directory. | |
import os | |
import re | |
mov_re = re.compile('^MOV_([0-9_]+)([a-dA-D])?(_EN)?\.mp3$') | |
def sub_file(filename): | |
global subtitle_dir | |
return os.path.join(subtitle_dir, filename) | |
for filename_audio in os.listdir('.'): | |
if filename_audio[-4:] == '.mp3': | |
match = mov_re.match(filename_audio) | |
if match: | |
number = match.group(1) | |
letter = match.group(2) | |
language = match.group(3) | |
if letter: | |
if letter == letter.lower(): | |
new_letter = letter.upper() | |
else: | |
new_letter = letter.lower() | |
if language: | |
new_file = 'MOV_{}{}{}.mp3'.format(number, new_letter, language) | |
else: | |
new_file = 'MOV_{}{}.mp3'.format(number, new_letter) | |
if not os.path.exists(new_file): | |
print('Linking {} -> {}'.format(filename_audio, new_file)) | |
os.symlink(filename_audio, new_file) | |
else: | |
print('Audio filename not matched: {}'.format(filename_audio)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment