From 31fe52f6875a805ebee54d41d7f97514e171e16b Mon Sep 17 00:00:00 2001 From: Satsuki Akiba Date: Sat, 7 Jun 2025 22:58:38 +0900 Subject: [PATCH] Revert "Update" This reverts commit 0549a6175332f0b3427b6131995cd8f1953744e1. --- frontend/src/components/EpisodeList.tsx | 15 +++++---------- server.ts | 14 ++------------ services/database.ts | 10 ++++++++++ services/podcast.ts | 12 +++--------- 4 files changed, 20 insertions(+), 31 deletions(-) diff --git a/frontend/src/components/EpisodeList.tsx b/frontend/src/components/EpisodeList.tsx index 12706cc..0049555 100644 --- a/frontend/src/components/EpisodeList.tsx +++ b/frontend/src/components/EpisodeList.tsx @@ -10,11 +10,6 @@ interface Episode { audioLength: string guid: string link: string - feedTitle?: string - feedUrl?: string - articleTitle?: string - articleLink?: string - articlePubDate?: string } interface EpisodeWithFeedInfo { @@ -86,12 +81,12 @@ function EpisodeList() { audioPath: episode.audioUrl, createdAt: episode.pubDate, articleId: episode.guid, - articleTitle: episode.articleTitle || episode.title, - articleLink: episode.articleLink || episode.link, - articlePubDate: episode.articlePubDate || episode.pubDate, + articleTitle: episode.title, + articleLink: episode.link, + articlePubDate: episode.pubDate, feedId: '', - feedTitle: episode.feedTitle || 'RSS Feed', - feedUrl: episode.feedUrl || '' + feedTitle: 'RSS Feed', + feedUrl: '' })) setEpisodes(convertedEpisodes) } diff --git a/server.ts b/server.ts index ba1e3bc..f2e6cee 100644 --- a/server.ts +++ b/server.ts @@ -147,12 +147,7 @@ app.get("/api/episodes-from-xml", async (c) => { audioUrl: item.enclosure?.[0]?.$?.url || '', audioLength: item.enclosure?.[0]?.$?.length || '0', guid: item.guid?.[0] || '', - link: item.link?.[0] || '', - feedTitle: item['source:feedTitle']?.[0] || '', - feedUrl: item['source:feedUrl']?.[0] || '', - articleTitle: item['source:articleTitle']?.[0] || '', - articleLink: item['source:articleLink']?.[0] || '', - articlePubDate: item['source:articlePubDate']?.[0] || '' + link: item.link?.[0] || '' }; episodes.push(episode); } @@ -214,12 +209,7 @@ app.get("/api/episode/:episodeId", async (c) => { audioUrl: targetItem.enclosure?.[0]?.$?.url || '', audioLength: targetItem.enclosure?.[0]?.$?.length || '0', guid: targetItem.guid?.[0] || '', - link: targetItem.link?.[0] || '', - feedTitle: targetItem['source:feedTitle']?.[0] || '', - feedUrl: targetItem['source:feedUrl']?.[0] || '', - articleTitle: targetItem['source:articleTitle']?.[0] || '', - articleLink: targetItem['source:articleLink']?.[0] || '', - articlePubDate: targetItem['source:articlePubDate']?.[0] || '' + link: targetItem.link?.[0] || '' }; return c.json({ episode }); diff --git a/services/database.ts b/services/database.ts index 14b30cc..e96124a 100644 --- a/services/database.ts +++ b/services/database.ts @@ -722,6 +722,16 @@ export async function saveEpisode( createdAt, ); + try { + performDatabaseIntegrityFixes(db); + console.log(`Episode saved: ${episode}`); + } catch (error) { + console.error( + "Error performing integrity fixes after saving feed:", + error, + ); + } + return id; } catch (error) { console.error("Error saving episode:", error); diff --git a/services/podcast.ts b/services/podcast.ts index 3104eac..1c4cacc 100644 --- a/services/podcast.ts +++ b/services/podcast.ts @@ -3,7 +3,6 @@ import { dirname } from "path"; import { Episode, fetchAllEpisodes, - fetchEpisodesWithFeedInfo, performDatabaseIntegrityFixes, } from "./database.js"; import path from "node:path"; @@ -19,7 +18,7 @@ function escapeXml(text: string): string { .replace(/'/g, "'"); } -function createItemXml(episode: any): string { +function createItemXml(episode: Episode): string { const fileUrl = `${config.podcast.baseUrl}/podcast_audio/${path.basename(episode.audioPath)}`; const pubDate = new Date(episode.createdAt).toUTCString(); @@ -47,17 +46,12 @@ function createItemXml(episode: any): string { ${escapeXml(fileUrl)} ${pubDate} - - ${escapeXml(episode.feedUrl || '')} - - ${escapeXml(episode.articleLink || '')} - ${episode.articlePubDate || ''} `; } export async function updatePodcastRSS(): Promise { try { - const episodes = await fetchEpisodesWithFeedInfo(); + const episodes: Episode[] = await fetchAllEpisodes(); // Filter episodes to only include those with valid audio files const validEpisodes = episodes.filter((episode) => { @@ -83,7 +77,7 @@ export async function updatePodcastRSS(): Promise { // Create RSS XML content const rssXml = ` - + ${escapeXml(config.podcast.title)} ${escapeXml(config.podcast.link)}