-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (29 loc) · 1.56 KB
/
main.py
File metadata and controls
39 lines (29 loc) · 1.56 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
# coding=utf-8
""" csgo-icon-extractor script """
import argparse
import csgo_icon_extractor
DEFAULT_ICONLIB = 'iconlib.swf'
DEFAULT_OUTPUT_DIR = 'csgo-icons'
def _parse_command_line_args():
parser = argparse.ArgumentParser(description='Extracts the CS:GO icon images from the icon lib SWF file.')
parser.add_argument('iconlib', nargs='?', default=DEFAULT_ICONLIB, help='the icon lib SWF file')
parser.add_argument('outdir', nargs='?', default=DEFAULT_OUTPUT_DIR, help='the directory to extract the icons into')
return parser.parse_args()
def main():
print('Running csgo-icon-extractor (version 1.0.0) ...')
args = _parse_command_line_args()
iconlib_file = args.iconlib
output_dir = args.outdir
print('Using configuration: iconlib={}, outdir={}'.format(iconlib_file, output_dir))
csgo_icon_extractor.verfiy_swt_tools_is_in_path()
csgo_icon_extractor.create_output_directory(output_dir)
object_set_details_list = csgo_icon_extractor.extract_object_set_details_list(iconlib_file)
for object_set_details in object_set_details_list:
if object_set_details.object_type in csgo_icon_extractor.SUPPORTED_ICON_TYPE_MAP:
icon_file_ext = csgo_icon_extractor.SUPPORTED_ICON_TYPE_MAP[object_set_details.object_type]
csgo_icon_extractor.extract_icon_set(iconlib_file, object_set_details, icon_file_ext, output_dir)
print('Extracted {} {}(s)'.format(len(object_set_details.ids), object_set_details.object_type))
print('Icon extraction compete!')
if __name__ == "__main__":
main()