Skip to content

Commit

Permalink
[2] Properly use per-season backdrop files in Card creation
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinHeist committed Nov 3, 2024
1 parent 07cdaa5 commit 4639e7a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
19 changes: 12 additions & 7 deletions app/internal/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,18 @@ def resolve_card_settings(
card_settings['watched_style' if watched else 'unwatched_style'],
)
else:
card_settings['source_file'] = CleanPath(preferences.source_directory \
/ series.path_safe_name \
/ FormatString.new(
card_settings['source_file'], data=card_settings,
name='source file format', series=series, episode=episode,
log=log,
)).sanitize()
card_settings['source_file'] = CleanPath(
preferences.source_directory \
/ series.path_safe_name \
/ FormatString.new(
card_settings['source_file'],
data=card_settings,
name='source file format',
series=series,
episode=episode,
log=log,
)
).sanitize()

# Exit if the source file does not exist
if (CardClass.USES_SOURCE_IMAGES
Expand Down
7 changes: 6 additions & 1 deletion app/models/episode.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,12 @@ def get_source_file(self, style: Style) -> Path:
# No manually specified source, use default based on style
if (source_name := self.source_file) is None:
if 'art' in style:
source_name = 'backdrop.jpg'
return self.series.get_backdrop_file(
self.season_number
if self.series.use_per_season_assets
else None,
fallback=True,
).resolve()
else:
source_name = f's{self.season_number}e{self.episode_number}.jpg'

Expand Down
4 changes: 2 additions & 2 deletions app/models/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,9 @@ def get_backdrop_file(self,
return source_dir / 'backdrop.jpg'

# Look for the season-specific poster
if ((logo := source_dir / f'backdrop_season{season_number}.jpg').exists()
if ((file := source_dir / f'backdrop_season{season_number}.jpg').exists()
or not fallback):
return logo
return file

return source_dir / 'backdrop.jpg'

Expand Down
2 changes: 1 addition & 1 deletion modules/ref/version_webui
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.0-alpha.13.0-webui1
v2.0-alpha.13.0-webui2

0 comments on commit 4639e7a

Please sign in to comment.