Skip to content

Commit d4b679d

Browse files
Use context menu to scraper all assets in ROM CM. Copied from Python 3 branch.
1 parent 63cfbb2 commit d4b679d

File tree

5 files changed

+374
-210
lines changed

5 files changed

+374
-210
lines changed

resources/assets.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,34 @@ def assets_get_path_noext_SUFIX(Asset, AssetPath, asset_base_noext, objectID = '
502502

503503
return asset_path_noext_FileName
504504

505+
# Get the asset path noext. Used in ScrapeStrategy.scrap_CM_asset_all()
506+
# Returns a FileName object.
507+
def assets_get_ROM_path_noext(object_dic, data_dic, asset_ID):
508+
# Unpack data in data_dic
509+
ROM_FN = data_dic['ROM_FN']
510+
platform = data_dic['platform']
511+
categoryID = data_dic['categoryID']
512+
launcherID = data_dic['launcherID']
513+
settings = data_dic['settings']
514+
launchers = data_dic['launchers']
515+
516+
# Misc data
517+
asset_info = assets_get_info_scheme(asset_ID)
518+
519+
# Compute asset_path_noext_FN and return.
520+
if categoryID == VCATEGORY_FAVOURITES_ID:
521+
asset_dir_FN = FileName(settings['favourites_asset_dir'])
522+
asset_path_noext_FN = assets_get_path_noext_SUFIX(asset_info, asset_dir_FN, ROM_FN.getBaseNoExt(), object_dic['id'])
523+
elif categoryID == VCATEGORY_COLLECTIONS_ID:
524+
asset_dir_FN = FileName(settings['collections_asset_dir'])
525+
temp_str = assets_get_collection_asset_basename(asset_info, ROM_FN.getBaseNoExt(), platform, '.png')
526+
asset_path_noext_FN = asset_dir_FN.pjoin(FileName(temp_str).getBaseNoExt())
527+
else:
528+
asset_dir_FN = FileName(launchers[launcherID][asset_info.path_key])
529+
asset_path_noext_FN = assets_get_path_noext_DIR(asset_info, asset_dir_FN, ROM_FN)
530+
# log_debug('assets_get_ROM_path_noext() Return {}'.format(asset_path_noext_FN.getPath()))
531+
return asset_path_noext_FN
532+
505533
# Returns the basename of a collection asset as a FileName object.
506534
# Example: 'Super Mario Bros_nes_title.png'
507535
#
@@ -544,9 +572,7 @@ def asset_get_unconfigured_name_list(configured_bool_list):
544572

545573
return unconfigured_name_list
546574

547-
#
548575
# Get a list of assets with duplicated paths. Refuse to do anything if duplicated paths found.
549-
#
550576
def asset_get_duplicated_dir_list(launcher):
551577
duplicated_bool_list = [False] * len(ROM_ASSET_ID_LIST)
552578
duplicated_name_list = []

resources/disk_IO.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ def fs_write_Collection_index_XML(collections_xml_file, collections):
770770
def fs_load_Collection_index_XML(collections_xml_file):
771771
__debug_xml_parser = 0
772772
ret = {
773-
'timestamp' : 0.0,
773+
'timestamp' : 0.0,
774774
'collections' : {}
775775
}
776776

@@ -1045,7 +1045,7 @@ def fs_write_VCategory_XML(roms_xml_file, roms):
10451045
def fs_load_VCategory_XML(roms_xml_file):
10461046
__debug_xml_parser = 0
10471047
ret = {
1048-
'timestamp' : 0.0,
1048+
'timestamp' : 0.0,
10491049
'vlaunchers' : {}
10501050
}
10511051

0 commit comments

Comments
 (0)