From f5d1882d669ee074710c7d172d5c596d37313c9d Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 19 Sep 2023 15:28:03 -0400 Subject: [PATCH] version 1.19.1 --- .github/workflows/version.yml | 2 +- CHANGELOG | 14 +- VERSION | 2 +- docs/defaults/show/network.md | 476 +++++++++++++++--------------- docs/metadata/details/schedule.md | 22 +- modules/meta.py | 15 +- modules/notifiarr.py | 19 +- modules/util.py | 14 +- plex_meta_manager.py | 4 +- requirements.txt | 6 +- 10 files changed, 302 insertions(+), 272 deletions(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index c4196cc1..0a28125b 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -75,7 +75,7 @@ jobs: author_icon_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/docker.png - name: Checkout Configs Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: meisnate12/Plex-Meta-Manager-Configs token: ${{ secrets.PAT }} diff --git a/CHANGELOG b/CHANGELOG index 72e08b44..6cdfcbe9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,10 +1,13 @@ +# Python Version +Drops Support for Python 3.7 # Requirements Update (requirements will need to be reinstalled) -Updated GitPython requirement to 3.1.32 +Updated ArrAPI requirement to 1.4.3 +Updated GitPython requirement to 3.1.36 Updated lxml requirement to 4.9.3 -Updated pathvalidate requirement to 3.1.0 -Updated pillow requirement to 10.0.0 -Updated PlexAPI requirement to 4.14.0 +Updated pathvalidate requirement to 3.2.0 +Updated pillow requirement to 10.0.1 +Updated PlexAPI requirement to 4.15.2 Updated psutil requirement to 5.9.5 Updated requests requirement to 2.31.0 Updated ruamel.yaml requirement to 0.17.32 @@ -17,6 +20,8 @@ Add `tmdb_birthday` [Detail](https://metamanager.wiki/en/latest/metadata/details Add `match` [attribute](https://metamanager.wiki/en/latest/metadata/metadata/movie.html#matching-movies) to match movies within Plex to items within the Metadata file. Add `delete_collections_named` to [Shared Collection Variables](https://metamanager.wiki/en/latest/defaults/collection_variables.html) Add support for (GitHub Personal Access Tokens)[https://metamanager.wiki/en/latest/config/github.html] in config files. thanks @chazlarson +Add runtime support for Shows, Seasons, Artists, and Albums. +Add multiple ranges to the schedule system. # New Defaults Features New Default Translations of Danish, Dutch, Italian, Norwegian Bokmål, Portuguese (Brazil), and Spanish. @@ -50,5 +55,6 @@ Fixes bug where TMDb Filters using a modifier were ignored. Fixes bug with `mal_search` when using the `sfw` attribute Fixes bug where sorting a collection would fail if the collection name had a `,` in it. Fixes run_end webhooks. +Fixes Letterboxd issue Various other Minor Fixes \ No newline at end of file diff --git a/VERSION b/VERSION index c6f7d443..66e2ae6c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.19.0-develop109 +1.19.1 diff --git a/docs/defaults/show/network.md b/docs/defaults/show/network.md index 8e4239b1..21196521 100644 --- a/docs/defaults/show/network.md +++ b/docs/defaults/show/network.md @@ -69,7 +69,6 @@ libraries: sort_by: title.asc ``` - ## Default values These are lists provided for reference to show what values will be in use if you do no customization. If you want to customize these values, use the methods described above. These do not show how to change a name or a list. @@ -77,241 +76,246 @@ These are lists provided for reference to show what values will be in use if you ### Default `include` ```yaml -include: -- "#0" -- ABC -- ABC Family -- ABC Kids -- ABC TV -- ABS-CBN -- Acorn TV -- Adult Swim -- AHC -- Alibi -- ALTBalaji -- Amazon Kids+ -- AMC -- Animal Planet -- Antena 3 -- Apple TV+ -- ARD -- Arte -- Atresplayer Premium -- AT-X -- Audience -- AXN -- Azteca Uno -- A&E -- BBC America -- BBC Four -- BBC iPlayer -- BBC One -- BBC Three -- BBC Two -- BET -- BET+ -- bilibili -- BluTV -- Boomerang -- Bravo -- BritBox -- C More -- Canale 5 -- Canal+ -- Cartoon Network -- Cartoonito -- CBC -- CBC Television -- Cbeebies -- CBS -- Channel 3 -- Channel 4 -- Channel 5 -- CHCH-DT -- Cinemax -- Citytv -- CNN -- Comedy Central -- Cooking Channel -- Crackle -- Criterion Channel -- Crunchyroll -- CTV -- Cuatro -- Curiosity Stream -- Dave -- DC Universe -- Discovery -- Discovery Kids -- discovery+ -- Disney Channel -- Disney Junior -- Disney XD -- Disney+ -- DR1 -- Eden -- Elisa Viihde -- Elisa Viihde Viaplay -- Epix -- ESPN -- E! -- Facebook Watch -- Family Channel -- Ficción Producciones -- Flooxer -- Food Network -- FOX -- Fox Kids -- France 2 -- Freeform -- Freevee -- Fuji TV -- FX -- FXX -- GAİN -- Game Show Network -- Global TV -- Globoplay -- GMA Network -- Hallmark -- HBO -- HBO Max -- HGTV -- History -- HOT3 -- Hulu -- ICTV -- IFC -- IMDb TV -- Investigation Discovery -- ION Television -- iQiyi -- ITV -- ITV Encore -- ITV1 -- ITVX -- joyn -- Kan 11 -- KBS2 -- Kids WB -- La 1 -- La Une -- Las Estrellas -- Lifetime -- Lionsgate+ -- Logo -- MasterClass -- Max -- MBC -- MGM+ -- mitele -- Movistar Plus+ -- MTV -- M-Net -- National Geographic -- NBC -- Netflix -- Network 10 -- NHK -- Nick -- Nick Jr -- Nickelodeon -- Nicktoons -- Nine Network -- Nippon TV -- NRK1 -- OCS City -- OCS Max -- ORF -- Oxygen -- Pantaya -- Paramount Network -- Paramount+ -- PBS -- PBS Kids -- Peacock -- Planète+ A&E -- Prime Video -- Rai 1 -- Reelz -- The Roku Channel -- RTÉ One -- RTL -- RTL Télé -- RTP1 -- RÚV -- S4C -- SAT.1 -- SBS -- Science -- Shahid -- Showcase -- Showmax -- Showtime -- Shudder -- Sky -- Smithsonian -- Space -- Spectrum -- Spike -- Stan -- Starz -- STAR+ -- Sundance TV -- SVT1 -- Syfy -- Syndication -- TBS -- Telecinco -- Telefe -- Telemundo -- Televisión de Galicia -- Televisión Pública Argentina -- Tencent Video -- TF1 -- The CW -- The Roku Channel -- The WB -- TLC -- TNT -- Tokyo MX -- Travel Channel -- truTV -- Turner Classic Movies -- TV 2 -- tv asahi -- TV Globo -- TV Land -- TV Tokyo -- TV3 -- TV4 -- TVB Jade -- tving -- tvN -- TVNZ 1 -- TVP1 -- UKTV -- UniMás -- Universal Kids -- Universal TV -- Univision -- UPN -- USA Network -- VH1 -- Viaplay -- Vice -- Virgin Media One -- ViuTV -- ViX+ -- VRT 1 -- VTM -- W -- WE tv -- YLE -- Youku -- YouTube -- ZDF -- ZEE5 + include: + - "#0" + - ABC + - ABC Family + - ABC Kids + - ABC TV + - ABS-CBN + - Acorn TV + - Adult Swim + - AHC + - Alibi + - ALTBalaji + - Amazon Kids+ + - AMC + - Animal Planet + - Antena 3 + - Apple TV+ + - ARD + - Arte + - Atresplayer Premium + - AT-X + - Audience + - AXN + - Azteca Uno + - A&E + - BBC America + - BBC Four + - BBC iPlayer + - BBC One + - BBC Three + - BBC Two + - BET + - BET+ + - bilibili + - BluTV + - Boomerang + - Bravo + - BritBox + - C More + - Canale 5 + - Canal+ + - Cartoon Network + - Cartoonito + - CBC + - CBC Television + - Cbeebies + - CBS + - Channel 3 + - Channel 4 + - Channel 5 + - CHCH-DT + - Cinemax + - Citytv + - CNN + - Comedy Central + - Cooking Channel + - Crackle + - Criterion Channel + - Crunchyroll + - CTV + - Cuatro + - Curiosity Stream + - Dave + - DC Universe + - Discovery + - Discovery Kids + - discovery+ + - Disney Channel + - Disney Junior + - Disney XD + - Disney+ + - DR1 + - Eden + - Elisa Viihde + - Elisa Viihde Viaplay + - Epix + - ESPN + - E! + - Facebook Watch + - Family Channel + - Ficción Producciones + - Flooxer + - Food Network + - FOX + - Fox Kids + - France 2 + - Freeform + - Freevee + - Fuji TV + - FX + - FXX + - GAİN + - Game Show Network + - Global TV + - Globoplay + - GMA Network + - Hallmark + - HBO + - HBO Max + - HGTV + - History + - HOT3 + - Hulu + - ICTV + - IFC + - IMDb TV + - Investigation Discovery + - ION Television + - iQiyi + - ITV + - ITV Encore + - ITV1 + - ITVX + - joyn + - Kan 11 + - KBS2 + - Kids WB + - La 1 + - La Une + - Las Estrellas + - Lifetime + - Lionsgate+ + - Logo + - MasterClass + - Max + - MBC + - MGM+ + - mitele + - Movistar Plus+ + - MTV + - M-Net + - National Geographic + - NBC + - Netflix + - Network 10 + - NHK + - Nick + - Nick Jr + - Nickelodeon + - Nicktoons + - Nine Network + - Nippon TV + - NRK1 + - OCS City + - OCS Max + - ORF + - Oxygen + - Pantaya + - Paramount Network + - Paramount+ + - PBS + - PBS Kids + - Peacock + - Planète+ A&E + - Prime Video + - Rai 1 + - Reelz + - The Roku Channel + - RTÉ One + - RTL + - RTL Télé + - RTP1 + - RÚV + - S4C + - SAT.1 + - SBS + - Science + - Shahid + - Showcase + - Showmax + - Showtime + - Shudder + - Sky + - Smithsonian + - Space + - Spectrum + - Spike + - Stan + - Starz + - STAR+ + - Sundance TV + - SVT1 + - Syfy + - Syndication + - TBS + - Telecinco + - Telefe + - Telemundo + - Televisión de Galicia + - Televisión Pública Argentina + - Tencent Video + - TF1 + - The CW + - The Roku Channel + - The WB + - TLC + - TNT + - Tokyo MX + - Travel Channel + - truTV + - Turner Classic Movies + - TV 2 + - tv asahi + - TV Globo + - TV Land + - TV Tokyo + - TV3 + - TV4 + - TVB Jade + - tving + - tvN + - TVNZ 1 + - TVP1 + - UKTV + - UniMás + - Universal Kids + - Universal TV + - Univision + - UPN + - USA Network + - VH1 + - Viaplay + - Vice + - Virgin Media One + - ViuTV + - ViX+ + - VRT 1 + - VTM + - W + - WE tv + - YLE + - Youku + - YouTube + - ZDF + - ZEE5 +``` + +### Default `addons` + +```yaml addons: ABC: diff --git a/docs/metadata/details/schedule.md b/docs/metadata/details/schedule.md index 7e2bd7ca..9fea4971 100644 --- a/docs/metadata/details/schedule.md +++ b/docs/metadata/details/schedule.md @@ -10,17 +10,17 @@ These schedules do not trigger PMM to run; they control what PMM will do if it h The scheduling options are: -| Name | Description | Format | Example | -|:-------------|:-----------------------------------------------------------------------------------------------------------|:---------------------------------------------------|:-------------------------------------------------------------| -| Hourly | Update only when the script is run in that hour or hour range | hourly(Hour of Day)
hourly(Start Hour-End Hour) | `hourly(17)`
`hourly(17-04)` | -| Daily | Update once a day | daily | `daily` | -| Weekly | Update once a week on the specified days (For multiple days, use a bar-separated (|) list)| weekly(Days of Week) | `weekly(sunday)`
weekly(sunday|tuesday) | -| Monthly | Update once a month on the specified day | monthly(Day of Month) | `monthly(1)` | -| Yearly | Update once a year on the specified day | yearly(MM/DD) | `yearly(01/30)` | -| Range | Updates whenever the date is within the range (For mulitple ranges, use a bar-separated (`\|`) list) | range(MM/DD-MM/DD) | `range(12/01-12/31)`
`range(8/01-8/15\|9/01-9/15)` | -| Never | Never updates | never | `never` | -| Non Existing | Updates if it doesn't exist | non_existing | `non_existing` | -| All | Requires that all comma separated scheduling options inside its brackets be meet in order to run | all[Options] | `all[weekly(sunday), hourly(17)]` | +| Name | Description | Format | Example | +|:-------------|:--------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------|:---------------------------------------------------------------------| +| Hourly | Update only when the script is run in that hour or hour range | hourly(Hour of Day)
hourly(Start Hour-End Hour) | `hourly(17)`
`hourly(17-04)` | +| Daily | Update once a day | daily | `daily` | +| Weekly | Update once a week on the specified days (For multiple days, use a bar-separated (|) list) | weekly(Days of Week) | `weekly(sunday)`
weekly(sunday|tuesday) | +| Monthly | Update once a month on the specified day | monthly(Day of Month) | `monthly(1)` | +| Yearly | Update once a year on the specified day | yearly(MM/DD) | `yearly(01/30)` | +| Range | Updates whenever the date is within the range (For mulitple ranges, use a bar-separated (|) list) | range(MM/DD-MM/DD) | `range(12/01-12/31)`
range(8/01-8/15|9/01-9/15) | +| Never | Never updates | never | `never` | +| Non Existing | Updates if it doesn't exist | non_existing | `non_existing` | +| All | Requires that all comma separated scheduling options inside its brackets be meet in order to run | all[Options] | `all[weekly(sunday), hourly(17)]` | * `daily` is the default when `schedule` is not specified. * You can run the script multiple times per day but using the `--time` command line argument detailed on the [Run Commands & Environmental Variables Page](../../home/environmental.md#time-to-run). diff --git a/modules/meta.py b/modules/meta.py index d752890e..cd4cf634 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -464,7 +464,18 @@ class DataFile: variables[f"{key}_encoded"] = util.quote(value) default = {k: v for k, v in default.items() if k not in variables} - optional = [o for o in optional if o not in variables and o not in default] + og_optional = optional + optional = [] + for key in og_optional: + if "<<" in key and ">>" in key: + for k, v in variables.items(): + if f"<<{k}>>" in key: + key = key.replace(f"<<{k}>>", v) + for k, v in default.items(): + if f"<<{k}>>" in key: + key = key.replace(f"<<{k}>>", v) + if key not in variables and key not in default: + optional.append(key) logger.trace("") logger.trace(f"Variables: {variables}") @@ -499,8 +510,6 @@ class DataFile: for i_check in range(8): for option in optional: if option not in variables and f"<<{option}>>" in str(_data): - if _debug: - logger.trace(f"Failed {_method}: {_data}") raise Failed for variable, variable_data in variables.items(): if (variable == "collection_name" or variable == "playlist_name") and _method in ["radarr_tag", "item_radarr_tag", "sonarr_tag", "item_sonarr_tag"]: diff --git a/modules/notifiarr.py b/modules/notifiarr.py index 8a9fef58..a36eeeaa 100644 --- a/modules/notifiarr.py +++ b/modules/notifiarr.py @@ -1,6 +1,7 @@ from json import JSONDecodeError from modules import util from modules.util import Failed +from retrying import retry logger = util.logger @@ -13,17 +14,25 @@ class Notifiarr: self.apikey = params["apikey"] self.header = {"X-API-Key": self.apikey} logger.secret(self.apikey) - response = self.config.get(f"{base_url}user/pmm/", headers=self.header, params={"fetch": "settings"}) + try: + self.request(path="user", params={"fetch": "settings"}) + except JSONDecodeError: + raise Failed("Notifiarr Error: Invalid response") + + def notification(self, json): + return self.request(json=json) + + @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed) + def request(self, json=None, path="notification", params=None): + response = self.config.get(f"{base_url}{path}/pmm/", json=json, headers=self.header, params=params) try: response_json = response.json() except JSONDecodeError as e: + logger.error(response.content) logger.debug(e) - raise Failed("Notifiarr Error: Invalid response") + raise e 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 response_json["details"]["response"]: raise Failed("Notifiarr Error: Invalid apikey") - - def notification(self, json): - return self.config.get(f"{base_url}notification/pmm/", json=json, headers=self.header) diff --git a/modules/util.py b/modules/util.py index c6725d8d..d402d4c5 100644 --- a/modules/util.py +++ b/modules/util.py @@ -669,9 +669,9 @@ def schedule_check(attribute, data, current_time, run_hour, is_all=False): except ValueError: logger.error(f"Schedule Error: yearly {display} must be in the MM/DD format i.e. yearly(11/22)") elif run_time.startswith("range"): - ok_ranges = param.lower().split("|") - err = None - for ok_range in ok_ranges: + ranges = [] + range_pass = False + for ok_range in param.lower().split("|"): match = re.match("^(1[0-2]|0?[1-9])/(3[01]|[12][0-9]|0?[1-9])-(1[0-2]|0?[1-9])/(3[01]|[12][0-9]|0?[1-9])$", ok_range) if not match: logger.error(f"Schedule Error: range {display} must be in the MM/DD-MM/DD format i.e. range(12/01-12/25)") @@ -683,9 +683,13 @@ def schedule_check(attribute, data, current_time, run_hour, is_all=False): start = datetime.strptime(f"{month_start}/{day_start}", "%m/%d") end = datetime.strptime(f"{month_end}/{day_end}", "%m/%d") range_collection = True - schedule_str += f"\nScheduled between {pretty_months[month_start]} {num2words(day_start, to='ordinal_num')} and {pretty_months[month_end]} {num2words(day_end, to='ordinal_num')}" + ranges.append(f"{pretty_months[month_start]} {num2words(day_start, to='ordinal_num')} and {pretty_months[month_end]} {num2words(day_end, to='ordinal_num')}") if start <= check <= end if start < end else (check <= end or check >= start): - all_check += 1 + range_pass = True + if ranges: + schedule_str += f"\nScheduled {' or '.join(ranges)}" + if range_pass: + all_check += 1 else: logger.error(f"Schedule Error: {display}") if is_all: diff --git a/plex_meta_manager.py b/plex_meta_manager.py index 8c46c260..12ca9179 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -3,7 +3,6 @@ from collections import Counter from concurrent.futures import ProcessPoolExecutor from datetime import datetime from modules.logs import MyLogger -import importlib.metadata if sys.version_info[0] != 3 or sys.version_info[1] < 8: print("Version Error: Version: %s.%s.%s incompatible please use Python 3.8+" % (sys.version_info[0], sys.version_info[1], sys.version_info[2])) @@ -111,7 +110,6 @@ for arg_key, arg_data in arguments.items(): env_version = get_env("BRANCH_NAME", "master") is_docker = get_env("PMM_DOCKER", False, arg_bool=True) is_linuxserver = get_env("PMM_LINUXSERVER", False, arg_bool=True) -plexapi_version = importlib.metadata.version('PlexAPI') secret_args = {} plex_url = None @@ -240,7 +238,7 @@ def start(attrs): new_version = latest_version[0] if latest_version and (version[1] != latest_version[1] or (version[2] and version[2] < latest_version[2])) else None if new_version: logger.info(f" Newest Version: {new_version}") - logger.info(f" PlexAPI library version: {plexapi_version}") + logger.info(f" PlexAPI library version: {plexapi.VERSION}") logger.info(f" Platform: {platform.platform()}") logger.info(f" Memory: {round(psutil.virtual_memory().total / (1024.0 ** 3))} GB") if "time" in attrs and attrs["time"]: start_type = f"{attrs['time']} " diff --git a/requirements.txt b/requirements.txt index 1766cbf2..3a31a1dd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,9 +2,9 @@ arrapi==1.4.3 GitPython==3.1.36 lxml==4.9.3 num2words==0.5.12 -pathvalidate==3.1.0 -pillow==10.0.0 -PlexAPI==4.15.1 +pathvalidate==3.2.0 +pillow==10.0.1 +PlexAPI==4.15.2 psutil==5.9.5 python-dotenv==1.0.0 requests==2.31.0