diff --git a/src/snapshot_downloader.py b/src/snapshot_downloader.py index 5850859..8fbe820 100644 --- a/src/snapshot_downloader.py +++ b/src/snapshot_downloader.py @@ -299,13 +299,14 @@ class SnapshotDownloader: return all_snapshots async def format_snapshot_html( - self, snapshot: Dict[str, Any], session: aiohttp.ClientSession + self, snapshot: Dict[str, Any], session: aiohttp.ClientSession, index: int = 0 ) -> str: """ - Format a single snapshot as HTML. + Format a single snapshot as HTML with parent-friendly design. Args: snapshot: Snapshot dictionary from API + index: Index for alternating accent colors Returns: HTML string for the snapshot @@ -314,10 +315,9 @@ class SnapshotDownloader: snapshot_id = snapshot.get("id", "unknown") content = snapshot.get("notes", "") # Don't escape HTML in notes field start_time = snapshot.get("startTime", "") - snapshot_type = snapshot.get("type", "Snapshot") - # Format dates - start_date = self.format_date(start_time) if start_time else "Unknown" + # Format dates in friendly format + start_date = self.format_date_short(start_time) if start_time else "" # Extract additional information author = snapshot.get("author", {}) @@ -326,58 +326,49 @@ class SnapshotDownloader: author_name = ( html.escape(f"{author_forename} {author_surname}".strip()) if author - else "Unknown" + else "" ) # Extract child information (if any) child = snapshot.get("child", {}) child_forename = child.get("forename", "") if child else "" - child_name = ( - html.escape( - f"{child.get('forename', '')} {child.get('surname', '')}".strip() - ) - if child - else "" - ) + child_name = html.escape(child_forename) if child_forename else "" - # Create title in format: "Child Forename by Author Forename Surname" - if child_forename and author_forename: - title = html.escape( - f"{child_forename} by {author_forename} {author_surname}".strip() - ) + # Create friendly title + if child_forename: + title = html.escape(child_forename) else: - title = html.escape(f"Snapshot {snapshot_id}") + title = "Memory" # Extract location/activity information activity = snapshot.get("activity", {}) activity_name = html.escape(activity.get("name", "")) if activity else "" - # Build HTML + # Soft accent colors for cards + accent_colors = ["#FFE4E1", "#E0F7FA", "#FFF8E1", "#F3E5F5", "#E8F5E9"] + accent = accent_colors[index % len(accent_colors)] + + # Build parent-friendly HTML html_content = f""" -
Updated: {self.format_date(image.get("updated", ""))}
\n' media_html += "{image_name} (online)
\n' - ) - media_html += f'Updated: {self.format_date(image.get("updated", ""))}
\n' media_html += "\n' - metadata_html += html.escape(json.dumps(snapshot, indent=2, default=str)) - metadata_html += "\n\n" - metadata_html += "
{friendly_date_range}
+