Simplify view selection, fix loop

Add new Emby.wnodes props, prevent duplicates, fix
This commit is contained in:
angelblue05 2018-09-10 04:32:17 -05:00
parent 0740dd024b
commit 4670cb426a
5 changed files with 124 additions and 35 deletions

View file

@ -123,6 +123,7 @@ def listing():
'''
total = int(window('Emby.nodes.total') or 0)
sync = get_sync()
whitelist = [x.replace('Mixed:', "") for x in sync['Whitelist']]
servers = get_credentials()['Servers'][1:]
for i in range(total):
@ -139,11 +140,10 @@ def listing():
view_id = window('%s.id' % window_prop)
context = []
if view_id and node in ('movies', 'tvshows', 'musicvideos', 'music') and view_id not in sync['Whitelist']:
if view_id and node in ('movies', 'tvshows', 'musicvideos', 'music') and view_id not in whitelist:
context.append((_(33123), "RunPlugin(plugin://plugin.video.emby?mode=synclib&id=%s)" % view_id))
if view_id and node in ('movies', 'tvshows', 'musicvideos', 'music') and view_id in sync['Whitelist']:
if view_id and node in ('movies', 'tvshows', 'musicvideos', 'music') and view_id in whitelist:
context.append((_(33136), "RunPlugin(plugin://plugin.video.emby?mode=synclib&id=%s)" % view_id))
context.append((_(33132), "RunPlugin(plugin://plugin.video.emby?mode=repairlib&id=%s)" % view_id))

View file

@ -139,7 +139,7 @@ class Service(xbmc.Monitor):
url = "https://sheets.googleapis.com/v4/spreadsheets/1cKWQCVL0lVONulO2KyGzBilzhGvsyuSjFvrqe8g6nJw/values/A2:B?key=AIzaSyAP-1mcBglk9zIofJlqGpvKXkff3GRMhdI"
try:
versions = {k.lower(): v for k, v in dict(requests.get(url, verify=False).json()['values']).items()}
versions = {k.lower(): v for k, v in dict(requests.get(url).json()['values']).items()}
build = find(versions, kodi.lower())
if not build:
@ -284,11 +284,7 @@ class Service(xbmc.Monitor):
if not data.get('Id'):
return
libraries = data['Id'].split(',')
for lib in libraries:
self.library_thread.add_library(lib)
self.library_thread.add_library(data['Id'])
xbmc.executebuiltin("Container.Refresh")
elif method == 'RepairLibrary':
@ -299,8 +295,8 @@ class Service(xbmc.Monitor):
for lib in libraries:
self.library_thread.remove_library(lib)
self.library_thread.add_library(lib)
self.library_thread.add_library(data['Id'])
xbmc.executebuiltin("Container.Refresh")
elif method == 'RemoveLibrary':
@ -398,7 +394,7 @@ class Service(xbmc.Monitor):
"emby_state", "emby_serverStatus",
"emby_syncRunning", "emby_dbCheck",
"emby_currUser", "emby_dbScan",
"emby_initialScan", "emby_playbackProps",
"emby_initialScan",
"emby_play", "emby_online", "emby.connected", "emby_should_stop", "emby.resume",
"emby.external", "emby.external_check"