forked from Limero/mulle.js
-
Notifications
You must be signed in to change notification settings - Fork 9
/
extract.py
27 lines (24 loc) · 945 Bytes
/
extract.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import sys
from glob import glob
from ShockwaveExtractor import main
gameDir = sys.argv[1]
if not os.path.exists(gameDir):
raise FileNotFoundError('Game directory %s not found' % gameDir)
gameDir = os.path.realpath(gameDir)
if os.path.exists(os.path.join(gameDir, 'MOVIES')):
gameDir = os.path.join(gameDir, 'MOVIES')
files = glob('%s%s*.CXT' % (gameDir, os.path.sep)) + glob('%s%s*.DXR' % (gameDir, os.path.sep))
elif os.path.join(gameDir, 'movies'):
gameDir = os.path.join(gameDir, 'movies')
files = glob('%s%s*.cxt' % (gameDir, os.path.sep)) + glob('%s%s*.dxr' % (gameDir, os.path.sep))
else:
raise FileNotFoundError('movies directory not found at %s' % gameDir)
if not files:
raise FileNotFoundError('No files found in %s' % gameDir)
for file in files:
print(file)
try:
main(['-e', '-i', file])
except UnicodeEncodeError as e:
print('Error extracting %s: %s' % (file, e))