added deleted to the collection webhook

pull/494/head
meisnate12 3 years ago
parent 3abfae7f79
commit af96c2544a

@ -213,6 +213,7 @@ class CollectionBuilder:
self.current_year = self.current_time.year
self.exists = False
self.created = False
self.deleted = False
methods = {m.lower(): m for m in self.data}
@ -444,6 +445,7 @@ class CollectionBuilder:
try:
self.obj = self.library.get_collection(self.name)
self.delete_collection()
self.deleted = True
suffix = f" and was deleted"
except Failed:
suffix = f" and could not be found to delete"
@ -2180,6 +2182,7 @@ class CollectionBuilder:
self.details["collection_changes_webhooks"],
self.obj,
created=self.created,
deleted=self.deleted,
additions=self.notification_additions,
removals=self.notification_removals
)

@ -70,7 +70,7 @@ class Webhooks:
json["collection"] = str(collection)
self._request(self.error_webhooks, json)
def collection_hooks(self, webhooks, collection, created=False, additions=None, removals=None):
def collection_hooks(self, webhooks, collection, created=False, deleted=False, additions=None, removals=None):
if self.library:
thumb = None
if collection.thumb and next((f for f in collection.fields if f.name == "thumb"), None):
@ -84,6 +84,7 @@ class Webhooks:
"type": "movie" if self.library.is_movie else "show",
"collection": collection.title,
"created": created,
"deleted": deleted,
"poster": thumb,
"background": art
}

@ -679,7 +679,7 @@ def run_collection(config, library, metadata, requested_collections):
logger.info(f"Collection Minimum: {builder.minimum} not met for {mapping_name} Collection")
if builder.details["delete_below_minimum"] and builder.obj:
builder.delete_collection()
stats["deleted"] += 1
builder.deleted = True
logger.info("")
logger.info(f"Collection {builder.obj.title} deleted")
@ -711,6 +711,9 @@ def run_collection(config, library, metadata, requested_collections):
library.run_sort.append(builder)
# builder.sort_collection()
if builder.deleted:
stats["deleted"] += 1
if builder.server_preroll is not None:
library.set_server_preroll(builder.server_preroll)
logger.info("")

Loading…
Cancel
Save