feat: differentiate between studios and producers in media info and dynamic preview

This commit is contained in:
benexl
2025-12-31 18:11:10 +03:00
parent 6e26ac500d
commit e49baed46f
3 changed files with 12 additions and 2 deletions

View File

@@ -367,7 +367,10 @@ def main():
end_date = format_date(media.get("endDate"))
studios_list = media.get("studios", {}).get("nodes", [])
studios = ", ".join([s.get("name", "") for s in studios_list if s.get("name")]) or "Unknown"
# Studios are those with isAnimationStudio=true
studios = ", ".join([s.get("name", "") for s in studios_list if s.get("name") and s.get("isAnimationStudio")]) or "N/A"
# Producers are those with isAnimationStudio=false
producers = ", ".join([s.get("name", "") for s in studios_list if s.get("name") and not s.get("isAnimationStudio")]) or "N/A"
synonyms_list = media.get("synonyms", [])
# Include romaji in synonyms if different from title
@@ -460,6 +463,7 @@ def main():
rows = [
("Studios", studios),
("Producers", producers),
]
print_rule(SEPARATOR_COLOR)

View File

@@ -67,6 +67,7 @@ for key, value in rows:
rows = [
("Studios", "{STUDIOS}"),
("Producers", "{PRODUCERS}"),
]
print_rule(SEPARATOR_COLOR)

View File

@@ -189,7 +189,12 @@ class PreviewCacheWorker(ManagedBackgroundWorker):
),
"STUDIOS": formatter.shell_safe(
formatter.format_list_with_commas(
[t.name for t in media_item.studios if t.name]
[t.name for t in media_item.studios if t.name and t.is_animation_studio]
)
),
"PRODUCERS": formatter.shell_safe(
formatter.format_list_with_commas(
[t.name for t in media_item.studios if t.name and not t.is_animation_studio]
)
),
"SYNONYMNS": formatter.shell_safe(