@@ -255,20 +255,6 @@ def supports_metadata(self, scraper_ID, metadata_ID):
255255 def supports_asset (self , scraper_ID , asset_ID ):
256256 return self .scraper_objs [scraper_ID ].supports_asset_ID (asset_ID )
257257
258- # Menu list to choose scraper.
259- def get_all_scraper_menu_list (self ):
260- log_debug ('ScraperFactory.get_all_scraper_menu_list() Building scraper list...' )
261- scraper_menu_list = []
262- self .all_menu_ID_list = []
263- for scraper_ID in self .scraper_objs :
264- scraper_menu_list .append ('Scrape with {}' .format (self .scraper_objs [scraper_ID ].get_name ()))
265- self .all_menu_ID_list .append (scraper_ID )
266- return scraper_menu_list
267-
268- # Call this function after calling get_all_scraper_menu_list()
269- def get_all_scraper_ID_from_menu_idx (self , menu_index ):
270- return self .all_menu_ID_list [menu_index ]
271-
272258 def get_metadata_scraper_menu_list (self ):
273259 log_debug ('ScraperFactory.get_metadata_scraper_menu_list() Building scraper list...' )
274260 scraper_menu_list = []
@@ -293,25 +279,43 @@ def get_metadata_scraper_ID_from_menu_idx(self, menu_index):
293279 # @return: [list of strings]
294280 def get_asset_scraper_menu_list (self , asset_ID ):
295281 log_debug ('ScraperFactory.get_asset_scraper_menu_list() Building scraper list...' )
296- AInfo = assets_get_info_scheme (asset_ID )
282+ asset_info = assets_get_info_scheme (asset_ID )
297283 scraper_menu_list = []
298284 self .asset_menu_ID_list = []
299285 for scraper_ID in self .scraper_objs :
300286 scraper_obj = self .scraper_objs [scraper_ID ]
301287 s_name = scraper_obj .get_name ()
302288 if scraper_obj .supports_asset_ID (asset_ID ):
303- scraper_menu_list .append ('Scrape {} with {}' .format (AInfo .name , s_name ))
289+ scraper_menu_list .append ('Scrape {} with {}' .format (asset_info .name , s_name ))
304290 self .asset_menu_ID_list .append (scraper_ID )
305- log_debug ('Scraper {} supports asset {} (ENABLED)' .format (s_name , AInfo .name ))
291+ log_debug ('Scraper {} supports asset {} (ENABLED)' .format (s_name , asset_info .name ))
306292 else :
307- log_debug ('Scraper {} lacks asset {} (DISABLED)' .format (s_name , AInfo .name ))
308-
293+ log_debug ('Scraper {} lacks asset {} (DISABLED)' .format (s_name , asset_info .name ))
309294 return scraper_menu_list
310295
311296 # You must call get_asset_scraper_menu_list before calling this function.
312297 def get_asset_scraper_ID_from_menu_idx (self , menu_index ):
313298 return self .asset_menu_ID_list [menu_index ]
314299
300+ # Menu list to choose scraper.
301+ def get_all_asset_scraper_menu_list (self ):
302+ log_debug ('ScraperFactory.get_all_asset_scraper_menu_list() Building scraper list...' )
303+ scraper_menu_list = []
304+ self .all_menu_ID_list = []
305+ for scraper_ID in self .scraper_objs :
306+ scraper_obj = self .scraper_objs [scraper_ID ]
307+ if scraper_obj .supports_assets ():
308+ scraper_menu_list .append ('Scrape with {}' .format (scraper_obj .get_name ()))
309+ self .all_menu_ID_list .append (scraper_ID )
310+ log_debug ('Scraper {} supports assets (ENABLED)' .format (scraper_obj .get_name ()))
311+ else :
312+ log_debug ('Scraper {} lacks assets (DISABLED)' .format (scraper_obj .get_name ()))
313+ return scraper_menu_list
314+
315+ # Call this function after calling get_all_asset_scraper_menu_list()
316+ def get_all_asset_scraper_ID_from_menu_idx (self , menu_index ):
317+ return self .all_menu_ID_list [menu_index ]
318+
315319 # 1) Create the ScraperStrategy object to be used in the ROM Scanner.
316320 #
317321 # 2) Read the addon settings and choose the metadata and asset scrapers selected
@@ -1200,6 +1204,11 @@ def scrap_CM_asset_all(self, object_dic, data_dic, st_dic):
12001204 current_st_dic = kodi_new_status_dic ()
12011205 self ._scrap_CM_scrap_asset (ScrapeStrategy .SCRAPE_ROM , object_dic , data_dic , asset_ID , current_st_dic )
12021206 # Only display status messages here, do no exit in case of error.
1207+ # _scrap_CM_scrap_asset() creates an special field in st_dic to reduce
1208+ # verbosity when scraping all assets.
1209+ if current_st_dic ['scrap_all_assets_do_not_print' ]:
1210+ log_debug ('Do not printing message in GUI due to reduced verbosity (scrape all)' )
1211+ continue
12031212 kodi_display_status_message (current_st_dic )
12041213
12051214 # Display notification in caller.
@@ -1238,9 +1247,10 @@ def _scrap_CM_get_candidate(self, object_name, object_dic, data_dic, st_dic):
12381247 log_debug ('ROM "{}" candidate is empting. Force rescraping.' )
12391248 use_from_cache = False
12401249 else :
1241- ret = kodi_dialog_yesno_custom ('Candidate game in the scraper disk cache. '
1242- 'Use candidate from cache or rescrape?' ,
1243- 'Scrape' , 'Use from cache' )
1250+ t = '{}{}{}' .format (KC_ORANGE , scraper_name , KC_END )
1251+ m = ('Candidate game in the {} scraper disk cache. ' .format (t ) +
1252+ 'Use candidate from scraper cache or rescrape?' )
1253+ ret = kodi_dialog_yesno_custom (m , 'Scrape' , 'Use from cache' )
12441254 use_from_cache = False if ret else True
12451255 else :
12461256 log_debug ('ROM "{}" NOT in candidates cache.' .format (ROM_FN .getBaseNoExt ()))
@@ -1325,6 +1335,11 @@ def _scrap_CM_scrap_asset(self, object_name, object_dic, data_dic, asset_ID, st_
13251335 log_debug ('ScraperStrategy._scrap_CM_scrap_asset() asset_path_noext_FN "{}"' .format (
13261336 asset_path_noext_FN .getOriginalPath ()))
13271337
1338+ # Additional field in st_dic. If this is true then the message must not be printed
1339+ # in the caller function. This is useful to reduce the message verbosity when this
1340+ # function is used to scrape all assets of a ROM.
1341+ st_dic ['scrap_all_assets_do_not_print' ] = False
1342+
13281343 # --- Grab list of images for the selected game -------------------------------------------
13291344 pdialog = KodiProgressDialog ()
13301345 pdialog .startProgress ('Getting {} images from {}...' .format (asset_info .name , scraper_name ))
@@ -1336,6 +1351,7 @@ def _scrap_CM_scrap_asset(self, object_name, object_dic, data_dic, asset_ID, st_
13361351 if not assetdata_list :
13371352 kodi_set_error_status (st_dic , '{}{}{} scraper found no {}{}{} images.' .format (
13381353 KC_GREEN , scraper_name , KC_END , KC_ORANGE , asset_info .name , KC_END ))
1354+ st_dic ['scrap_all_assets_do_not_print' ] = True
13391355 return
13401356
13411357 # If there is a local image add it to the list and show it to the user.
@@ -1372,12 +1388,14 @@ def _scrap_CM_scrap_asset(self, object_name, object_dic, data_dic, asset_ID, st_
13721388 log_debug ('_scrap_CM_scrap_asset() User cancelled image select dialog. Returning.' )
13731389 kodi_set_error_status (st_dic , 'Select dialog canceled. '
13741390 '{} image not changed' .format (asset_info .name ))
1391+ st_dic ['scrap_all_assets_do_not_print' ] = True
13751392 return
13761393 # User chose to keep current asset.
13771394 if local_asset_in_list_flag and image_selected_index == 0 :
13781395 log_debug ('_scrap_CM_scrap_asset() Selected current image "{}"' .format (current_asset_FN .getPath ()))
13791396 kodi_set_error_status (st_dic , 'Selected current asset. '
13801397 '{}{}{} image not changed' .format (KC_ORANGE , asset_info .name , KC_END ))
1398+ st_dic ['scrap_all_assets_do_not_print' ] = True
13811399 return
13821400
13831401 # --- Download scraped image (or use local image) ----------------------------------------
0 commit comments