From d4fc6f1ada4b01ed4a55a97144672fdda405a05b Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Fri, 3 Apr 2020 23:20:58 +0200 Subject: [PATCH] Aggiornamento Selezione Visualizzazione --- platformcode/platformtools.py | 81 +++++++++++----------- platformcode/xbmc_videolibrary.py | 17 ++--- resources/views/skin.arctic.zephyr.2.json | 81 ++++++++++++++++++++++ resources/views/skin.aura.json | 78 +++++++++++++++++++++ resources/views/skin.estuary.json | 54 +++++++++++++++ specials/shortcuts.py | 82 ++++++----------------- 6 files changed, 282 insertions(+), 111 deletions(-) create mode 100644 resources/views/skin.arctic.zephyr.2.json create mode 100644 resources/views/skin.aura.json create mode 100644 resources/views/skin.estuary.json diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index bdb0bd95..6bc2f740 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -209,8 +209,9 @@ def render_items(itemlist, parent_item): xbmcplugin.setPluginCategory(handle=_handle, category=breadcrumb) # from core.support import dbg;dbg() + set_view_mode(item, parent_item) - + xbmcplugin.endOfDirectory(_handle) # Fijar la vista if config.get_setting("forceview"): @@ -222,50 +223,50 @@ def render_items(itemlist, parent_item): def set_view_mode(item, parent_item): - # from core.support import dbg;dbg() - if (item.contentType in ['movie'] and parent_item.action in ['peliculas']) \ - or (item.channel in ['videolibrary'] and parent_item.action in ['list_movies']): - mode = config.get_setting('view_mode_movie') + def mode(content, Type): + # from core.support import dbg;dbg() + mode = int(config.get_setting('view_mode_%s' % content).split(',')[-1]) if mode > 0: - xbmcplugin.setContent(handle=int(sys.argv[1]), content='movies') - xbmc.executebuiltin('Container.SetViewMode(%s)' % mode) - elif (item.contentType in ['tvshow'] and parent_item.action in ['peliculas']) \ - or (item.channel in ['videolibrary'] and parent_item.action in ['list_tvshows']): - mode = config.get_setting('view_mode_tvshow') - if mode > 0: - xbmcplugin.setContent(handle=int(sys.argv[1]), content='tvshows') - xbmc.executebuiltin('Container.SetViewMode(%s)' % mode) - elif parent_item.action in ['get_seasons']: - mode = config.get_setting('view_mode_season') - if mode > 0: - xbmcplugin.setContent(handle=int(sys.argv[1]), content='tvshows') - xbmc.executebuiltin('Container.SetViewMode(%s)' % mode) - elif parent_item.action in ['episodios', 'get_episodes']: - mode = config.get_setting('view_mode_episode') - if mode > 0: - xbmcplugin.setContent(handle=int(sys.argv[1]), content='tvshows') - xbmc.executebuiltin('Container.SetViewMode(%s)' % mode) - elif parent_item.action == 'findvideos': - mode = config.get_setting('view_mode_server') - if mode > 0: - xbmcplugin.setContent(handle=int(sys.argv[1]), content='addons') - xbmc.executebuiltin('Container.SetViewMode(%s)' % mode) - else: - mode = config.get_setting('view_mode_addon') - if mode > 0: - xbmcplugin.setContent(handle=int(sys.argv[1]), content='addons') + xbmcplugin.setContent(handle=int(sys.argv[1]), content=Type) xbmc.executebuiltin('Container.SetViewMode(%s)' % mode) + logger.info('TYPE: ' + Type) else: xbmcplugin.setContent(handle=int(sys.argv[1]), content='') - # content = 'movies' if item.contentType in ['movie'] and parent_item.action == 'peliculas'\ - # else 'tvshows' if item.contentType in ['tvshow'] and parent_item.action == 'peliculas' \ - # else 'tvshows' if parent_item.action == 'episodios' \ - # else 'addons' if parent_item.action in ['findvideos'] \ - # else 'addons' + xbmc.executebuiltin('Container.SetViewMode(%s)' % 55) + logger.info('TYPE: ' + 'None') + + def reset_view_mode(): + for mode in ['addon','channel','movie','tvshow','season','episode','server']: + config.set_setting('view_mode_%s' % mode, config.get_localized_string(70003) + ' , 0') + + if xbmc.getSkinDir() != config.get_setting('skin_name') or not config.get_setting('skin_name'): + reset_view_mode() + xbmcplugin.setContent(handle=int(sys.argv[1]), content='') + xbmc.executebuiltin('Container.SetViewMode(%s)' % 55) + + elif (item.contentType in ['movie'] and parent_item.action in ['peliculas']) \ + or (item.channel in ['videolibrary'] and parent_item.action in ['list_movies']): + mode('movie', 'movies') + + elif (item.contentType in ['tvshow'] and parent_item.action in ['peliculas']) \ + or (item.channel in ['videolibrary'] and parent_item.action in ['list_tvshows']): + mode('tvshow', 'tvshow') + + elif parent_item.action in ['get_seasons']: + mode('season', 'tvshow') + + elif parent_item.action in ['episodios', 'get_episodes']: + mode('episode', 'tvshow') + + elif parent_item.action == 'findvideos': + mode('server', 'addons') + + elif parent_item.action == 'mainlist': + mode('channel', 'addons') + + else: + mode('addon', 'addons') - # logger.info('Content: ' + content + ' - Action: ' + parent_item.action) - # xbmcplugin.setContent(handle=int(sys.argv[1]), content=content) - # xbmc.executebuiltin('Container.SetViewMode(%s)') def render_items_old(itemlist, parent_item): """ diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index 378d8c2d..3641e039 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -803,22 +803,23 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder, path = path.replace(old,new) if sep == '/': path = path.replace('\\','/') else: path = path.replace('/','\\') + if path.endswith(sep + sep): path = path[:-1] return path logger.info() - new = new_path + # new = new_path old = current_path # rename main path for search in the DB - if new.startswith("special://") or scrapertools.find_single_match(new, r'(^\w+:\/\/)'): - new = new.replace('/profile/', '/%/').replace('/home/userdata/', '/%/') - sep = '/' - else: - sep = os.sep - if not new.endswith(sep): - new += sep + # if new.startswith("special://") or scrapertools.find_single_match(new, r'(^\w+:\/\/)'): + # new = new.replace('/profile/', '/%/').replace('/home/userdata/', '/%/') + # sep = '/' + # else: + # sep = os.sep + # if not new.endswith(sep): + # new += sep if old.startswith("special://") or scrapertools.find_single_match(old, r'(^\w+:\/\/)'): old = old.replace('/profile/', '/%/').replace('/home/userdata/', '/%/') diff --git a/resources/views/skin.arctic.zephyr.2.json b/resources/views/skin.arctic.zephyr.2.json new file mode 100644 index 00000000..4c3e2e13 --- /dev/null +++ b/resources/views/skin.arctic.zephyr.2.json @@ -0,0 +1,81 @@ +{ + "all":{ + "List": 50, + "MediaInfo": 501, + "MediaInfo 2": 502, + "Tri-Panel": 504, + "Banner List": 503, + "Poster Wall": 51, + "Landscape Wall": 511, + "Info Wall": 514, + "Info Wall 2": 516, + "Landscape Wall Small": 515, + "Poster Showcase": 52, + "Landscape Showcase": 521, + "Poster": 53, + "Lovefilm": 523, + "Seasons Info": 522, + "Seasons Info 2": 524, + "Square Wall": 510, + "Icon Wall": 512 + }, + "movie":{ + "List": 50, + "MediaInfo": 501, + "MediaInfo 2": 502, + "Tri-Panel": 504, + "Banner List": 503, + "Poster Wall": 51, + "Landscape Wall": 511, + "Info Wall": 514, + "Info Wall 2": 516, + "Landscape Wall Small": 515, + "Poster Showcase": 52, + "Landscape Showcase": 521, + "Poster": 53, + "Lovefilm": 523 + }, + "tvshow":{ + "List": 50, + "MediaInfo": 501, + "MediaInfo 2": 502, + "Tri-Panel": 504, + "Banner List": 503, + "Poster Wall": 51, + "Landscape Wall": 511, + "Info Wall": 514, + "Info Wall 2": 516, + "Landscape Wall Small": 515, + "Poster Showcase": 52, + "Landscape Showcase": 521, + "Poster": 53, + "Lovefilm": 523 + }, + "season":{ + "List": 50, + "Banner List": 503, + "Poster Wall": 51, + "Info Wall": 514, + "Info Wall 2": 516, + "Poster Showcase": 52, + "Seasons Info": 522, + "Seasons Info 2": 524, + "Poster": 53 + }, + "episode":{ + "List": 50, + "MediaInfo": 501, + "MediaInfo 2": 502, + "Tri-Panel": 504, + "Banner List": 503, + "Landscape Wall": 511, + "Info Wall 2": 516, + "Landscape Wall Small": 515, + "Landscape Showcase": 521 + }, + "addon":{ + "List": 50, + "Square Wall": 510, + "Icon Wall": 512 + } +} \ No newline at end of file diff --git a/resources/views/skin.aura.json b/resources/views/skin.aura.json new file mode 100644 index 00000000..83f8dc08 --- /dev/null +++ b/resources/views/skin.aura.json @@ -0,0 +1,78 @@ +{ + "all":{ + "List": 50, + "Poster Wall": 51, + "Landscape Wall": 52, + "Square Wall": 53, + "Banner Wall": 54, + "Showcase": 55, + "Landscape Showcase": 56, + "Square Showcase": 57, + "Big Posters": 58, + "Lovefilm": 59, + "Media Info": 500, + "info List": 501, + "Episode List": 502, + "Square Wall Large": 503 + }, + "movie":{ + "List": 50, + "Poster Wall": 51, + "Landscape Wall": 52, + "Showcase": 55, + "Landscape Showcase": 56, + "Square Showcase": 57, + "Big Posters": 58, + "Lovefilm": 59, + "Media Info": 500, + "info List": 501, + "Episode List": 502 + }, + "tvshow":{ + "List": 50, + "Poster Wall": 51, + "Landscape Wall": 52, + "Banner Wall": 54, + "Showcase": 55, + "Landscape Showcase": 56, + "Square Showcase": 57, + "Big Posters": 58, + "Lovefilm": 59, + "Media Info": 500, + "info List": 501, + "Episode List": 502 + }, + "season":{ + "List": 50, + "Poster Wall": 51, + "Landscape Wall": 52, + "Banner Wall": 54, + "Showcase": 55, + "Landscape Showcase": 56, + "Square Showcase": 57, + "Big Posters": 58, + "Lovefilm": 59, + "Media Info": 500, + "info List": 501, + "Episode List": 502 + }, + "episode":{ + "List": 50, + "Poster Wall": 51, + "Landscape Wall": 52, + "Banner Wall": 54, + "Showcase": 55, + "Landscape Showcase": 56, + "Square Showcase": 57, + "Big Posters": 58, + "Lovefilm": 59, + "Media Info": 500, + "info List": 501, + "Episode List": 502 + }, + "addon":{ + "List": 50, + "Square Wall": 53, + "Square Wall Large": 503 + } +} \ No newline at end of file diff --git a/resources/views/skin.estuary.json b/resources/views/skin.estuary.json new file mode 100644 index 00000000..f329efb6 --- /dev/null +++ b/resources/views/skin.estuary.json @@ -0,0 +1,54 @@ +{ + "all":{ + "List": 50, + "Poster": 51, + "Shift": 53, + "InfoWall": 54, + "WideList": 55, + "Wall": 500, + "Banner": 501, + "Fanart": 502 + }, + "movie":{ + "List": 50, + "Poster": 51, + "Shift": 53, + "InfoWall": 54, + "WideList": 55, + "Wall": 500, + "Fanart": 502 + }, + "tvshow":{ + "List": 50, + "Poster": 51, + "Shift": 53, + "InfoWall": 54, + "WideList": 55, + "Wall": 500, + "Banner": 501, + "Fanart": 502 + }, + "season":{ + "List": 50, + "Poster": 51, + "Shift": 53, + "InfoWall": 54, + "WideList": 55, + "Wall": 500, + "Fanart": 502 + }, + "episode":{ + "List": 50, + "Poster": 51, + "Shift": 53, + "InfoWall": 54, + "WideList": 55, + "Wall": 500, + "Banner": 501, + "Fanart": 502 + }, + "addon":{ + "WideList": 55, + "Wall": 500 + } +} \ No newline at end of file diff --git a/specials/shortcuts.py b/specials/shortcuts.py index 4d702f5a..e161dc88 100644 --- a/specials/shortcuts.py +++ b/specials/shortcuts.py @@ -32,73 +32,29 @@ def settings_menu(item): def view_mode(item): logger.info(str(item)) import xbmc + from core import filetools, jsontools, support from platformcode import config, platformtools - skin_view_mode ={ - 'skin.estuary':{ - 'movie':{ - 'List': 50, - 'Poster': 51, - # 'IconWall': 52, - 'Shift': 53, - 'InfoWall': 54, - 'WideList': 55, - 'Wall': 500, - # 'Banner': 501, - 'Fanart': 502 - }, - 'tvshow':{ - 'List': 50, - 'Poster': 51, - 'Shift': 53, - 'InfoWall': 54, - 'WideList': 55, - 'Wall': 500, - 'Banner': 501, - 'Fanart': 502 - }, - 'season':{ - 'List': 50, - 'Poster': 51, - 'Shift': 53, - 'InfoWall': 54, - 'WideList': 55, - 'Wall': 500, - 'Fanart': 502 - }, - 'episode':{ - 'List': 50, - 'Poster': 51, - 'Shift': 53, - 'InfoWall': 54, - 'WideList': 55, - 'Wall': 500, - 'Banner': 501, - 'Fanart': 502 - }, - 'server':{ - 'WideList': 55, - 'Wall': 500 - }, - 'addon':{ - 'WideList': 55, - 'Wall': 500 - } - } - } - list_type = [config.get_localized_string(59992)] - skin=xbmc.getSkinDir() - skin = skin_view_mode[xbmc.getSkinDir()][item.type] + skin_name = xbmc.getSkinDir() + config.set_setting('skin_name', skin_name) - for key in skin: - list_type.append(key) + path = filetools.join(config.get_runtime_path(), 'resources', 'views', skin_name + '.json') + if filetools.isfile(path): + json_file = open(path, "r").read() + json = jsontools.load(json_file) - select = platformtools.dialog_select(config.get_localized_string(60552), list_type) - if select > 0: - value = skin[list_type[select]] - else: - value = 0 - config.set_setting('view_mode_%s' % item.type, value) + Type = 'addon'if item.type in ['channel', 'server'] else item.type + skin = json[Type] + + list_type = [] + for key in skin: + list_type.append(key) + list_type.sort() + list_type.insert(0, config.get_localized_string(70003)) + + select = platformtools.dialog_select(config.get_localized_string(70754), list_type) + value = list_type[select] + ' , ' + str(skin[list_type[select]] if list_type[select] in skin else 0) + config.set_setting('view_mode_%s' % item.type, value) def servers_menu(item): # from core.support import dbg; dbg()