|
|
@ -362,47 +362,51 @@ class PlexAPI:
|
|
|
|
def get_all_collections(self):
|
|
|
|
def get_all_collections(self):
|
|
|
|
return self.search(libtype="collection")
|
|
|
|
return self.search(libtype="collection")
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def search(self, title=None, libtype=None, sort=None, maxresults=None, **kwargs):
|
|
|
|
def search(self, title=None, libtype=None, sort=None, maxresults=None, **kwargs):
|
|
|
|
return self.Plex.search(title=title, sort=sort, maxresults=maxresults, libtype=libtype, **kwargs)
|
|
|
|
return self.Plex.search(title=title, sort=sort, maxresults=maxresults, libtype=libtype, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
|
|
|
|
def exact_search(self, title, libtype=None):
|
|
|
|
|
|
|
|
return self.Plex.search(libtype=libtype, **{"title=": title})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def get_labeled_items(self, label):
|
|
|
|
def get_labeled_items(self, label):
|
|
|
|
return self.Plex.search(label=label)
|
|
|
|
return self.Plex.search(label=label)
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def fetchItem(self, data):
|
|
|
|
def fetchItem(self, data):
|
|
|
|
return self.PlexServer.fetchItem(data)
|
|
|
|
return self.PlexServer.fetchItem(data)
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def get_all(self):
|
|
|
|
def get_all(self):
|
|
|
|
return self.Plex.all()
|
|
|
|
return self.Plex.all()
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def server_search(self, data):
|
|
|
|
def server_search(self, data):
|
|
|
|
return self.PlexServer.search(data)
|
|
|
|
return self.PlexServer.search(data)
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def query(self, method):
|
|
|
|
def query(self, method):
|
|
|
|
return method()
|
|
|
|
return method()
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def query_data(self, method, data):
|
|
|
|
def query_data(self, method, data):
|
|
|
|
return method(data)
|
|
|
|
return method(data)
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def collection_mode_query(self, collection, data):
|
|
|
|
def collection_mode_query(self, collection, data):
|
|
|
|
collection.modeUpdate(mode=data)
|
|
|
|
collection.modeUpdate(mode=data)
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def collection_order_query(self, collection, data):
|
|
|
|
def collection_order_query(self, collection, data):
|
|
|
|
collection.sortUpdate(sort=data)
|
|
|
|
collection.sortUpdate(sort=data)
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def get_guids(self, item):
|
|
|
|
def get_guids(self, item):
|
|
|
|
return item.guids
|
|
|
|
return item.guids
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def edit_query(self, item, edits, advanced=False):
|
|
|
|
def edit_query(self, item, edits, advanced=False):
|
|
|
|
if advanced:
|
|
|
|
if advanced:
|
|
|
|
item.editAdvanced(**edits)
|
|
|
|
item.editAdvanced(**edits)
|
|
|
@ -410,7 +414,7 @@ class PlexAPI:
|
|
|
|
item.edit(**edits)
|
|
|
|
item.edit(**edits)
|
|
|
|
item.reload()
|
|
|
|
item.reload()
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def upload_image(self, item, location, poster=True, url=True):
|
|
|
|
def upload_image(self, item, location, poster=True, url=True):
|
|
|
|
if poster and url:
|
|
|
|
if poster and url:
|
|
|
|
item.uploadPoster(url=location)
|
|
|
|
item.uploadPoster(url=location)
|
|
|
@ -432,11 +436,11 @@ class PlexAPI:
|
|
|
|
except NotFound:
|
|
|
|
except NotFound:
|
|
|
|
raise Failed(f"Collection Error: plex search attribute: {search_name} only supported with Plex's New TV Agent")
|
|
|
|
raise Failed(f"Collection Error: plex search attribute: {search_name} only supported with Plex's New TV Agent")
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def get_labels(self):
|
|
|
|
def get_labels(self):
|
|
|
|
return {label.title: label.key for label in self.Plex.listFilterChoices(field="label")}
|
|
|
|
return {label.title: label.key for label in self.Plex.listFilterChoices(field="label")}
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
|
|
|
|
def _query(self, key, post=False, put=False):
|
|
|
|
def _query(self, key, post=False, put=False):
|
|
|
|
if post: method = self.Plex._server._session.post
|
|
|
|
if post: method = self.Plex._server._session.post
|
|
|
|
elif put: method = self.Plex._server._session.put
|
|
|
|
elif put: method = self.Plex._server._session.put
|
|
|
@ -707,8 +711,8 @@ class PlexAPI:
|
|
|
|
elif method_name == "filepath":
|
|
|
|
elif method_name == "filepath":
|
|
|
|
jailbreak = False
|
|
|
|
jailbreak = False
|
|
|
|
for location in current.locations:
|
|
|
|
for location in current.locations:
|
|
|
|
for location_prefix in filter_data:
|
|
|
|
for check_text in filter_data:
|
|
|
|
if location.startswith(location_prefix):
|
|
|
|
if check_text.lower() in location.lower():
|
|
|
|
jailbreak = True
|
|
|
|
jailbreak = True
|
|
|
|
break
|
|
|
|
break
|
|
|
|
if jailbreak: break
|
|
|
|
if jailbreak: break
|
|
|
|