From c6c0429fb328750dd6ccf5816e924c7c3d3e3275 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Fri, 11 Jun 2021 10:26:11 -0400 Subject: [PATCH] various minor tweaks --- README.md | 7 ++++++- modules/builder.py | 1 + modules/cache.py | 3 ++- modules/plex.py | 15 ++++++++++----- modules/util.py | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f0035f64..57c9a74d 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/modules/builder.py b/modules/builder.py index cc6747e7..b491fc1e 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -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) diff --git a/modules/cache.py b/modules/cache.py index 14cbb3f9..59cebd8f 100644 --- a/modules/cache.py +++ b/modules/cache.py @@ -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)) diff --git a/modules/plex.py b/modules/plex.py index 0ff58b03..32402e28 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -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) diff --git a/modules/util.py b/modules/util.py index 4ffad4b5..a6f6105b 100644 --- a/modules/util.py +++ b/modules/util.py @@ -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: