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('<h3>Description</h3>')
|
||||||
description_sections.append(description)
|
description_sections.append(description)
|
||||||
|
|
||||||
# Add screenshot if available
|
# Add screenshots if available (now handles multiple)
|
||||||
if 'screenshot_url' in app and app['screenshot_url']:
|
if 'screenshots' in app and isinstance(app['screenshots'], list) and len(app['screenshots']) > 0:
|
||||||
description_sections.append('<h3>Screenshot</h3>')
|
description_sections.append('<h3>Screenshots</h3>')
|
||||||
screenshot_url = str(app['screenshot_url'])
|
screenshots_html = []
|
||||||
description_sections.append(f'<img src="{screenshot_url}" alt="Screenshot" style="max-width: 100%; height: auto;" />')
|
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
|
# Add changelog if available
|
||||||
if 'changelog' in app and isinstance(app['changelog'], list) and len(app['changelog']) > 0:
|
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:
|
else:
|
||||||
fe.description("No description available")
|
fe.description("No description available")
|
||||||
|
|
||||||
# Add screenshot URL as a link with rel='enclosure' (for media) - backup for readers that support it
|
# Add all screenshot URLs as enclosures
|
||||||
if 'screenshot_url' in app and app['screenshot_url']:
|
if 'screenshots' in app and isinstance(app['screenshots'], list):
|
||||||
fe.link(href=str(app['screenshot_url']), rel='enclosure', type='image/png')
|
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
|
# Set publication date if available
|
||||||
pub_date = None
|
pub_date = None
|
||||||
|
|||||||
Reference in New Issue
Block a user