Add remove libraries, fix mixed libraries

This commit is contained in:
angelblue05 2018-11-10 14:50:21 -06:00
parent a1851069ed
commit 883c1741bf
4 changed files with 15 additions and 7 deletions

View file

@ -901,3 +901,7 @@ msgstr ""
msgctxt "#33183" msgctxt "#33183"
msgid "Enable the option to play with cinema mode" msgid "Enable the option to play with cinema mode"
msgstr "" msgstr ""
msgctxt "#33184"
msgid "Remove libraries"
msgstr ""

View file

@ -97,6 +97,8 @@ class Events(object):
event('RepairLibrarySelection') event('RepairLibrarySelection')
elif mode == 'updatelibs': elif mode == 'updatelibs':
event('SyncLibrarySelection') event('SyncLibrarySelection')
elif mode == 'removelibs':
event('RemoveLibrarySelection')
elif mode == 'addlibs': elif mode == 'addlibs':
event('AddLibrarySelection') event('AddLibrarySelection')
elif mode == 'connect': elif mode == 'connect':
@ -148,7 +150,7 @@ def listing():
view_id = window('%s.id' % window_prop) view_id = window('%s.id' % window_prop)
context = [] context = []
if view_id and node in ('movies', 'tvshows', 'musicvideos', 'music') and view_id not in whitelist: if view_id and node in ('movies', 'tvshows', 'musicvideos', 'music', 'mixed') and view_id not in whitelist:
label = "%s %s" % (label, _(33166)) label = "%s %s" % (label, _(33166))
context.append((_(33123), "RunPlugin(plugin://plugin.video.emby/?mode=synclib&id=%s)" % view_id)) context.append((_(33123), "RunPlugin(plugin://plugin.video.emby/?mode=synclib&id=%s)" % view_id))
@ -189,6 +191,7 @@ def listing():
directory(_(33154), "plugin://plugin.video.emby/?mode=addlibs", False) directory(_(33154), "plugin://plugin.video.emby/?mode=addlibs", False)
directory(_(33139), "plugin://plugin.video.emby/?mode=updatelibs", False) directory(_(33139), "plugin://plugin.video.emby/?mode=updatelibs", False)
directory(_(33140), "plugin://plugin.video.emby/?mode=repairlibs", False) directory(_(33140), "plugin://plugin.video.emby/?mode=repairlibs", False)
directory(_(33184), "plugin://plugin.video.emby/?mode=removelibs", False)
directory(_(33060), "plugin://plugin.video.emby/?mode=thememedia", False) directory(_(33060), "plugin://plugin.video.emby/?mode=thememedia", False)
directory(_(33058), "plugin://plugin.video.emby/?mode=reset", False) directory(_(33058), "plugin://plugin.video.emby/?mode=reset", False)

View file

@ -223,7 +223,7 @@ class Service(xbmc.Monitor):
'LibraryChanged', 'ServerOnline', 'SyncLibrary', 'RepairLibrary', 'RemoveLibrary', 'LibraryChanged', 'ServerOnline', 'SyncLibrary', 'RepairLibrary', 'RemoveLibrary',
'EmbyConnect', 'SyncLibrarySelection', 'RepairLibrarySelection', 'AddServer', 'EmbyConnect', 'SyncLibrarySelection', 'RepairLibrarySelection', 'AddServer',
'Unauthorized', 'UpdateServer', 'UserConfigurationUpdated', 'ServerRestarting', 'Unauthorized', 'UpdateServer', 'UserConfigurationUpdated', 'ServerRestarting',
'RemoveServer', 'AddLibrarySelection', 'CheckUpdate'): 'RemoveServer', 'AddLibrarySelection', 'CheckUpdate', 'RemoveLibrarySelection'):
return return
data = json.loads(data)[0] data = json.loads(data)[0]
@ -337,7 +337,7 @@ class Service(xbmc.Monitor):
window('emby_should_stop.bool', True) window('emby_should_stop.bool', True)
self.running = False self.running = False
elif method in ('SyncLibrarySelection', 'RepairLibrarySelection', 'AddLibrarySelection'): elif method in ('SyncLibrarySelection', 'RepairLibrarySelection', 'AddLibrarySelection', 'RemoveLibrarySelection'):
self.library_thread.select_libraries(method) self.library_thread.select_libraries(method)
elif method == 'SyncLibrary': elif method == 'SyncLibrary':

View file

@ -442,7 +442,8 @@ class Library(threading.Thread):
modes = { modes = {
'SyncLibrarySelection': 'SyncLibrary', 'SyncLibrarySelection': 'SyncLibrary',
'RepairLibrarySelection': 'RepairLibrary', 'RepairLibrarySelection': 'RepairLibrary',
'AddLibrarySelection': 'SyncLibrary' 'AddLibrarySelection': 'SyncLibrary',
'RemoveLibrarySelection': 'RemoveLibrary'
} }
sync = get_sync() sync = get_sync()
whitelist = [x.replace('Mixed:', "") for x in sync['Whitelist']] whitelist = [x.replace('Mixed:', "") for x in sync['Whitelist']]
@ -451,7 +452,7 @@ class Library(threading.Thread):
with Database('emby') as embydb: with Database('emby') as embydb:
db = emby_db.EmbyDatabase(embydb.cursor) db = emby_db.EmbyDatabase(embydb.cursor)
if mode in ('SyncLibrarySelection', 'RepairLibrarySelection'): if mode in ('SyncLibrarySelection', 'RepairLibrarySelection', 'RemoveLibrarySelection'):
for library in sync['Whitelist']: for library in sync['Whitelist']:
name = db.get_view_name(library.replace('Mixed:', "")) name = db.get_view_name(library.replace('Mixed:', ""))
@ -504,8 +505,8 @@ class Library(threading.Thread):
with Database('emby') as embydb: with Database('emby') as embydb:
db = emby_db.EmbyDatabase(embydb.cursor) db = emby_db.EmbyDatabase(embydb.cursor)
library = db.get_view(library_id) library = db.get_view(library_id.replace('Mixed:', ""))
items = db.get_item_by_media_folder(library_id) items = db.get_item_by_media_folder(library_id.replace('Mixed:', ""))
media = 'music' if library[1] == 'music' else 'video' media = 'music' if library[1] == 'music' else 'video'
if media == 'music': if media == 'music':