import { ContentSegment } from "../../lib/parsing";
import { usePodcastStore } from "../../stores/podcast";
export function VideoBlock({ sources }: { sources: string[] }) {
if (sources.length === 0) return null;
return (
{sources.map((src, i) => (
);
}
function cleanAudioName(url: string): string {
const raw = url.split("/").pop()?.split("?")[0] ?? url;
// Remove file extension
const name = raw.replace(/\.(mp3|m4a|ogg|opus|wav|flac|aac)$/i, "");
// Decode URI components and replace common separators with spaces
try {
return decodeURIComponent(name).replace(/[-_]+/g, " ");
} catch {
return name.replace(/[-_]+/g, " ");
}
}
export function AudioBlock({ sources }: { sources: string[] }) {
const play = usePodcastStore((s) => s.play);
if (sources.length === 0) return null;
return (
{sources.map((src, i) => {
const name = cleanAudioName(src);
return (
);
})}
);
}
export function YouTubeCard({ seg }: { seg: ContentSegment }) {
return (
);
}
export function VimeoCard({ seg }: { seg: ContentSegment }) {
return (
);
}
export function SpotifyCard({ seg }: { seg: ContentSegment }) {
return (
S
Spotify · {seg.mediaType}
{seg.value}
);
}
export function TidalCard({ seg }: { seg: ContentSegment }) {
return (
T
Tidal · {seg.mediaType}
{seg.value}
);
}