|
|
|
@ -503,61 +503,8 @@ class Operations:
|
|
|
|
|
name = None
|
|
|
|
|
new_poster = None
|
|
|
|
|
new_background = None
|
|
|
|
|
if self.library.mass_poster_update:
|
|
|
|
|
if self.library.mass_poster_update == "lock":
|
|
|
|
|
self.library.query(item.lockPoster)
|
|
|
|
|
logger.info("Poster | Locked")
|
|
|
|
|
elif self.library.mass_poster_update == "unlock":
|
|
|
|
|
self.library.query(item.unlockPoster)
|
|
|
|
|
logger.info("Poster | Unlocked")
|
|
|
|
|
else:
|
|
|
|
|
poster_location = "the Assets Directory" if new_poster else ""
|
|
|
|
|
poster_url = False if new_poster else True
|
|
|
|
|
new_poster = new_poster.location if new_poster else None
|
|
|
|
|
if not new_poster:
|
|
|
|
|
if self.library.mass_poster_update == "tmdb" and tmdb_item:
|
|
|
|
|
new_poster = tmdb_item.poster_url
|
|
|
|
|
poster_location = "TMDb"
|
|
|
|
|
if not new_poster:
|
|
|
|
|
poster = next((p for p in item.posters()), None)
|
|
|
|
|
if poster:
|
|
|
|
|
new_poster = f"{self.library.url}{poster.key}&X-Plex-Token={self.library.token}"
|
|
|
|
|
poster_location = "Plex"
|
|
|
|
|
if new_poster:
|
|
|
|
|
self.library.upload_poster(item, new_poster, url=poster_url)
|
|
|
|
|
logger.info(f"Poster | Reset from {poster_location}")
|
|
|
|
|
if "Overlay" in [la.tag for la in self.library.item_labels(item)]:
|
|
|
|
|
logger.info(self.library.edit_tags("label", item, remove_tags="Overlay", do_print=False))
|
|
|
|
|
else:
|
|
|
|
|
logger.warning("Poster | No Reset Image Found")
|
|
|
|
|
item.reload()
|
|
|
|
|
|
|
|
|
|
if self.library.mass_background_update:
|
|
|
|
|
if self.library.mass_background_update == "lock":
|
|
|
|
|
self.library.query(item.lockArt)
|
|
|
|
|
logger.info(f"Background | Locked")
|
|
|
|
|
elif self.library.mass_background_update == "unlock":
|
|
|
|
|
self.library.query(item.unlockArt)
|
|
|
|
|
logger.info(f"Background | Unlocked")
|
|
|
|
|
else:
|
|
|
|
|
background_location = "the Assets Directory" if new_background else ""
|
|
|
|
|
background_url = False if new_background else True
|
|
|
|
|
new_background = new_background.location if new_background else None
|
|
|
|
|
if not new_background:
|
|
|
|
|
if self.library.mass_background_update == "tmdb" and tmdb_item:
|
|
|
|
|
new_background = tmdb_item.backdrop_url
|
|
|
|
|
background_location = "TMDb"
|
|
|
|
|
if not new_background:
|
|
|
|
|
background = next((p for p in item.arts()), None)
|
|
|
|
|
if background:
|
|
|
|
|
new_background = f"{self.library.url}{background.key}&X-Plex-Token={self.library.token}"
|
|
|
|
|
background_location = "Plex"
|
|
|
|
|
if new_background:
|
|
|
|
|
self.library.upload_background(item, new_background, url=background_url)
|
|
|
|
|
logger.info(f"Background | Reset from {background_location}")
|
|
|
|
|
else:
|
|
|
|
|
logger.warning(f"Background | No Reset Image Found")
|
|
|
|
|
item.reload()
|
|
|
|
|
self.library.poster_update(item, new_poster, tmdb=tmdb_item.poster_url)
|
|
|
|
|
self.library.background_update(item, new_background, tmdb=tmdb_item.backdrop_url)
|
|
|
|
|
|
|
|
|
|
if self.library.is_show:
|
|
|
|
|
real_show = tmdb_item.load_show() if tmdb_item else None
|
|
|
|
@ -568,56 +515,10 @@ class Operations:
|
|
|
|
|
except Failed:
|
|
|
|
|
season_poster = None
|
|
|
|
|
season_background = None
|
|
|
|
|
tmdb_poster = tmdb_seasons[season.seasonNumber].poster_url if season.seasonNumber in tmdb_seasons else None
|
|
|
|
|
self.library.poster_update(season, season_poster, tmdb=tmdb_poster, title=season.title)
|
|
|
|
|
self.library.background_update(season, season_background, title=season.title)
|
|
|
|
|
|
|
|
|
|
if self.library.mass_poster_update:
|
|
|
|
|
if self.library.mass_poster_update == "lock":
|
|
|
|
|
self.library.query(season.lockPoster)
|
|
|
|
|
logger.info(f"{season.title} Poster | Locked")
|
|
|
|
|
elif self.library.mass_poster_update == "unlock":
|
|
|
|
|
self.library.query(season.unlockPoster)
|
|
|
|
|
logger.info(f"{season.title} Poster | Unlocked")
|
|
|
|
|
else:
|
|
|
|
|
poster_location = "the Assets Directory" if season_poster else ""
|
|
|
|
|
poster_url = False if season_poster else True
|
|
|
|
|
season_poster = season_poster.location if season_poster else None
|
|
|
|
|
if not season_poster:
|
|
|
|
|
if self.library.mass_poster_update == "tmdb" and season.seasonNumber in tmdb_seasons:
|
|
|
|
|
season_poster = tmdb_seasons[season.seasonNumber].poster_url
|
|
|
|
|
poster_location = "TMDb"
|
|
|
|
|
if not season_poster:
|
|
|
|
|
poster = next((p for p in season.posters()), None)
|
|
|
|
|
if poster:
|
|
|
|
|
season_poster = f"{self.library.url}{poster.key}&X-Plex-Token={self.library.token}"
|
|
|
|
|
poster_location = "Plex"
|
|
|
|
|
if season_poster:
|
|
|
|
|
self.library.upload_poster(season, season_poster, url=poster_url)
|
|
|
|
|
logger.info(f"{season.title} Poster | Reset from {poster_location}")
|
|
|
|
|
if "Overlay" in [la.tag for la in self.library.item_labels(season)]:
|
|
|
|
|
logger.info(self.library.edit_tags("label", season, remove_tags="Overlay", do_print=False))
|
|
|
|
|
else:
|
|
|
|
|
logger.warning(f"{season.title} Poster | No Reset Image Found")
|
|
|
|
|
item.reload()
|
|
|
|
|
if self.library.mass_background_update:
|
|
|
|
|
if self.library.mass_background_update == "lock":
|
|
|
|
|
self.library.query(season.lockArt)
|
|
|
|
|
logger.info(f"{season.title} Background | Locked")
|
|
|
|
|
elif self.library.mass_background_update == "unlock":
|
|
|
|
|
self.library.query(season.unlockArt)
|
|
|
|
|
logger.info(f"{season.title} Background | Unlocked")
|
|
|
|
|
else:
|
|
|
|
|
background_location = "the Assets Directory" if season_background else ""
|
|
|
|
|
background_url = False if season_background else True
|
|
|
|
|
season_background = season_background.location if season_background else None
|
|
|
|
|
if not season_background:
|
|
|
|
|
background = next((p for p in item.arts()), None)
|
|
|
|
|
if background:
|
|
|
|
|
season_background = f"{self.library.url}{background.key}&X-Plex-Token={self.library.token}"
|
|
|
|
|
background_location = "Plex"
|
|
|
|
|
if season_background:
|
|
|
|
|
self.library.upload_background(item, season_background, url=background_url)
|
|
|
|
|
logger.info(f"{season.title} Background | Reset from {background_location}")
|
|
|
|
|
else:
|
|
|
|
|
logger.warning(f"{season.title} Background | No Reset Image Found")
|
|
|
|
|
tmdb_episodes = {}
|
|
|
|
|
if season.seasonNumber in tmdb_seasons:
|
|
|
|
|
for episode in tmdb_seasons[season.seasonNumber].episodes:
|
|
|
|
@ -632,57 +533,9 @@ class Operations:
|
|
|
|
|
except Failed:
|
|
|
|
|
episode_poster = None
|
|
|
|
|
episode_background = None
|
|
|
|
|
|
|
|
|
|
if self.library.mass_poster_update:
|
|
|
|
|
if self.library.mass_poster_update == "lock":
|
|
|
|
|
self.library.query(episode.lockPoster)
|
|
|
|
|
logger.info(f"{episode.title} Poster | Locked")
|
|
|
|
|
elif self.library.mass_poster_update == "unlock":
|
|
|
|
|
self.library.query(episode.unlockPoster)
|
|
|
|
|
logger.info(f"{episode.title} Poster | Unlocked")
|
|
|
|
|
else:
|
|
|
|
|
poster_location = "the Assets Directory" if episode_poster else ""
|
|
|
|
|
poster_url = False if episode_poster else True
|
|
|
|
|
episode_poster = episode_poster.location if episode_poster else None
|
|
|
|
|
if not episode_poster:
|
|
|
|
|
if self.library.mass_poster_update == "tmdb" and episode.episodeNumber in tmdb_episodes:
|
|
|
|
|
episode_poster = tmdb_episodes[episode.episodeNumber].still_url
|
|
|
|
|
poster_location = "TMDb"
|
|
|
|
|
if not episode_poster:
|
|
|
|
|
poster = next((p for p in episode.posters()), None)
|
|
|
|
|
if poster:
|
|
|
|
|
episode_poster = f"{self.library.url}{poster.key}&X-Plex-Token={self.library.token}"
|
|
|
|
|
poster_location = "Plex"
|
|
|
|
|
if episode_poster:
|
|
|
|
|
self.library.upload_poster(episode, episode_poster, url=poster_url)
|
|
|
|
|
logger.info(f"{episode.title} Poster | Reset from {poster_location}")
|
|
|
|
|
if "Overlay" in [la.tag for la in self.library.item_labels(episode)]:
|
|
|
|
|
logger.info(self.library.edit_tags("label", episode, remove_tags="Overlay", do_print=False))
|
|
|
|
|
else:
|
|
|
|
|
logger.warning(f"{episode.title} Poster | No Reset Image Found")
|
|
|
|
|
item.reload()
|
|
|
|
|
if self.library.mass_background_update:
|
|
|
|
|
if self.library.mass_background_update == "lock":
|
|
|
|
|
self.library.query(episode.lockArt)
|
|
|
|
|
logger.info(f"{episode.title} Background | Locked")
|
|
|
|
|
elif self.library.mass_background_update == "unlock":
|
|
|
|
|
self.library.query(episode.unlockArt)
|
|
|
|
|
logger.info(f"{episode.title} Background | Unlocked")
|
|
|
|
|
else:
|
|
|
|
|
background_location = "the Assets Directory" if episode_background else ""
|
|
|
|
|
background_url = False if episode_background else True
|
|
|
|
|
episode_background = episode_background.location if episode_background else None
|
|
|
|
|
if not episode_background:
|
|
|
|
|
background = next((p for p in item.arts()), None)
|
|
|
|
|
if background:
|
|
|
|
|
episode_background = f"{self.library.url}{background.key}&X-Plex-Token={self.library.token}"
|
|
|
|
|
background_location = "Plex"
|
|
|
|
|
if episode_background:
|
|
|
|
|
self.library.upload_background(item, episode_background, url=background_url)
|
|
|
|
|
logger.info(f"{episode.title} Background | Reset from {background_location}")
|
|
|
|
|
else:
|
|
|
|
|
logger.warning(f"{episode.title} Background | No Reset Image Found")
|
|
|
|
|
item.reload()
|
|
|
|
|
tmdb_poster = tmdb_episodes[episode.episodeNumber].still_url if episode.episodeNumber in tmdb_episodes else None
|
|
|
|
|
self.library.poster_update(episode, episode_poster, tmdb=tmdb_poster, title=episode.title)
|
|
|
|
|
self.library.background_update(episode, episode_background, title=episode.title)
|
|
|
|
|
|
|
|
|
|
episode_ops = [self.library.mass_episode_audience_rating_update, self.library.mass_episode_critic_rating_update, self.library.mass_episode_user_rating_update]
|
|
|
|
|
|
|
|
|
|