Include 'map type' in filename

Map types are 'col', 'spec', 'bump' etc.
This commit is contained in:
Sybren A. Stüvel 2016-03-22 14:47:55 +01:00
parent dc4677ed04
commit 394a4f4764

View File

@ -402,6 +402,7 @@ async def download_file_by_uuid(file_uuid,
target_directory: str,
metadata_directory: str,
*,
map_type: str=None,
file_loading: callable,
file_loaded: callable,
future: asyncio.Future):
@ -422,7 +423,8 @@ async def download_file_by_uuid(file_uuid,
metadata_file = os.path.join(metadata_directory, 'files', '%s.json' % file_uuid)
save_as_json(file_desc, metadata_file)
file_path = os.path.join(target_directory, sanitize_filename(file_desc['filename']))
file_path = os.path.join(target_directory,
sanitize_filename('%s-%s' % (map_type, file_desc['filename'])))
file_url = file_desc['link']
# log.debug('Texture %r:\n%s', file_uuid, pprint.pformat(file_desc.to_dict()))
loop.call_soon_threadsafe(file_loading, file_path, file_desc)
@ -450,6 +452,7 @@ async def download_texture(texture_node,
downloaders = (download_file_by_uuid(file_info['file'],
target_directory,
metadata_directory,
map_type=file_info['map_type'],
file_loading=texture_loading,
file_loaded=texture_loaded,
future=future)