Handle multiple screenshots
This commit is contained in:
+25
-8
@@ -143,11 +143,26 @@ def create_rss_feed(apps_data, feed_name, feed_description, output_file):
|
||||
description_sections.append('<h3>Description</h3>')
|
||||
description_sections.append(description)
|
||||
|
||||
# Add screenshot if available
|
||||
if 'screenshot_url' in app and app['screenshot_url']:
|
||||
description_sections.append('<h3>Screenshot</h3>')
|
||||
screenshot_url = str(app['screenshot_url'])
|
||||
description_sections.append(f'<img src="{screenshot_url}" alt="Screenshot" style="max-width: 100%; height: auto;" />')
|
||||
# Add screenshots if available (now handles multiple)
|
||||
if 'screenshots' in app and isinstance(app['screenshots'], list) and len(app['screenshots']) > 0:
|
||||
description_sections.append('<h3>Screenshots</h3>')
|
||||
screenshots_html = []
|
||||
for idx, screenshot in enumerate(app['screenshots'], 1):
|
||||
if isinstance(screenshot, dict) and 'url' in screenshot:
|
||||
url = str(screenshot['url'])
|
||||
hardware = screenshot.get('hardware', '')
|
||||
width = screenshot.get('width', 144)
|
||||
height = screenshot.get('height', 168)
|
||||
|
||||
# Add hardware label if available
|
||||
if hardware:
|
||||
screenshots_html.append(f'<p><strong>Screenshot {idx} ({hardware})</strong></p>')
|
||||
else:
|
||||
screenshots_html.append(f'<p><strong>Screenshot {idx}</strong></p>')
|
||||
|
||||
screenshots_html.append(f'<img src="{url}" alt="Screenshot {idx}" width="{width}" height="{height}" style="max-width: 100%; height: auto;" />')
|
||||
|
||||
description_sections.append('\n'.join(screenshots_html))
|
||||
|
||||
# Add changelog if available
|
||||
if 'changelog' in app and isinstance(app['changelog'], list) and len(app['changelog']) > 0:
|
||||
@@ -200,9 +215,11 @@ def create_rss_feed(apps_data, feed_name, feed_description, output_file):
|
||||
else:
|
||||
fe.description("No description available")
|
||||
|
||||
# Add screenshot URL as a link with rel='enclosure' (for media) - backup for readers that support it
|
||||
if 'screenshot_url' in app and app['screenshot_url']:
|
||||
fe.link(href=str(app['screenshot_url']), rel='enclosure', type='image/png')
|
||||
# Add all screenshot URLs as enclosures
|
||||
if 'screenshots' in app and isinstance(app['screenshots'], list):
|
||||
for screenshot in app['screenshots']:
|
||||
if isinstance(screenshot, dict) and 'url' in screenshot:
|
||||
fe.link(href=str(screenshot['url']), rel='enclosure', type='image/png')
|
||||
|
||||
# Set publication date if available
|
||||
pub_date = None
|
||||
|
||||
Reference in New Issue
Block a user