Skip to content

Commit 6adc9a0

Browse files
authored
Improve Blueprint card type export logic
Only export the global card type if one is not assigned by a Template
1 parent b0f7663 commit 6adc9a0

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

app/internal/blueprint.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ def generate_series_blueprint(
5454
Args:
5555
series: Series to generate the Blueprint of.
5656
raw_episode_data: List of episode data to include in the export.
57-
include_global_defaults: Whether to write global settings if the
58-
Series has no corresponding override, primarily for the
59-
card type.
6057
include_episode_overrides: Whether to include Episode-level
6158
overrides in the exported Blueprint. If True, then any
6259
Episode Font and Template assignments are also included.
@@ -66,8 +63,8 @@ def generate_series_blueprint(
6663
Blueprint that can be used to recreate the Series configuration.
6764
"""
6865

69-
# Get all Episodes if indicates
70-
episodes: list[Episode]=series.episodes if include_episode_overrides else []
66+
# Get all Episodes if indicated
67+
episodes = series.episodes if include_episode_overrides else []
7168

7269
# Get all Templates
7370
templates: list[Template] = list(set(
@@ -82,15 +79,12 @@ def generate_series_blueprint(
8279
# Create exported JSON object
8380
export_obj = {'series': {}, 'episodes': {}, 'templates': [], 'fonts': []}
8481

85-
# Append Series config
86-
if include_global_defaults:
87-
export_obj['series'] = TieredSettings.new_settings(
88-
get_preferences().export_properties,
89-
series.export_properties,
90-
)
91-
else:
92-
export_obj['series'] = series.export_properties
93-
export_obj['series'] = TieredSettings.filter(export_obj['series'])
82+
# Append Series config; add global card type IF one was not provided and
83+
# none of the associated Templates have one defined
84+
export_obj['series'] = TieredSettings.filter(series.export_properties)
85+
if (export_obj['series'].get('card_type') is None
86+
and all(template.card_type is None for template in templates)):
87+
export_obj['series']['card_type'] = preferences.default_card_type
9488

9589
# Add Series Source Images
9690
if mask_images:

0 commit comments

Comments
 (0)