various minor tweaks

This commit is contained in:
meisnate12 2021-06-11 10:26:11 -04:00
parent b502881a98
commit c6c0429fb3
5 changed files with 20 additions and 8 deletions

View file

@ -1,5 +1,10 @@
# Plex Meta Manager
#### Version 1.10.0
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/meisnate12/Plex-Meta-Manager?style=plastic)](https://github.com/meisnate12/Plex-Meta-Manager/releases)
[![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/meisnate12/plex-meta-manager/latest/develop?label=Number%20of%20Commits%20in%20Develop&style=plastic)](https://github.com/meisnate12/Plex-Meta-Manager/tree/develop)
[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/meisnate12/plex-meta-manager?label=docker&sort=semver&style=plastic)](https://hub.docker.com/r/meisnate12/plex-meta-manager)
[![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/meisnate12/plex-meta-manager?style=plastic)](https://hub.docker.com/r/meisnate12/plex-meta-manager)
[![Discord](https://img.shields.io/discord/822460010649878528?label=Discord&style=plastic)](https://discord.gg/TsdpsFYqqm)
The original concept for Plex Meta Manager is [Plex Auto Collections](https://github.com/mza921/Plex-Auto-Collections), but this is rewritten from the ground up to be able to include a scheduler, metadata edits, multiple libraries, and logging. Plex Meta Manager is a Python 3 script that can be continuously run using YAML configuration files to update on a schedule the metadata of the movies, shows, and collections in your libraries as well as automatically build collections based on various methods all detailed in the wiki. Some collection examples that the script can automatically build and update daily include Plex Based Searches like actor, genre, or studio collections or Collections based on TMDb, IMDb, Trakt, TVDb, AniDB, or MyAnimeList lists and various other services.

View file

@ -1676,6 +1676,7 @@ class CollectionBuilder:
elif "tmdb_collection_details" in self.summaries: summary = get_summary("tmdb_collection_details", self.summaries)
elif "trakt_list_details" in self.summaries: summary = get_summary("trakt_list_details", self.summaries)
elif "tmdb_list_details" in self.summaries: summary = get_summary("tmdb_list_details", self.summaries)
elif "letterboxd_list_details" in self.summaries: summary = get_summary("letterboxd_list_details", self.summaries)
elif "tmdb_actor_details" in self.summaries: summary = get_summary("tmdb_actor_details", self.summaries)
elif "tmdb_crew_details" in self.summaries: summary = get_summary("tmdb_crew_details", self.summaries)
elif "tmdb_director_details" in self.summaries: summary = get_summary("tmdb_director_details", self.summaries)

View file

@ -85,6 +85,7 @@ class Cache:
rating_key TEXT,
library TEXT,
type TEXT,
overlay TEXT,
compare TEXT,
location TEXT)"""
)
@ -246,4 +247,4 @@ class Cache:
connection.row_factory = sqlite3.Row
with closing(connection.cursor()) as cursor:
cursor.execute("INSERT OR IGNORE INTO image_map(rating_key, library) VALUES(?, ?)", (rating_key, library))
cursor.execute("UPDATE poster_map SET location = ?, compare = ? WHERE rating_key = ? AND library = ? AND type = ?", (location, compare, rating_key, library, image_type))
cursor.execute("UPDATE image_map SET location = ?, compare = ? WHERE rating_key = ? AND library = ? AND type = ?", (location, compare, rating_key, library, image_type))

View file

@ -413,8 +413,8 @@ class PlexAPI:
def reload(self, item):
item.reload(checkFiles=False, includeAllConcerts=False, includeBandwidths=False, includeChapters=False,
includeChildren=False, includeConcerts=False, includeExternalMedia=False, includeExtras=False,
includeFields='', includeGeolocation=False, includeLoudnessRamps=False, includeMarkers=False,
includeOnDeck=False, includePopularLeaves=False, includePreferences=False, includeRelated=False,
includeFields=False, includeGeolocation=False, includeLoudnessRamps=False, includeMarkers=False,
includeOnDeck=False, includePopularLeaves=False, includeRelated=False,
includeRelatedCount=0, includeReviews=False, includeStations=False)
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
@ -442,17 +442,22 @@ class PlexAPI:
try:
image = None
if self.config.Cache:
image = self.config.Cache.query_image_map(item.ratingKey, self.original_mapping_name, image_type)
if image is None or (image_type == "poster" and image != item.thumb) or (image_type == "background" and image != item.art):
image, image_compare = self.config.Cache.query_image_map(item.ratingKey, self.original_mapping_name, image_type)
compare = location if url else os.stat(location).st_size
if compare != image_compare:
image = None
if image is None \
or (image_type == "poster" and image != item.thumb) \
or (image_type == "background" and image != item.art):
self._upload_image(item, location, poster=poster, url=url)
if self.config.Cache:
self.reload(item)
compare = location if url else os.stat(location).st_size
self.config.Cache.update_image_map(item.ratingKey, self.original_mapping_name, image_type, item.thumb if image_type == "poster" else item.art, compare)
logger.info(f"Detail: {attr} updated {message}")
else:
logger.info(f"Detail: {name}{image_type} update not needed")
except BadRequest:
util.print_stacktrace()
logger.error(f"Detail: {attr} failed to update {message}")
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed)

View file

@ -349,7 +349,7 @@ def regex_first_int(data, id_type, default=None):
def centered(text, sep=" "):
if len(text) > screen_width - 2:
raise Failed("text must be shorter then screen_width")
return text
space = screen_width - len(text) - 2
text = f" {text} "
if space % 2 == 1: