summaryrefslogtreecommitdiff
path: root/Biz/PodcastItLater/Core.py
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-15 19:11:45 -0500
committerBen Sima <ben@bsima.me>2025-11-15 19:11:45 -0500
commit9b4afe3f7ab98f42194d12cae430b0f7345c4644 (patch)
treefbfb89f8fc309d15e136f4ab035a795df3fe4d96 /Biz/PodcastItLater/Core.py
parent48afd6bdb135177842af593c7f96846b9ddab7d8 (diff)
Add individual episode pages with sharing and media player
- Create new Episode.py module with episode-specific components - EpisodePlayer: HTML5 audio player - ShareButton: Clipboard copy with Bootstrap input-group pattern - SignupBanner: Promotional banner for non-authenticated users - EpisodeDetailPage: Full page layout - Update Web.py to add /episode/<id> route (public, no auth required) - Make episode titles clickable in EpisodeList component - Add Database.get_episode_by_id() method for efficient queries - Update RSS feed and share buttons to use Bootstrap input-group pattern - Add comprehensive test suite for episode detail pages All episode pages are publicly accessible and include: - Media player to listen to episodes - Share button with URL copying - Links to original articles - Creator attribution banner for non-logged-in users Amp-Thread-ID: https://ampcode.com/threads/T-cc5d29f0-454e-4864-8d7e-1ad69a42afa9 Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'Biz/PodcastItLater/Core.py')
-rw-r--r--Biz/PodcastItLater/Core.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Biz/PodcastItLater/Core.py b/Biz/PodcastItLater/Core.py
index f32e81b..9e3f830 100644
--- a/Biz/PodcastItLater/Core.py
+++ b/Biz/PodcastItLater/Core.py
@@ -323,6 +323,23 @@ class Database: # noqa: PLR0904
return [dict(row) for row in rows]
@staticmethod
+ def get_episode_by_id(episode_id: int) -> dict[str, Any] | None:
+ """Fetch single episode by ID."""
+ with Database.get_connection() as conn:
+ cursor = conn.cursor()
+ cursor.execute(
+ """
+ SELECT id, title, audio_url, duration, created_at,
+ content_length, author, original_url, user_id
+ FROM episodes
+ WHERE id = ?
+ """,
+ (episode_id,),
+ )
+ row = cursor.fetchone()
+ return dict(row) if row is not None else None
+
+ @staticmethod
def get_all_episodes(
user_id: int | None = None,
) -> list[dict[str, Any]]: