diff --git a/.replit b/.replit index 6ce283d..a8ca264 100644 --- a/.replit +++ b/.replit @@ -15,6 +15,10 @@ run = ["npm", "run", "start"] localPort = 5000 externalPort = 80 +[[ports]] +localPort = 45029 +externalPort = 3000 + [env] PORT = "5000" diff --git a/client/src/components/video-card.tsx b/client/src/components/video-card.tsx index e0044d7..f91848d 100644 --- a/client/src/components/video-card.tsx +++ b/client/src/components/video-card.tsx @@ -2,6 +2,7 @@ import { Play, Volume2, VolumeX } from "lucide-react"; import { type Video } from "@shared/schema"; import { useState, useRef, useEffect } from "react"; import Hls from "hls.js"; +import { parseArtistTitle } from "@/lib/title-parser"; interface VideoCardProps { video: Video; @@ -329,12 +330,14 @@ export default function VideoCard({ video, onClick, className = "", hideOverlay
{/* Artist/Performer in UPPERCASE - first line */}

- {(video.title.split(' - ')[0] || 'video.folx.tv').substring(0, 35)} + {parseArtistTitle(video.title).artist.substring(0, 35)}

- {/* Song title - second line */} -

- {(video.title.split(' - ')[1] || video.title).substring(0, 50)} -

+ {/* Song title - second line (only show if exists) */} + {parseArtistTitle(video.title).song && ( +

+ {parseArtistTitle(video.title).song.substring(0, 50)} +

+ )}
)} diff --git a/client/src/lib/title-parser.ts b/client/src/lib/title-parser.ts new file mode 100644 index 0000000..4fdb51f --- /dev/null +++ b/client/src/lib/title-parser.ts @@ -0,0 +1,32 @@ +/** + * Utility to parse video titles into artist and song parts + * Handles various dash characters: hyphen (-), en dash (–), em dash (—) + */ + +export interface ParsedTitle { + artist: string; + song: string; +} + +export function parseArtistTitle(title: string): ParsedTitle { + // Match various dash types with optional spaces + const dashRegex = /\s*[-–—]\s*/; + const parts = title.split(dashRegex); + + if (parts.length >= 2) { + // Found a delimiter - split into artist and song + const artist = parts[0].trim(); + const song = parts.slice(1).join(' - ').trim(); // Rejoin if multiple dashes + + return { + artist: artist || 'video.folx.tv', + song: song || title + }; + } + + // No delimiter found - use full title as artist, empty song + return { + artist: title || 'video.folx.tv', + song: '' + }; +} \ No newline at end of file