|
|
|
@ -303,8 +303,11 @@ class Plex(Library):
|
|
|
|
|
return method(data)
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed)
|
|
|
|
|
def query_collection(self, item, collection, locked=True):
|
|
|
|
|
item.addCollection(collection, locked=locked)
|
|
|
|
|
def query_collection(self, item, collection, locked=True, add=True):
|
|
|
|
|
if add:
|
|
|
|
|
item.addCollection(collection, locked=locked)
|
|
|
|
|
else:
|
|
|
|
|
item.removeCollection(collection, locked=locked)
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
|
def collection_mode_query(self, collection, data):
|
|
|
|
@ -384,15 +387,15 @@ class Plex(Library):
|
|
|
|
|
else: method = None
|
|
|
|
|
return self.Plex._server.query(key, method=method)
|
|
|
|
|
|
|
|
|
|
def add_to_collection(self, item, collection, smart_label_collection=False):
|
|
|
|
|
def alter_collection(self, item, collection, smart_label_collection=False, add=True):
|
|
|
|
|
if smart_label_collection:
|
|
|
|
|
self.query_data(item.addLabel, collection)
|
|
|
|
|
self.query_data(item.addLabel if add else item.removeLabel, collection)
|
|
|
|
|
else:
|
|
|
|
|
locked = True
|
|
|
|
|
if self.agent in ["tv.plex.agents.movie", "tv.plex.agents.series"]:
|
|
|
|
|
field = next((f for f in item.fields if f.name == "collection"), None)
|
|
|
|
|
locked = field is not None
|
|
|
|
|
self.query_collection(item, collection, locked=locked)
|
|
|
|
|
self.query_collection(item, collection, locked=locked, add=add)
|
|
|
|
|
|
|
|
|
|
def move_item(self, collection, item, after=None):
|
|
|
|
|
key = f"{collection.key}/items/{item}/move"
|
|
|
|
|