From ede0325224a5d802837c041aaeefbbd4c1e6b7f4 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 2 Aug 2021 10:24:13 -0400 Subject: [PATCH] fixed custom sort --- modules/builder.py | 12 +++--------- modules/plex.py | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/modules/builder.py b/modules/builder.py index c2bdaa6b..31bb0a3e 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1808,15 +1808,9 @@ class CollectionBuilder: previous = None logger.debug(keys) logger.debug(self.rating_keys) - for ki, key in enumerate(self.rating_keys): - logger.debug(items) - if key != items[ki].ratingKey: - logger.info(f"Moving {keys[key].title} {'after {}'.format(keys[previous].title) if previous else 'to the beginning'}") - self.library.moveItem(self.obj, key, after=previous) - for ii, item in enumerate(items): - if key == item.ratingKey: - items.insert(ki, items.pop(ii)) - break + for key in self.rating_keys: + logger.info(f"Moving {keys[key].title} {'after {}'.format(keys[previous].title) if previous else 'to the beginning'}") + self.library.move_item(self.obj, key, after=previous) previous = key def run_collections_again(self): diff --git a/modules/plex.py b/modules/plex.py index d0a9d106..952fffe4 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -491,7 +491,7 @@ class Plex: else: method = None return self.Plex._server.query(key, method=method) - def moveItem(self, collection, item, after=None): + def move_item(self, collection, item, after=None): key = f"{collection.key}/items/{item}/move" if after: key += f"?after={after}"