From 7149241b382164a4066a8d36066ea474b6e9d9bc Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Mon, 10 Oct 2016 03:36:02 -0500 Subject: [PATCH] Fix remove (forgot to re-add it with the code reduction pull request) --- resources/lib/itemtypes.py | 9 ++------- resources/lib/objects/common.py | 8 ++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 6748debd..6c771ee2 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -111,17 +111,12 @@ class Items(object): update_videolibrary = True items_process = itemtypes[itemtype](embycursor, kodicursor, pdialog) - ''' - - if actions.get(process): - - if process == "remove": - for item in itemlist: - actions[process](item)''' if process == "added": processItems = itemlist items_process.add_all(itemtype, itemlist) + elif process == "remove": + items_process.remove_all(itemtype, itemlist) else: processItems = emby.getFullItems(itemlist) items_process.process_all(itemtype, process, processItems, total) diff --git a/resources/lib/objects/common.py b/resources/lib/objects/common.py index 797c0607..15e39e76 100644 --- a/resources/lib/objects/common.py +++ b/resources/lib/objects/common.py @@ -106,6 +106,14 @@ class Items(object): process(item) self.count += 1 + def remove_all(self, item_type, items): + + log.debug("Processing removal: %s", items) + + process = self._get_func(item_type, "remove") + for item in items: + process(item) + def added(self, items, total=None, update=True): # Generator for newly added content if update: