Filter on basalt architecture
This commit is contained in:
+22
-14
@@ -106,21 +106,29 @@ def build_screenshots_html(app):
|
||||
screenshots = [{'url': app['screenshot_url']}]
|
||||
|
||||
if screenshots:
|
||||
screenshots_html = '<div style="display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: nowrap; overflow-x: auto;">'
|
||||
for idx, screenshot in enumerate(screenshots, 1):
|
||||
url = screenshot.get("url", "")
|
||||
width = screenshot.get("width", "auto")
|
||||
height = screenshot.get("height", "auto")
|
||||
hardware = screenshot.get("hardware", "")
|
||||
|
||||
label = f"Screenshot {idx}"
|
||||
if hardware:
|
||||
label += f" ({hardware})"
|
||||
|
||||
if url:
|
||||
screenshots_html += f'<img src="{url}" alt="{label}" title="{label}" width="{width}" height="{height}" style="max-height: 300px; flex-shrink: 0;" />'
|
||||
# Filter screenshots: prefer "basalt" hardware, then fall back to no hardware specified
|
||||
basalt_screenshots = [s for s in screenshots if s.get("hardware") == "basalt"]
|
||||
if basalt_screenshots:
|
||||
screenshots = basalt_screenshots
|
||||
else:
|
||||
screenshots = [s for s in screenshots if not s.get("hardware")]
|
||||
|
||||
screenshots_html += '</div>'
|
||||
if screenshots:
|
||||
screenshots_html = '<div style="display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: nowrap; overflow-x: auto;">'
|
||||
for idx, screenshot in enumerate(screenshots, 1):
|
||||
url = screenshot.get("url", "")
|
||||
width = screenshot.get("width", "auto")
|
||||
height = screenshot.get("height", "auto")
|
||||
hardware = screenshot.get("hardware", "")
|
||||
|
||||
label = f"Screenshot {idx}"
|
||||
if hardware:
|
||||
label += f" ({hardware})"
|
||||
|
||||
if url:
|
||||
screenshots_html += f'<img src="{url}" alt="{label}" title="{label}" width="{width}" height="{height}" style="max-height: 300px; flex-shrink: 0; margin: 20px;" />'
|
||||
|
||||
screenshots_html += '</div>'
|
||||
|
||||
return screenshots_html
|
||||
|
||||
|
||||
Reference in New Issue
Block a user