Esempio n. 1
0
 def find_unused_resources_name_and_filepath(self):
     # TODO: remove duplication with __init__
     for file_path in glob.glob(os.path.join(self.project_base_path, "*.*")):
         md5_resource_filename = common.md5_hash(file_path) + os.path.splitext(file_path)[1]
         if md5_resource_filename not in self.resource_names:
             if os.path.basename(file_path) != _PROJECT_FILE_NAME:
                 yield md5_resource_filename, file_path
Esempio n. 2
0
 def read_md5_to_resource_path_mapping():
     md5_to_resource_path_map = {}
     # TODO: clarify that only files with extension are covered
     for project_file_path in glob.glob(os.path.join(project_base_path, "*.*")):
         resource_name = common.md5_hash(project_file_path) + os.path.splitext(project_file_path)[1]
         md5_to_resource_path_map[resource_name] = project_file_path
     try:
         # penLayer is no regular resource file
         del md5_to_resource_path_map[self['penLayerMD5']]
     except KeyError:
         # TODO: include penLayer download in webapi
         pass
     return md5_to_resource_path_map
Esempio n. 3
0
 def resource_name_for(file_path):
     return common.md5_hash(file_path) + os.path.splitext(file_path)[1]
Esempio n. 4
0
def _key_filename_for(key):
    assert key is not None
    key_path = _key_image_path_for(key)
    # TODO: extract method, already used once
    return common.md5_hash(key_path) + "_" + _key_to_broadcast_message(key) + os.path.splitext(key_path)[1]