|
|
|
@ -159,18 +159,25 @@ class Overlays:
|
|
|
|
|
has_original = os.path.join(self.library.overlay_backup, f"{item.ratingKey}.png")
|
|
|
|
|
elif os.path.exists(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.jpg")):
|
|
|
|
|
has_original = os.path.join(self.library.overlay_backup, f"{item.ratingKey}.jpg")
|
|
|
|
|
if self.library.reset_overlays == "plex" or (has_original is None and self.library.reset_overlays is None):
|
|
|
|
|
temp_poster = next((p for p in item.posters() if p.provider == "local"), None)
|
|
|
|
|
if temp_poster:
|
|
|
|
|
new_backup = f"{self.library.url}{temp_poster.key}&X-Plex-Token={self.library.token}"
|
|
|
|
|
else:
|
|
|
|
|
logger.trace("Plex Error: Plex Poster Download Failed")
|
|
|
|
|
if self.library.reset_overlays == "tmdb" or (has_original is None and new_backup is None and self.library.reset_overlays is None):
|
|
|
|
|
try:
|
|
|
|
|
new_backup = self.find_poster_url(item)
|
|
|
|
|
except Failed as e:
|
|
|
|
|
logger.trace(e)
|
|
|
|
|
if not new_backup and self.library.reset_overlays is not None:
|
|
|
|
|
if self.library.reset_overlays:
|
|
|
|
|
reset_list = self.library.reset_overlays
|
|
|
|
|
elif has_original is None and not self.library.reset_overlays:
|
|
|
|
|
reset_list = ["plex", "tmdb"]
|
|
|
|
|
else:
|
|
|
|
|
reset_list = []
|
|
|
|
|
for reset in reset_list:
|
|
|
|
|
if reset == "plex":
|
|
|
|
|
temp_poster = next((p for p in item.posters() if p.provider == "local"), None)
|
|
|
|
|
if temp_poster:
|
|
|
|
|
new_backup = f"{self.library.url}{temp_poster.key}&X-Plex-Token={self.library.token}"
|
|
|
|
|
else:
|
|
|
|
|
logger.trace("Plex Error: Plex Poster Download Failed")
|
|
|
|
|
if reset == "tmdb":
|
|
|
|
|
try:
|
|
|
|
|
new_backup = self.find_poster_url(item)
|
|
|
|
|
except Failed as e:
|
|
|
|
|
logger.trace(e)
|
|
|
|
|
if not new_backup and not self.library.reset_overlays:
|
|
|
|
|
logger.error("Overlay Error: Reset Failed")
|
|
|
|
|
else:
|
|
|
|
|
new_backup = item.posterUrl
|
|
|
|
|