From 94dfe8540db33cb66f0a65d06d06b4da31837945 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Sat, 21 May 2022 19:20:31 -0400 Subject: [PATCH] [112] check image urls --- VERSION | 2 +- docs/conf.py | 2 +- docs/home/environmental.md | 2 +- docs/home/guides/defaults.md | 2 ++ docs/metadata/builders/plex.md | 20 ++++++++++---------- docs/metadata/builders/smart.md | 20 ++++++++++---------- modules/builder.py | 12 ++++++++++-- 7 files changed, 35 insertions(+), 25 deletions(-) diff --git a/VERSION b/VERSION index 1a450a38..761c51e7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.5-develop111 +1.16.5-develop112 diff --git a/docs/conf.py b/docs/conf.py index be52383c..6ec07c68 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -133,7 +133,7 @@ html_theme_options = { ("Overlay Files", "metadata/overlay"), ("Playlist Files", "metadata/playlist"), ("_divider", ), - ("PMM Default Config Files", "home/guides/defaults"), + ("Default Configs and Overlays", "home/guides/defaults"), ("Scheduling Guide", "home/guides/scheduling"), ("Image Asset Directory Guide", "home/guides/assets"), ("Formula 1 Metadata Guide", "home/guides/formula"), diff --git a/docs/home/environmental.md b/docs/home/environmental.md index d78e8223..36d8d019 100644 --- a/docs/home/environmental.md +++ b/docs/home/environmental.md @@ -13,7 +13,7 @@ These docs are assuming you have a basic understanding of Docker concepts. One | [Run](#run) | `-r` or `--run` | `PMM_RUN` | | [Run Tests](#run-tests) | `-rt`, `--tests`, or `--run-tests` | `PMM_TEST` | | [Collections Only](#collections-only) | `-co` or `--collections-only` | `PMM_COLLECTIONS_ONLY` | -| [Plsylists Only](#plsylists-only) | `-po` or `--plsylists-only` | `PMM_PLAYLISTS_ONLY` | +| [Playlists Only](#playlists-only) | `-po` or `--playlists-only` | `PMM_PLAYLISTS_ONLY` | | [Operations](#operations) | `-op` or `--operations` | `PMM_OPERATIONS` | | [Overlays](#overlays) | `-ov` or `--overlays` | `PMM_OVERLAYS` | | [Run Collections](#run-collections) | `-rc` or `--run-collections` | `PMM_COLLECTIONS` | diff --git a/docs/home/guides/defaults.md b/docs/home/guides/defaults.md index 28894c39..083679da 100644 --- a/docs/home/guides/defaults.md +++ b/docs/home/guides/defaults.md @@ -47,6 +47,8 @@ Each file has a comment block at the top showing the available `template_variabl # Created by Yozora, Bullmoose20, & Sohjiro # ############################################################# # Call this from your config.yml (Movie or Show) # +# If nothing is specified these are the defaults # +# # # metadata_path: # # - git: PMM/genre # # template_variables: # diff --git a/docs/metadata/builders/plex.md b/docs/metadata/builders/plex.md index 62005e0f..acc27200 100644 --- a/docs/metadata/builders/plex.md +++ b/docs/metadata/builders/plex.md @@ -263,20 +263,20 @@ No number search can take multiple values. | Number Search | Description | Movie
Libraries | Show
Libraries | Music
Libraries | |:----------------------|:--------------------------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:| -| `duration` | Uses the duration attribute to match using minutes
**Minimum:** `1` | ✅ | ❌ | ❌ | -| `plays` | Uses the plays attribute to match
**Minimum:** `1` | ✅ | ✅ | ❌ | -| `episode_plays` | Uses the Episode's plays attribute to match
**Minimum:** `1` | ❌ | ✅ | ❌ | +| `duration` | Uses the duration attribute to match using minutes
**Minimum:** `0` | ✅ | ❌ | ❌ | +| `plays` | Uses the plays attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | +| `episode_plays` | Uses the Episode's plays attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | | `critic_rating` | Uses the critic rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | | `audience_rating` | Uses the audience rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | | `user_rating` | Uses the user rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | | `episode_user_rating` | Uses the user rating attribute of the show's episodes to match
**Range:** `0.0` - `10.0` | ❌ | ✅ | ❌ | -| `year` | Uses the year attribute to match
**Minimum:** `1` | ✅ | ✅ | ❌ | -| `episode_year` | Uses the Episode's year attribute to match
**Minimum:** `1` | ❌ | ✅ | ❌ | -| `album_year` | Uses the Album's year attribute to match
**Minimum:** `1` | ❌ | ❌ | ✅ | -| `album_decade` | Uses the Album's decade attribute to match
**Minimum:** `1` | ❌ | ❌ | ✅ | -| `album_plays` | Uses the Album's plays attribute to match
**Minimum:** `1` | ❌ | ❌ | ✅ | -| `track_plays` | Uses the Track's plays attribute to match
**Minimum:** `1` | ❌ | ❌ | ✅ | -| `track_skips` | Uses the Track's skips attribute to match
**Minimum:** `1` | ❌ | ❌ | ✅ | +| `year` | Uses the year attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | +| `episode_year` | Uses the Episode's year attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | +| `album_year` | Uses the Album's year attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `album_decade` | Uses the Album's decade attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `album_plays` | Uses the Album's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `track_plays` | Uses the Track's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `track_skips` | Uses the Track's skips attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | | `artist_user_rating` | Uses the Artist's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | | `album_user_rating` | Uses the Album's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | | `album_critic_rating` | Uses the Album's critic rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | diff --git a/docs/metadata/builders/smart.md b/docs/metadata/builders/smart.md index ab3f8188..e477cc50 100644 --- a/docs/metadata/builders/smart.md +++ b/docs/metadata/builders/smart.md @@ -231,20 +231,20 @@ No number filter can take multiple values. | Number Search | Description | Movie
Libraries | Show
Libraries | Music
Libraries | |:----------------------|:--------------------------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:| -| `duration` | Uses the duration attribute to match using minutes
**Minimum:** `1` | ✅ | ❌ | ❌ | -| `plays` | Uses the plays attribute to match
**Minimum:** `1` | ✅ | ✅ | ❌ | -| `episode_plays` | Uses the Episode's plays attribute to match
**Minimum:** `1` | ❌ | ✅ | ❌ | +| `duration` | Uses the duration attribute to match using minutes
**Minimum:** `0` | ✅ | ❌ | ❌ | +| `plays` | Uses the plays attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | +| `episode_plays` | Uses the Episode's plays attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | | `critic_rating` | Uses the critic rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | | `audience_rating` | Uses the audience rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | | `user_rating` | Uses the user rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | | `episode_user_rating` | Uses the user rating attribute of the show's episodes to match
**Range:** `0.0` - `10.0` | ❌ | ✅ | ❌ | -| `year` | Uses the year attribute to match
**Minimum:** `1` | ✅ | ✅ | ❌ | -| `episode_year` | Uses the Episode's year attribute to match
**Minimum:** `1` | ❌ | ✅ | ❌ | -| `album_year` | Uses the Album's year attribute to match
**Minimum:** `1` | ❌ | ❌ | ✅ | -| `album_decade` | Uses the Album's decade attribute to match
**Minimum:** `1` | ❌ | ❌ | ✅ | -| `album_plays` | Uses the Album's plays attribute to match
**Minimum:** `1` | ❌ | ❌ | ✅ | -| `track_plays` | Uses the Track's plays attribute to match
**Minimum:** `1` | ❌ | ❌ | ✅ | -| `track_skips` | Uses the Track's skips attribute to match
**Minimum:** `1` | ❌ | ❌ | ✅ | +| `year` | Uses the year attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | +| `episode_year` | Uses the Episode's year attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | +| `album_year` | Uses the Album's year attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `album_decade` | Uses the Album's decade attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `album_plays` | Uses the Album's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `track_plays` | Uses the Track's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `track_skips` | Uses the Track's skips attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | | `artist_user_rating` | Uses the Artist's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | | `album_user_rating` | Uses the Album's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | | `album_critic_rating` | Uses the Album's critic rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | diff --git a/modules/builder.py b/modules/builder.py index 4afceb6f..7abb8b80 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -786,7 +786,11 @@ class CollectionBuilder: def _poster(self, method_name, method_data): if method_name == "url_poster": - self.posters[method_name] = method_data + image_response = self.config.get(method_data) + if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]: + logger.warning(f"{self.Type} Warning: No Poster Found at {method_data}") + else: + self.posters[method_name] = method_data elif method_name == "tmdb_poster": self.posters[method_name] = self.config.TMDb.get_movie_show_or_collection(util.regex_first_int(method_data, 'TMDb ID'), self.library.is_movie).poster_url elif method_name == "tmdb_profile": @@ -801,7 +805,11 @@ class CollectionBuilder: def _background(self, method_name, method_data): if method_name == "url_background": - self.backgrounds[method_name] = method_data + image_response = self.config.get(method_data) + if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]: + logger.warning(f"{self.Type} Warning: No Background Found at {method_data}") + else: + self.backgrounds[method_name] = method_data elif method_name == "tmdb_background": self.backgrounds[method_name] = self.config.TMDb.get_movie_show_or_collection(util.regex_first_int(method_data, 'TMDb ID'), self.library.is_movie).backdrop_url elif method_name == "tvdb_background":