Aggiornamento Selezione Visualizzazione

This commit is contained in:
Alhaziel01
2020-04-03 23:20:58 +02:00
parent b179939a83
commit d4fc6f1ada
6 changed files with 282 additions and 111 deletions

View File

@@ -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):
"""

View File

@@ -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/', '/%/')

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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()