Clean up views

Remove libraries from db when they don't exist anymore
This commit is contained in:
angelblue05 2018-09-06 15:03:02 -05:00
parent ce81a1fc33
commit 01450154fe
2 changed files with 9 additions and 1 deletions

View file

@ -376,6 +376,7 @@ class Library(threading.Thread):
return False return False
Views().get_views()
Views().get_nodes() Views().get_nodes()
return True return True

View file

@ -117,7 +117,6 @@ class Views(object):
self.delete_playlist_by_id(view_id) self.delete_playlist_by_id(view_id)
self.delete_node_by_id(view_id) self.delete_node_by_id(view_id)
self.get_views()
def get_views(self): def get_views(self):
@ -146,6 +145,14 @@ class Views(object):
self.add_library(library) self.add_library(library)
with Database('emby') as embydb:
views = emby_db.EmbyDatabase(embydb.cursor).get_views()
for view in views:
if view[0] not in self.sync['SortedViews']:
self.remove_library(view[0])
save_sync(self.sync) save_sync(self.sync)
def get_nodes(self): def get_nodes(self):