From db0e84f78645578572365e687c1ea9dc3e7e1209 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Tue, 18 Oct 2016 03:17:08 -0500 Subject: [PATCH] Create central compare --- resources/lib/objects/_common.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/resources/lib/objects/_common.py b/resources/lib/objects/_common.py index 92158826..fa618c59 100644 --- a/resources/lib/objects/_common.py +++ b/resources/lib/objects/_common.py @@ -134,7 +134,29 @@ class Items(object): if update: self.count += 1 - def compare_checksum(self, items, compare_to): + def compare(self, item_type, items, compare_to, view=None): + + view_name = view['name'] if view else item_type + + update_list = self._compare_checksum(items, compare_to) + log.info("Update for %s: %s", view_name, update_list) + + emby_items = self.emby.getFullItems(update_list) + total = len(update_list) + + if self.pdialog: + self.pdialog.update(heading="Processing %s / %s items" % (view_name, total)) + + # Process additions and updates + if emby_items: + self.added(emby_items, total, view) + # Process deletes + if compare_to: + self.remove_all(item_type, compare_to.items()) + + return True + + def _compare_checksum(self, items, compare_to): update_list = list()