diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 2bc2e0552..7a965357e 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -112,6 +112,7 @@ model Show { date DateTime url String youtube_url String? + spotify_url String? show_notes String @db.Text hash String @unique slug String diff --git a/shows/763 - Web Scraping.md b/shows/763 - Web Scraping.md index 75d9dce1e..c4dd5764a 100644 --- a/shows/763 - Web Scraping.md +++ b/shows/763 - Web Scraping.md @@ -3,6 +3,7 @@ number: 763 title: Web Scraping + Reverse Engineering APIs date: 1714561200000 url: https://traffic.libsyn.com/syntax/Syntax_-_763.mp3 +spotify_url: https://open.spotify.com/episode/6QuwVPSE0iSORqDnx4VSVN youtube_url: https://www.youtube.com/watch?v=5xWZT0MWz-4 --- diff --git a/src/lib/ListenLinks.svelte b/src/lib/ListenLinks.svelte index f0fdb8866..d550bae87 100644 --- a/src/lib/ListenLinks.svelte +++ b/src/lib/ListenLinks.svelte @@ -9,7 +9,7 @@ target="_blank" title="Watch or Listen on Spotify" aria-label="Spotify" - href="https://open.spotify.com/search/syntax.fm {encodeURI(show.title)}/episodes" + href={show.spotify_url ? show.spotify_url : `https://open.spotify.com/search/syntax.fm%20${encodeURIComponent(show.title)}/episodes`} > diff --git a/src/server/shows.ts b/src/server/shows.ts index 0976383f8..e106c1d1d 100644 --- a/src/server/shows.ts +++ b/src/server/shows.ts @@ -12,6 +12,7 @@ interface FrontMatterGuest { twitter: string; url: string; youtube_url?: string; + spotify_url?: string; social: string[]; } @@ -54,7 +55,7 @@ export async function import_or_update_all_changed_shows() { // If show doesn't exist or the hash has changed. Refresh if (!existing_show || existing_show.hash !== hash) { - console.log(`Refreshing Show # ${number}`); + console.log(`Refreshing Show # ${number}`); await parse_and_save_show_notes(md_file_contents, hash, number, md_file_path); } } @@ -99,8 +100,9 @@ export async function parse_and_save_show_notes( slug: slug(data.title), date, number, - url: data.url, + url: data.url, youtube_url: data.youtube_url, + spotify_url: data.spotify_url, show_notes: content, hash: hash, md_file, @@ -114,6 +116,7 @@ export async function parse_and_save_show_notes( date, url: data.url, youtube_url: data.youtube_url, + spotify_url: data.spotify_url, show_notes: content, hash: hash, md_file,