From 394a4f4764264db70cf9526da3783dd6033a50e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 22 Mar 2016 14:47:55 +0100 Subject: [PATCH] Include 'map type' in filename Map types are 'col', 'spec', 'bump' etc. --- blender_cloud/pillar.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/blender_cloud/pillar.py b/blender_cloud/pillar.py index 57f202b..aeedeea 100644 --- a/blender_cloud/pillar.py +++ b/blender_cloud/pillar.py @@ -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)