diff --git a/VERSION b/VERSION index 58599161..2ca5e5f6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop159 +1.17.3-develop160 diff --git a/defaults/both/collectionless.yml b/defaults/both/collectionless.yml index 6d068be0..c47199f5 100644 --- a/defaults/both/collectionless.yml +++ b/defaults/both/collectionless.yml @@ -2,7 +2,7 @@ # Collectionless Collection # # Created by Yozora, Bullmoose20, & Sohjiro # # EDITING THIS FILE MAY CAUSE PULLING NEW UPDATES TO FAIL # -# https://metamanager.wiki/en/latest/defaults/both/collectionless.html # +# https://metamanager.wiki/en/latest/defaults/both/collectionless.html # ############################################################################## translations: @@ -35,4 +35,3 @@ collections: Collectionless: template: - name: collectionless - - name: translation \ No newline at end of file diff --git a/docs/config/notifiarr.md b/docs/config/notifiarr.md index c56c0001..1299fbfb 100644 --- a/docs/config/notifiarr.md +++ b/docs/config/notifiarr.md @@ -1,10 +1,11 @@ # Notifiarr Attributes -Configuring [Notifiarr](https://notifiarr.com) is optional but can allow you to send the webhooks straight to notifiarr. +Configuring [Notifiarr](https://notifiarr.com) is optional but can allow you to send the [webhooks](webhooks) straight to notifiarr. A `notifiarr` mapping is in the root of the config file. Below is a `notifiarr` mapping example and the full set of attributes: + ```yaml notifiarr: apikey: #################################### @@ -13,9 +14,8 @@ notifiarr: | Attribute | Allowed Values | Required | |:----------|:-----------------------------------------|:--------:| | `apikey` | Notifiarr API Key | ✅ | -| `develop` | Use the Development Version of Notifiarr | ❌ | -Once you have added the apikey your config.yml you have to add `notifiarr` to any webhook to send that notification to Notifiarr. +Once you have added the apikey your config.yml you have to add `notifiarr` to any [webhook](webhooks) to send that notification to Notifiarr. ```yaml webhooks: @@ -23,5 +23,5 @@ webhooks: version: notifiarr run_start: notifiarr run_end: notifiarr - collection_changes: notifiarr + changes: notifiarr ``` diff --git a/docs/config/webhooks.md b/docs/config/webhooks.md index c45dff3c..b9cdb3ba 100644 --- a/docs/config/webhooks.md +++ b/docs/config/webhooks.md @@ -119,8 +119,8 @@ The Run End notification will be sent at the end of every run with statistics. "items_added": int, // Number of Items added across all Collections/Playlists "items_removed": int, // Number of Items removed across all Collections/Playlists "added_to_radarr": int, // Number of Items added to Radarr - "added_to_sonarr": int // Number of Items added to Sonarr - "names": [ + "added_to_sonarr": int, // Number of Items added to Sonarr + "names": [ // List of Dictionaries "name": str, // Name of collection or playlist in the run "library": str // Library the collection is in or PLAYLIST ] @@ -145,21 +145,21 @@ The Changes Notification will be sent after each collection/playlist containing "poster_url": str, // Collection/Playlist Poster URL if avaiable "background": str, // Base64 Encoded Collection/Playlist Background if no poster_url is found "background_url": str, // Collection/Playlist Background URL if avaiable - "additions": [ + "additions": [ // List of Dictionaries "title": str, // Title of addition - "tmdb_id": int // TMDb ID of addition only appears if it's a Movie + "tmdb_id": int, // TMDb ID of addition only appears if it's a Movie "tvdb_id": int // TVDb ID of addition only appears if it's a Show ], - "removals": [ + "removals": [ // List of Dictionaries "title": str, // Title of removal - "tmdb_id": int // TMDb ID of removal only appears if it's a Movie + "tmdb_id": int, // TMDb ID of removal only appears if it's a Movie "tvdb_id": int // TVDb ID of removal only appears if it's a Show ], - "radarr_adds": [ + "radarr_adds": [ // List of Dictionaries "title": str, // Title of the Radarr Add "id": int // TMDb ID of the Radarr Add ], - "sonarr_adds": [ + "sonarr_adds": [ // List of Dictionaries "title": str, // Title of the Sonarr Add "id": int // TVDb ID of the Sonarr Add ] diff --git a/modules/config.py b/modules/config.py index 4b830ae3..9ca841af 100644 --- a/modules/config.py +++ b/modules/config.py @@ -390,11 +390,7 @@ class ConfigFile: if "notifiarr" in self.data: logger.info("Connecting to Notifiarr...") try: - self.NotifiarrFactory = Notifiarr(self, { - "apikey": check_for_attribute(self.data, "apikey", parent="notifiarr", throw=True), - "develop": check_for_attribute(self.data, "develop", parent="notifiarr", var_type="bool", default=False, do_print=False, save=False), - "test": check_for_attribute(self.data, "test", parent="notifiarr", var_type="bool", default=False, do_print=False, save=False) - }) + self.NotifiarrFactory = Notifiarr(self, {"apikey": check_for_attribute(self.data, "apikey", parent="notifiarr", throw=True)}) except Failed as e: if str(e).endswith("is blank"): logger.warning(e) diff --git a/modules/notifiarr.py b/modules/notifiarr.py index d0d22f03..8a9fef58 100644 --- a/modules/notifiarr.py +++ b/modules/notifiarr.py @@ -5,19 +5,15 @@ from modules.util import Failed logger = util.logger base_url = "https://notifiarr.com/api/v1/" -dev_url = "https://dev.notifiarr.com/api/v1/" class Notifiarr: def __init__(self, config, params): self.config = config self.apikey = params["apikey"] - self.develop = params["develop"] - self.test = params["test"] + self.header = {"X-API-Key": self.apikey} logger.secret(self.apikey) - logger.debug(f"Environment: {'Test' if self.test else 'Develop' if self.develop else 'Production'}") - url, _ = self.get_url("user/pmm/") - response = self.config.get(url, params={"fetch": "settings"}) + response = self.config.get(f"{base_url}user/pmm/", headers=self.header, params={"fetch": "settings"}) try: response_json = response.json() except JSONDecodeError as e: @@ -26,11 +22,8 @@ class Notifiarr: if response.status_code >= 400 or ("result" in response_json and response_json["result"] == "error"): logger.debug(f"Response: {response_json}") raise Failed(f"({response.status_code} [{response.reason}]) {response_json}") - if not self.test and not response_json["details"]["response"]: + if not response_json["details"]["response"]: raise Failed("Notifiarr Error: Invalid apikey") - def get_url(self, path): - url = f"{dev_url if self.develop else base_url}{'notification/test' if self.test else f'{path}{self.apikey}'}" - logger.trace(url) - params = {"event": "pmm"} if self.test else None - return url, params + def notification(self, json): + return self.config.get(f"{base_url}notification/pmm/", json=json, headers=self.header) diff --git a/modules/plex.py b/modules/plex.py index af7dbe2f..ce5b3b5b 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -23,6 +23,7 @@ library_types = ["movie", "show", "artist"] search_translation = { "episode_title": "episode.title", "network": "show.network", + "edition": "editionTitle", "critic_rating": "rating", "audience_rating": "audienceRating", "episode_critic_rating": "episode.rating", diff --git a/modules/webhooks.py b/modules/webhooks.py index baeb41fc..14a148ec 100644 --- a/modules/webhooks.py +++ b/modules/webhooks.py @@ -23,9 +23,8 @@ class Webhooks: logger.trace(f"Webhook: {webhook}") if webhook == "notifiarr": if self.notifiarr: - url, params = self.notifiarr.get_url("notification/pmm/") for x in range(6): - response = self.config.get(url, json=json, params=params) + response = self.notifiarr.notification(json) if response.status_code < 500: break else: