[114] fix image uploads

This commit is contained in:
meisnate12 2022-05-23 14:42:27 -04:00
parent 79ee05fb0c
commit 60a69cdd54
10 changed files with 52 additions and 17 deletions

View file

@ -1 +1 @@
1.16.5-develop113 1.16.5-develop114

BIN
docs/_static/alt-logo-white.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -26,6 +26,12 @@ libraries:
- git: PMM/overlays/ratings - git: PMM/overlays/ratings
``` ```
## Overlays
The default set of overlays are a combination of Positional Overlays and Text Overlays. Here is an image of all the different spots on an image the default overlays will place images.
![](overlays.png)
## Customizing Configs ## Customizing Configs
Configs can be customized using the `template_variables` attribute when calling the file. These `template_variables` will be given to every template call in the file which allows them to affect how that file runs. Configs can be customized using the `template_variables` attribute when calling the file. These `template_variables` will be given to every template call in the file which allows them to affect how that file runs.
@ -61,7 +67,6 @@ Each file has a comment block at the top showing the available `template_variabl
# # Sets the value at the start of the sort title # # # Sets the value at the start of the sort title #
# collection_section: "06" # # collection_section: "06" #
############################################################# #############################################################
``` ```
Each of these when passed will change how the collection runs slightly. Each of these when passed will change how the collection runs slightly.
@ -70,7 +75,6 @@ Each of these when passed will change how the collection runs slightly.
* `collection_mode` Sets the collection mode of the collection * `collection_mode` Sets the collection mode of the collection
* `collection_section` Sets the value at the start of the sort title * `collection_section` Sets the value at the start of the sort title
**In addition to the defined `template_variables` each file in the PMM Folder has access to the `radarr_add_missing` and `sonarr_add_missing` template variables and for dynamic collections most attributes can be passed as template variables** **In addition to the defined `template_variables` each file in the PMM Folder has access to the `radarr_add_missing` and `sonarr_add_missing` template variables and for dynamic collections most attributes can be passed as template variables**
For example if you want yearly oscar collections that go back 10 years instead of 5 all of which gets sent to radarr use the `data` and `radarr_add_missing` template variables. For example if you want yearly oscar collections that go back 10 years instead of 5 all of which gets sent to radarr use the `data` and `radarr_add_missing` template variables.

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View file

@ -131,7 +131,7 @@ Depending on the `type` of dynamic collection, `data` is used to specify the opt
| [`mood`](#mood) | Create a collection for each mood found in the library | ❌ | ❌ | ❌ | ✅ | ❌ | | [`mood`](#mood) | Create a collection for each mood found in the library | ❌ | ❌ | ❌ | ✅ | ❌ |
| [`style`](#style) | Create a collection for each style found in the library | ❌ | ❌ | ❌ | ✅ | ❌ | | [`style`](#style) | Create a collection for each style found in the library | ❌ | ❌ | ❌ | ✅ | ❌ |
| [`number`](#number) | Creates a collection for each number defined | ✅ | ✅ | ✅ | ✅ | ✅ | | [`number`](#number) | Creates a collection for each number defined | ✅ | ✅ | ✅ | ✅ | ✅ |
| [`list`](#list) | Creates a collection for each item in the list defined | ✅ | ✅ | ✅ | ✅ | ✅ | | [`custom`](#custom) | Creates a collection for each custom `key: key_name` pair defined. | ✅ | ✅ | ✅ | ✅ | ✅ |
### TMDb Collection ### TMDb Collection
@ -1079,7 +1079,7 @@ default_template:
</tr> </tr>
</table> </table>
### Example: #### Example:
* Create a collection for each decade found in the library (TV and Movies) * Create a collection for each decade found in the library (TV and Movies)
* Name the collection "Top [Decade] Movies" * Name the collection "Top [Decade] Movies"

View file

@ -1,4 +1,4 @@
## Metadata Files # Metadata Files
Metadata files are used to create and maintain collections and metadata within the Plex libraries on the server. Metadata files are used to create and maintain collections and metadata within the Plex libraries on the server.

View file

@ -4,9 +4,11 @@ Overlay files are used to create and maintain overlays within the Plex libraries
Overlays and templates are defined within one or more Overlay files, which are linked to libraries in the [Libraries Attribute](../config/libraries.md#overlay-path) within the [Configuration File](../config/configuration.md). Overlays and templates are defined within one or more Overlay files, which are linked to libraries in the [Libraries Attribute](../config/libraries.md#overlay-path) within the [Configuration File](../config/configuration.md).
All overlay coordinates assume 1000 x 1500 for Posters and 1920 x 1080 for Backgrounds and Title Cards.
**To remove all overlays add `remove_overlays: true` to the `overlay_path` [Libraries Attribute](../config/libraries.md#remove-overlays).** **To remove all overlays add `remove_overlays: true` to the `overlay_path` [Libraries Attribute](../config/libraries.md#remove-overlays).**
**To change a single overlay original image either replace the image in the assets folder or remove the `Overlay` shared label and then PMM will overlay the new image** **To change a single overlay original image either remove the `Overlay` shared label and update the Image in Plex or replace the image in the assets folder and then PMM will overlay the new image**
These are the attributes which can be used within the Overlay File: These are the attributes which can be used within the Overlay File:
@ -88,6 +90,29 @@ overlays:
imdb_chart: top_movies imdb_chart: top_movies
``` ```
### Non-Positional Image Overlay
Non-Positional overlays are images that are either 1000 x 1500 for Posters or 1920 x 1080 for Backgrounds and Title Cards.
These Overlays should be mostly transparent and will just be completely merged with the base image.
### Positional Image Overlay
Positional overlays can be of any size and use `horizontal_offset`, `horizontal_align`, `vertical_offset`, and `vertical_align` to position the overlay on the image.
```yaml
overlays:
IMDB-Top-250:
imdb_chart: top_movies
overlay:
name: IMDB-Top-250
repo: PMM/overlays/images/IMDB-Top-250
horizontal_offset: 0
horizontal_align: right
vertical_offset: 0
vertical_align: bottom
```
### Blurring Overlay ### Blurring Overlay
There is a special overlay named `blur` that when given as the overlay name will instead of finding the image will just blur the image instead. There is a special overlay named `blur` that when given as the overlay name will instead of finding the image will just blur the image instead.
@ -110,6 +135,8 @@ You can add text as an overlay using the special `text()` overlay name. Anything
You can control the font, font size and font color using the `font`, `font_size`, and `font_color` overlay attributes. You can control the font, font size and font color using the `font`, `font_size`, and `font_color` overlay attributes.
You can control the backdrop of the text using the various `back_*` attributes.
The `horizontal_offset` and `vertical_offset` overlay attributes are required when using Text Overlays. The `horizontal_offset` and `vertical_offset` overlay attributes are required when using Text Overlays.
You can add an items rating number (`8.7`) to the image by using `text(audience_rating)`, `text(critic_rating)`, or `text(user_rating)` You can add an items rating number (`8.7`) to the image by using `text(audience_rating)`, `text(critic_rating)`, or `text(user_rating)`
@ -123,15 +150,19 @@ overlays:
audience_rating: audience_rating:
overlay: overlay:
name: text(audience_rating) name: text(audience_rating)
horizontal_offset: 15 horizontal_offset: 225
horizontal_align: center
vertical_offset: 15 vertical_offset: 15
font: fonts/Roboto-Medium.ttf vertical_align: top
font_size: 200 font: fonts/Inter-Medium.ttf
plex_all: true font_size: 63
font_color: "#FFFFFF"
back_color: "#00000099"
back_radius: 30
back_width: 150
back_height: 105
``` ```
**Note: This only adds the text you may want to also add an overlay banner in the same spot.**
## Suppress Overlays ## Suppress Overlays
You can add `suppress_overlays` to an overlay definition and give it a list or comma separated string of overlay names you want suppressed from this item if this overlay is attached to the item. You can add `suppress_overlays` to an overlay definition and give it a list or comma separated string of overlay names you want suppressed from this item if this overlay is attached to the item.

View file

@ -786,7 +786,7 @@ class CollectionBuilder:
def _poster(self, method_name, method_data): def _poster(self, method_name, method_data):
if method_name == "url_poster": if method_name == "url_poster":
image_response = self.config.get(method_data) image_response = self.config.get(method_data, headers=util.header())
if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]: 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}") logger.warning(f"{self.Type} Warning: No Poster Found at {method_data}")
else: else:
@ -805,7 +805,7 @@ class CollectionBuilder:
def _background(self, method_name, method_data): def _background(self, method_name, method_data):
if method_name == "url_background": if method_name == "url_background":
image_response = self.config.get(method_data) image_response = self.config.get(method_data, headers=util.header())
if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]: 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}") logger.warning(f"{self.Type} Warning: No Background Found at {method_data}")
else: else:

View file

@ -6,7 +6,7 @@ from modules.util import Failed, NotScheduled
from plexapi.audio import Album from plexapi.audio import Album
from plexapi.exceptions import BadRequest from plexapi.exceptions import BadRequest
from plexapi.video import Movie, Show, Season, Episode from plexapi.video import Movie, Show, Season, Episode
from PIL import Image, ImageDraw, ImageFilter from PIL import Image, ImageFilter
logger = util.logger logger = util.logger

View file

@ -263,7 +263,7 @@ def logger_input(prompt, timeout=60):
else: raise SystemError("Input Timeout not supported on this system") else: raise SystemError("Input Timeout not supported on this system")
def header(language="en-US,en;q=0.5"): def header(language="en-US,en;q=0.5"):
return {"Accept-Language": "eng" if language == "default" else language, "User-Agent": "Mozilla/5.0 x64"} return {"Accept-Language": "eng" if language == "default" else language, "User-Agent": "Mozilla/5.0"}
def alarm_handler(signum, frame): def alarm_handler(signum, frame):
raise TimeoutExpired raise TimeoutExpired