mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
[9] add event to webhooks
This commit is contained in:
parent
f2efa8cfd7
commit
73081cca1f
5 changed files with 21 additions and 7 deletions
|
@ -3,6 +3,9 @@
|
|||
# New Features
|
||||
Added new collection_order `custom.desc` ([FR](https://features.metamanager.wiki/features/p/reverse-sort-collectionorder-custom))
|
||||
Added webp Image Support ([FR](https://features.metamanager.wiki/features/p/support-webp-image-extensions))
|
||||
Added Spanish Defaults Translation
|
||||
Added Delete Webhooks
|
||||
|
||||
# Bug Fixes
|
||||
Fixed Italian Translation
|
||||
Fixed Italian Defaults Translation
|
||||
Fixed TMDb Modified Filters
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.18.1-develop8
|
||||
1.18.1-develop9
|
||||
|
|
|
@ -37,6 +37,7 @@ The Error notification will be sent whenever an error occurs. The payload that i
|
|||
|
||||
```yaml
|
||||
{
|
||||
"event": "error", // Event
|
||||
"error": str, // Error Message
|
||||
"critical": bool // Critical Error
|
||||
}
|
||||
|
@ -46,6 +47,7 @@ The Error notification will be sent whenever an error occurs. The payload that i
|
|||
|
||||
```yaml
|
||||
{
|
||||
"event": "error", // Event
|
||||
"error": str, // Error Message
|
||||
"critical": bool, // Critical Error
|
||||
"server_name": str, // Server Name
|
||||
|
@ -57,6 +59,7 @@ The Error notification will be sent whenever an error occurs. The payload that i
|
|||
|
||||
```yaml
|
||||
{
|
||||
"event": "error", // Event
|
||||
"error": str, // Error Message
|
||||
"critical": bool, // Critical Error
|
||||
"server_name": str, // Server Name
|
||||
|
@ -69,6 +72,7 @@ The Error notification will be sent whenever an error occurs. The payload that i
|
|||
|
||||
```yaml
|
||||
{
|
||||
"event": "error", // Event
|
||||
"error": str, // Error Message
|
||||
"critical": bool, // Critical Error
|
||||
"server_name": str, // Server Name
|
||||
|
@ -85,6 +89,7 @@ The Version notification will be sent at the beginning of a run if there is a ne
|
|||
|
||||
```yaml
|
||||
{
|
||||
"event": "version", // Event
|
||||
"current": str, // Current Version
|
||||
"latest": str, // Latest Version
|
||||
"notes": str // Sends the lateset release notes or new commits to develop since your version
|
||||
|
@ -99,6 +104,7 @@ The Run Start notification will be sent at the beginning of every run.
|
|||
|
||||
```yaml
|
||||
{
|
||||
"event": "run_start", // Event
|
||||
"start_time": str, // Time Run is started Format "YY-mm-dd HH:MM:SS"
|
||||
}
|
||||
```
|
||||
|
@ -111,6 +117,7 @@ The Run End notification will be sent at the end of every run with statistics.
|
|||
|
||||
```yaml
|
||||
{
|
||||
"event": "run_end", // Event
|
||||
"start_time": str, // Time Run started Format "YY-mm-dd HH:MM:SS"
|
||||
"end_time": str, // Time Run ended Format "YY-mm-dd HH:MM:SS"
|
||||
"run_time": str, // Time Run took to complete Format "HH:MM"
|
||||
|
@ -136,6 +143,7 @@ The Delete Notification will be sent whenever a collection/playlist is deleted c
|
|||
|
||||
```yaml
|
||||
{
|
||||
"event": "delete", // Event
|
||||
"message": str, // Status Message
|
||||
"server_name": str, // Server Name
|
||||
"library_name": str, // Library Name (Only if a Collection is deleted)
|
||||
|
@ -150,6 +158,7 @@ The Changes Notification will be sent after each collection/playlist containing
|
|||
|
||||
```yaml
|
||||
{
|
||||
"event": "changes", // Event
|
||||
"server_name": str, // Server Name
|
||||
"library_name": str, // Library Name
|
||||
"collection": str, // Collection Name only in payload for a collection
|
||||
|
|
|
@ -70,7 +70,7 @@ class Webhooks:
|
|||
|
||||
def start_time_hooks(self, start_time):
|
||||
if self.run_start_webhooks:
|
||||
self._request(self.run_start_webhooks, {"start_time": start_time.strftime("%Y-%m-%d %H:%M:%S")})
|
||||
self._request(self.run_start_webhooks, {"event": "run_start", "start_time": start_time.strftime("%Y-%m-%d %H:%M:%S")})
|
||||
|
||||
def version_hooks(self, version, latest_version):
|
||||
if self.version_webhooks:
|
||||
|
@ -79,11 +79,12 @@ class Webhooks:
|
|||
notes = self.config.GitHub.latest_release_notes()
|
||||
elif version[2] and version[2] < latest_version[2]:
|
||||
notes = self.config.GitHub.get_commits(version[2], nightly=self.config.check_nightly)
|
||||
self._request(self.version_webhooks, {"current": version[0], "latest": latest_version[0], "notes": notes})
|
||||
self._request(self.version_webhooks, {"event": "version", "current": version[0], "latest": latest_version[0], "notes": notes})
|
||||
|
||||
def end_time_hooks(self, start_time, end_time, run_time, stats):
|
||||
if self.run_end_webhooks:
|
||||
self._request(self.run_end_webhooks, {
|
||||
"event": "run_end",
|
||||
"start_time": start_time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"end_time": end_time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"run_time": run_time,
|
||||
|
@ -99,7 +100,7 @@ class Webhooks:
|
|||
|
||||
def error_hooks(self, text, server=None, library=None, collection=None, playlist=None, critical=True):
|
||||
if self.error_webhooks:
|
||||
json = {"error": str(text), "critical": critical}
|
||||
json = {"event": "error", "error": str(text), "critical": critical}
|
||||
if server: json["server_name"] = str(server)
|
||||
if library: json["library_name"] = str(library)
|
||||
if collection: json["collection"] = str(collection)
|
||||
|
@ -108,7 +109,7 @@ class Webhooks:
|
|||
|
||||
def delete_hooks(self, message, server=None, library=None):
|
||||
if self.delete_webhooks:
|
||||
json = {"message": message}
|
||||
json = {"event": "delete", "message": message}
|
||||
if server: json["server_name"] = str(server)
|
||||
if library: json["library_name"] = str(library)
|
||||
self._request(self.delete_webhooks, json)
|
||||
|
@ -123,6 +124,7 @@ class Webhooks:
|
|||
if not playlist and not background_url and collection.art and next((f for f in collection.fields if f.name == "art"), None):
|
||||
art = self.config.get_image_encoded(f"{self.library.url}{collection.art}?X-Plex-Token={self.library.token}")
|
||||
self._request(webhooks, {
|
||||
"event": "changes",
|
||||
"server_name": self.library.PlexServer.friendlyName,
|
||||
"library_name": self.library.name,
|
||||
"playlist" if playlist else "collection": collection.title,
|
||||
|
|
|
@ -634,7 +634,7 @@ def run_collection(config, library, metadata, requested_collections):
|
|||
else:
|
||||
raise Failed(e)
|
||||
|
||||
if not builder.found_items and builder.ignore_blank_results:
|
||||
if not builder.found_items and not builder.ignore_blank_results:
|
||||
raise NonExisting(f"{builder.Type} Warning: No items found")
|
||||
|
||||
builder.display_filters()
|
||||
|
|
Loading…
Reference in a new issue