diff --git a/addon.py b/addon.py index a07c309e..f608b0a9 100644 --- a/addon.py +++ b/addon.py @@ -3,7 +3,7 @@ # Advanced Emulator Launcher main script file # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # Portions (c) 2018 Chrisism # Portions (c) 2010-2015 Angelscry and others # diff --git a/resources/lib/commands/__init__.py b/resources/lib/commands/__init__.py index e50e43fc..7fbfb46c 100644 --- a/resources/lib/commands/__init__.py +++ b/resources/lib/commands/__init__.py @@ -28,3 +28,4 @@ import resources.lib.commands.stats_commands import resources.lib.commands.misc_commands import resources.lib.commands.chk_commands +import resources.lib.commands.report_commands diff --git a/resources/lib/commands/addon_commands.py b/resources/lib/commands/addon_commands.py index 4fd2a145..b75907e0 100644 --- a/resources/lib/commands/addon_commands.py +++ b/resources/lib/commands/addon_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (import & export of configurations) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/category_commands.py b/resources/lib/commands/category_commands.py index f049e745..8204aee6 100644 --- a/resources/lib/commands/category_commands.py +++ b/resources/lib/commands/category_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (category management) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/chk_commands.py b/resources/lib/commands/chk_commands.py index 5e7a67bc..6388f551 100644 --- a/resources/lib/commands/chk_commands.py +++ b/resources/lib/commands/chk_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (check data) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/misc_commands.py b/resources/lib/commands/misc_commands.py index 83b3a4aa..f295fce1 100644 --- a/resources/lib/commands/misc_commands.py +++ b/resources/lib/commands/misc_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (miscellaneous) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/report_commands.py b/resources/lib/commands/report_commands.py new file mode 100644 index 00000000..ac17f3d9 --- /dev/null +++ b/resources/lib/commands/report_commands.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +# +# Advanced Emulator Launcher: Commands (reporting) +# +# Copyright (c) Wintermute0110 / Chrisism +# +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# --- Python standard library --- +from __future__ import unicode_literals +from __future__ import division + +import logging + +from ael.utils import kodi, text + +from resources.lib.commands.mediator import AppMediator + +from resources.lib.repositories import CategoryRepository, ROMCollectionRepository, UnitOfWork +from resources.lib import globals + +logger = logging.getLogger(__name__) + +@AppMediator.register('GLOBAL_ROM_STATS') +def cmd_report_global_rom_stats(args): + window_title = 'Global ROM statistics' + sl = [] + # sl.append('[COLOR violet]Launcher ROM report.[/COLOR]') + # sl.append('') + + # --- Table header --- + table_str = [ + ['left', 'left', 'left'], + ['Category', 'Collection', 'ROMs'], + ] + + uow = UnitOfWork(globals.g_PATHS.DATABASE_FILE_PATH) + with uow: + category_repository = CategoryRepository(uow) + romcollections_repository = ROMCollectionRepository(uow) + + categories = [*category_repository.find_all_categories()] + collection_count = romcollections_repository.count_collections() + + # Traverse categories and sort alphabetically. + logger.debug(f'Number of categories {len(categories)}') + logger.debug(f'Number of collections {collection_count}') + + for category in categories: + # Get collection of this category alphabetically sorted. + collections_by_category = romcollections_repository.find_romcollections_by_parent(category.get_id()) + # Render list of launchers for this category. + for collection in collections_by_category: + table_str.append([category.get_name(), collection.get_name(), str(collection.num_roms())]) + + # Traverse categoryless launchers. + root_collections = romcollections_repository.find_root_romcollections() + for collection in root_collections: + table_str.append(['', collection.get_name(), str(collection.num_roms())]) + + # Generate table and print report + # logger.debug(unicode(table_str)) + sl.extend(text.render_table_str(table_str)) + kodi.display_text_window_mono(window_title, '\n'.join(sl)) \ No newline at end of file diff --git a/resources/lib/commands/rom_commands.py b/resources/lib/commands/rom_commands.py index ace0690d..d02f43b4 100644 --- a/resources/lib/commands/rom_commands.py +++ b/resources/lib/commands/rom_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (ROM management) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/rom_launcher_commands.py b/resources/lib/commands/rom_launcher_commands.py index 6871cb17..b475da22 100644 --- a/resources/lib/commands/rom_launcher_commands.py +++ b/resources/lib/commands/rom_launcher_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (romcollection launcher management) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/rom_scanner_commands.py b/resources/lib/commands/rom_scanner_commands.py index cdce6545..82368398 100644 --- a/resources/lib/commands/rom_scanner_commands.py +++ b/resources/lib/commands/rom_scanner_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (romcollection scanner management) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/rom_scraper_commands.py b/resources/lib/commands/rom_scraper_commands.py index 6dd94d88..84ac458e 100644 --- a/resources/lib/commands/rom_scraper_commands.py +++ b/resources/lib/commands/rom_scraper_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (ROM scraper management) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/romcollection_commands.py b/resources/lib/commands/romcollection_commands.py index 75af4077..9aa829a4 100644 --- a/resources/lib/commands/romcollection_commands.py +++ b/resources/lib/commands/romcollection_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (romcollection management) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/romcollection_roms_commands.py b/resources/lib/commands/romcollection_roms_commands.py index 3a087933..5bb3527e 100644 --- a/resources/lib/commands/romcollection_roms_commands.py +++ b/resources/lib/commands/romcollection_roms_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (romcollection roms management) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/stats_commands.py b/resources/lib/commands/stats_commands.py index 1fa319da..eb7e8a90 100644 --- a/resources/lib/commands/stats_commands.py +++ b/resources/lib/commands/stats_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (generating stats and counts) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/commands/view_rendering_commands.py b/resources/lib/commands/view_rendering_commands.py index a756ce67..6d9f007b 100644 --- a/resources/lib/commands/view_rendering_commands.py +++ b/resources/lib/commands/view_rendering_commands.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher: Commands (Precompiling the view data) # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/domain.py b/resources/lib/domain.py index 3c474b40..3e4fef18 100644 --- a/resources/lib/domain.py +++ b/resources/lib/domain.py @@ -2,7 +2,7 @@ # # Advanced Emulator Launcher miscellaneous set of objects # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/editors.py b/resources/lib/editors.py index e1b9b78c..b2589872 100644 --- a/resources/lib/editors.py +++ b/resources/lib/editors.py @@ -3,7 +3,7 @@ # Advanced Emulator Launcher: metadata editor actions # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # Portions (c) 2010-2015 Angelscry # # This program is free software; you can redistribute it and/or modify diff --git a/resources/lib/globals.py b/resources/lib/globals.py index eae5250f..695c814a 100644 --- a/resources/lib/globals.py +++ b/resources/lib/globals.py @@ -3,7 +3,7 @@ # Advanced Emulator Launcher: Globals # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # Portions (c) 2010-2015 Angelscry # # This program is free software; you can redistribute it and/or modify diff --git a/resources/lib/report.py b/resources/lib/report.py index 34545e22..4b3b50ac 100644 --- a/resources/lib/report.py +++ b/resources/lib/report.py @@ -3,7 +3,7 @@ # Advanced Emulator Launcher platform and emulator information # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/resources/lib/repositories.py b/resources/lib/repositories.py index d011435f..72bf28f3 100644 --- a/resources/lib/repositories.py +++ b/resources/lib/repositories.py @@ -586,6 +586,7 @@ def _update_asset(self, asset: Asset, category_obj: Category): # # ROMCollectionRepository -> ROM Sets from SQLite DB # +QUERY_COUNT_ROMCOLLECTIONS = "SELECT COUNT(*) as count FROM vw_romcollections" QUERY_SELECT_ROMCOLLECTION = "SELECT * FROM vw_romcollections WHERE id = ?" QUERY_SELECT_ROMCOLLECTIONS = "SELECT * FROM vw_romcollections ORDER BY m_name" QUERY_SELECT_ROOT_ROMCOLLECTIONS = "SELECT * FROM vw_romcollections WHERE parent_id IS NULL ORDER BY m_name" @@ -650,6 +651,12 @@ class ROMCollectionRepository(object): def __init__(self, uow: UnitOfWork): self._uow = uow + def count_collections(self) -> int: + self._uow.execute(QUERY_COUNT_ROMCOLLECTIONS) + count_data = self._uow.single_result() + + return int(count_data['count']) + def find_romcollection(self, romcollection_id: str) -> ROMCollection: self._uow.execute(QUERY_SELECT_ROMCOLLECTION, romcollection_id) romcollection_data = self._uow.single_result() diff --git a/resources/lib/viewqueries.py b/resources/lib/viewqueries.py index 2579c4cc..ec739dc4 100644 --- a/resources/lib/viewqueries.py +++ b/resources/lib/viewqueries.py @@ -3,7 +3,7 @@ # Advanced Emulator Launcher: UI query implementations. Getting data for the UI # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -54,20 +54,20 @@ def qry_get_root_items(): kodi.notify('Building initial views') AppMediator.async_cmd('RENDER_VIEWS') - vcategory_fanart = globals.g_PATHS.FANART_FILE_PATH.getPath() - vcategory_icon = globals.g_PATHS.ADDON_CODE_DIR.pjoin('media/theme/Utilities_icon.png').getPath() - vcategory_poster = globals.g_PATHS.ADDON_CODE_DIR.pjoin('media/theme/Utilities_poster.png').getPath() - art = { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster': vcategory_poster } + listitem_fanart = globals.g_PATHS.FANART_FILE_PATH.getPath() + listitem_icon = globals.g_PATHS.ADDON_CODE_DIR.pjoin('media/theme/Utilities_icon.png').getPath() + listitem_poster = globals.g_PATHS.ADDON_CODE_DIR.pjoin('media/theme/Utilities_poster.png').getPath() + art = { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster': listitem_poster } if not settings.getSettingAsBool('display_hide_utilities'): - vcategory_name = 'Utilities' + listitem_name = 'Utilities' container['items'].append({ - 'name': vcategory_name, + 'name': listitem_name, 'url': globals.router.url_for_path('utilities'), 'is_folder': True, 'type': 'video', 'info': { - 'title': vcategory_name, + 'title': listitem_name, 'plot': 'Execute several [COLOR orange]Utilities[/COLOR].', 'overlay': 4 }, @@ -76,16 +76,16 @@ def qry_get_root_items(): }) if not settings.getSettingAsBool('display_hide_g_reports'): - vcategory_name = 'Global Reports' - vcategory_icon = globals.g_PATHS.ICON_FILE_PATH.getPath() - vcategory_fanart = globals.g_PATHS.FANART_FILE_PATH.getPath() + listitem_name = 'Global Reports' + listitem_icon = globals.g_PATHS.ICON_FILE_PATH.getPath() + listitem_fanart = globals.g_PATHS.FANART_FILE_PATH.getPath() container['items'].append({ - 'name': vcategory_name, + 'name': listitem_name, 'url': globals.router.url_for_path('globalreports'), #SHOW_GLOBALREPORTS_VLAUNCHERS' 'is_folder': True, 'type': 'video', 'info': { - 'title': vcategory_name, + 'title': listitem_name, 'plot': 'Generate and view [COLOR orange]Global Reports[/COLOR].', 'overlay': 4 }, @@ -108,9 +108,9 @@ def qry_get_view_items(view_id: str, is_virtual_view=False): # def qry_get_utilities_items(): # --- Common artwork for all Utilities VLaunchers --- - vcategory_icon = globals.g_PATHS.ADDON_CODE_DIR.pjoin('media/theme/Utilities_icon.png').getPath() - vcategory_fanart = globals.g_PATHS.FANART_FILE_PATH.getPath() - vcategory_poster = globals.g_PATHS.ADDON_CODE_DIR.pjoin('media/theme/Utilities_poster.png').getPath() + listitem_icon = globals.g_PATHS.ADDON_CODE_DIR.pjoin('media/theme/Utilities_icon.png').getPath() + listitem_fanart = globals.g_PATHS.FANART_FILE_PATH.getPath() + listitem_poster = globals.g_PATHS.ADDON_CODE_DIR.pjoin('media/theme/Utilities_poster.png').getPath() container = { 'id': '', @@ -133,7 +133,7 @@ def qry_get_utilities_items(): 'plot': 'Reset the AEL database. You will loose all data.', 'overlay': 4 }, - 'art': { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster' : vcategory_poster }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } }) container['items'].append({ @@ -146,12 +146,12 @@ def qry_get_utilities_items(): 'plot': 'Rebuild all the container views in the application', 'overlay': 4 }, - 'art': { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster' : vcategory_poster }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } }) container['items'].append({ 'name': 'Rebuild virtual views', - 'url': globals.router.url_for_path('execute/command/render_vcategory_views'), + 'url': globals.router.url_for_path('execute/command/render_listitem_views'), 'is_folder': False, 'type': 'video', 'info': { @@ -159,7 +159,7 @@ def qry_get_utilities_items(): 'plot': 'Rebuild all the virtual categories and collections in the container', 'overlay': 4 }, - 'art': { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster' : vcategory_poster }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } }) container['items'].append({ @@ -172,7 +172,7 @@ def qry_get_utilities_items(): 'plot': 'Scan for addons that can be used by AEL (launchers, scrapers etc.)', 'overlay': 4 }, - 'art': { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster' : vcategory_poster }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } }) container['items'].append({ @@ -185,7 +185,7 @@ def qry_get_utilities_items(): 'plot': 'Execute several [COLOR orange]Utilities[/COLOR].', 'overlay': 4 }, - 'art': { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster' : vcategory_poster }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } }) container['items'].append({ @@ -200,7 +200,7 @@ def qry_get_utilities_items(): 'You can later reimport this XML file.'), 'overlay': 4 }, - 'art': { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster' : vcategory_poster }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } }) container['items'].append({ @@ -214,7 +214,7 @@ def qry_get_utilities_items(): 'wrong platform names, asset path existence, etc.'), 'overlay': 4 }, - 'art': { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster' : vcategory_poster }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } }) container['items'].append({ @@ -229,7 +229,7 @@ def qry_get_utilities_items(): 'and size is greater than 0. You can delete corrupted images to be rescraped later.'), 'overlay': 4 }, - 'art': { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster' : vcategory_poster }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } }) container['items'].append({ @@ -243,7 +243,7 @@ def qry_get_utilities_items(): '[COLOR orange]redundant ROMs artwork[/COLOR]. You may delete these unneeded images.'), 'overlay': 4 }, - 'art': { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster' : vcategory_poster }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } }) container['items'].append({ @@ -258,12 +258,90 @@ def qry_get_utilities_items(): '[COLOR orange]AEL addon settings[/COLOR], [COLOR=orange]ROM Audit[/COLOR] tab.'), 'overlay': 4 }, - 'art': { 'icon' : vcategory_icon, 'fanart' : vcategory_fanart, 'poster' : vcategory_poster }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } }) return container +# +# Global Reports items +# +def qry_get_globalreport_items(): + # --- Common artwork for all Utilities VLaunchers --- + listitem_icon = globals.g_PATHS.ADDON_CODE_DIR.pjoin('media/theme/Global_Reports_icon.png').getPath() + listitem_fanart = globals.g_PATHS.FANART_FILE_PATH.getPath() + listitem_poster = globals.g_PATHS.ADDON_CODE_DIR.pjoin('media/theme/Global_Reports_poster.png').getPath() + + container = { + 'id': '', + 'name': 'globalreports', + 'obj_type': constants.OBJ_NONE, + 'items': [] + } + + # --- Global ROM statistics --- + container['items'].append({ + 'name': 'Global ROM statistics', + 'url': globals.router.url_for_path('execute/command/global_rom_stats'), + 'is_folder': False, + 'type': 'video', + 'info': { + 'title': 'Global ROM statistics', + 'plot': 'Shows a report of all ROM collections with number of ROMs.', + 'overlay': 4 + }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, + 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } + }) + + # --- Global ROM Audit statistics --- + container['items'].append({ + 'name': 'Global ROM Audit statistics (All)', + 'url': globals.router.url_for_path('execute/command/EXECUTE_GLOBAL_AUDIT_STATS_ALL'), + 'is_folder': False, + 'type': 'video', + 'info': { + 'title': 'Global ROM Audit statistics (All)', + 'plot': ('Shows a report of all audited ROM collections, with Have, Miss and Unknown ' + 'statistics.'), + 'overlay': 4 + }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, + 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } + }) + + container['items'].append({ + 'name': 'Global ROM Audit statistics (No-Intro only)', + 'url': globals.router.url_for_path('execute/command/EXECUTE_GLOBAL_AUDIT_STATS_NOINTRO'), + 'is_folder': False, + 'type': 'video', + 'info': { + 'title': 'Global ROM Audit statistics (No-Intro only)', + 'plot': ('Shows a report of all audited ROM Launchers, with Have, Miss and Unknown ' + 'statistics. Only No-Intro platforms (cartridge-based) are reported.'), + 'overlay': 4 + }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, + 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } + }) + + container['items'].append({ + 'name': 'Global ROM Audit statistics (Redump only)', + 'url': globals.router.url_for_path('execute/command/EXECUTE_GLOBAL_AUDIT_STATS_REDUMP'), + 'is_folder': False, + 'type': 'video', + 'info': { + 'title': 'Global ROM Audit statistics (Redump only)', + 'plot': ('Shows a report of all audited ROM Launchers, with Have, Miss and Unknown ' + 'statistics. Only Redump platforms (optical-based) are reported.'), + 'overlay': 4 + }, + 'art': { 'icon' : listitem_icon, 'fanart' : listitem_fanart, 'poster' : listitem_poster }, + 'properties': { constants.AEL_CONTENT_LABEL: constants.AEL_CONTENT_VALUE_NONE, 'obj_type': constants.OBJ_NONE } + }) + return container + # # Default context menu items for the whole container. # @@ -292,7 +370,7 @@ def qry_container_context_menu_items(container_data) -> typing.List[typing.Tuple _context_menu_url_for('execute/command/render_romcollection_view', {'romcollection_id':container_id}))) if is_virtual_category and not is_root: commands.append(('Rebuild {} view'.format(container_name), - _context_menu_url_for('execute/command/render_vcategory_view',{'vcategory_id':container_id}))) + _context_menu_url_for('execute/command/render_vcategory_view',{'vcategory_id':container_id}))) if is_virtual_collection: commands.append(('Rebuild {} view'.format(container_name), _context_menu_url_for('execute/command/render_vcategory_view',{'vcategory_id':container_parentid}))) diff --git a/resources/lib/views.py b/resources/lib/views.py index d8e1ee05..46407b06 100644 --- a/resources/lib/views.py +++ b/resources/lib/views.py @@ -3,7 +3,7 @@ # Advanced Emulator Launcher main script file. # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # Portions (c) 2010-2015 Angelscry # # This program is free software; you can redistribute it and/or modify @@ -130,12 +130,20 @@ def vw_route_render_virtual_view(view_id: str): # Utilities and Global reports # ------------------------------------------------------------------------------------------------- @router.route('/utilities') -def vw_route_render_utilities_vlaunchers(): +def vw_route_render_utilities(): container = viewqueries.qry_get_utilities_items() container_context_items = viewqueries.qry_container_context_menu_items(container) render_list_items(container, container_context_items) xbmcplugin.endOfDirectory(handle = router.handle, succeeded = True, cacheToDisc = False) + +@router.route('/globalreports') +def vw_route_render_globalreports(): + container = viewqueries.qry_get_globalreport_items() + container_context_items = viewqueries.qry_container_context_menu_items(container) + + render_list_items(container, container_context_items) + xbmcplugin.endOfDirectory(handle = router.handle, succeeded = True, cacheToDisc = False) # ------------------------------------------------------------------------------------------------- # Command execution diff --git a/tests/__init__.py b/tests/__init__.py index 77b0d404..07b2b47a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -3,7 +3,7 @@ # Advanced Emulator Launcher package inisialisation file. # -# Copyright (c) 2016-2018 Wintermute0110 +# Copyright (c) Wintermute0110 / Chrisism # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by