From 427f0511c74723dae8f7253c72d5d069b218ee03 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Wed, 17 Sep 2025 07:17:55 +0000 Subject: [PATCH] Update video processing to extract artist information from metadata Extract artist metadata and clean video titles and artist names by removing file extensions from Bunny.net video data. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 45a1dcfc-f8a2-475a-a6b9-96fbb841dc27 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/60d372ff-2c10-46c7-b01b-10c3435136b0/45a1dcfc-f8a2-475a-a6b9-96fbb841dc27/pjFeepJ --- .replit | 1 + server/bunny.ts | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/.replit b/.replit index c806144..6ce283d 100644 --- a/.replit +++ b/.replit @@ -40,3 +40,4 @@ args = "npm run dev" waitForPort = 5000 [agent] +integrations = ["javascript_log_in_with_replit:1.0.0"] diff --git a/server/bunny.ts b/server/bunny.ts index 7161539..8e273fd 100644 --- a/server/bunny.ts +++ b/server/bunny.ts @@ -84,7 +84,10 @@ export class BunnyService { // Extract description from BunnyVideoDetails if available let description = 'description' in bunnyVideo ? bunnyVideo.description || "" : ""; - // Always check metaTags for description since Bunny.net stores it there + // Extract artist from metaTags if available + let artist = null; + + // Always check metaTags for description and artist since Bunny.net stores it there if (bunnyVideo.metaTags && bunnyVideo.metaTags.length > 0) { const descriptionTag = bunnyVideo.metaTags.find((tag: any) => tag.property?.toLowerCase() === 'description' @@ -92,6 +95,23 @@ export class BunnyService { if (descriptionTag && descriptionTag.value) { description = descriptionTag.value; } + + // Look for artist in metaTags + const artistTag = bunnyVideo.metaTags.find((tag: any) => + tag.property?.toLowerCase() === 'artist' || tag.property?.toLowerCase() === 'performer' + ); + if (artistTag && artistTag.value) { + artist = artistTag.value; + } + } + + // Clean title - remove .mpg4, .mp4, .MPG4, .MP4 extensions + let cleanTitle = bunnyVideo.title || 'Untitled Video'; + cleanTitle = cleanTitle.replace(/\.(mpg4|mp4|MPG4|MP4)$/i, ''); + + // Clean artist - remove .mpg4, .mp4, .MPG4, .MP4 extensions if artist exists + if (artist) { + artist = artist.replace(/\.(mpg4|mp4|MPG4|MP4)$/i, ''); } // No category from Bunny.net - keeping category empty @@ -102,16 +122,25 @@ export class BunnyService { return { id: bunnyVideo.guid, - title: bunnyVideo.title || 'Untitled Video', + title: cleanTitle, + artist: artist, description: description, + filename: null, + episodeNumber: null, + episodeTitle: null, thumbnailUrl, customThumbnailUrl: null, + faceCenterPosition: null, + facesDetected: null, + faceConfidence: null, videoUrl: hlsUrl, // Signed HLS URL videoUrlMp4: hlsUrl, // Use signed HLS URL for preview as well videoUrlIframe: iframeUrl, // iframe fallback duration: Math.floor(bunnyVideo.length || 0), views: bunnyVideo.views || 0, category: category, + contentType: 'video' as const, + genre: 'other' as const, tags: tags, isPublic: true, uploadStatus: "completed", @@ -121,9 +150,6 @@ export class BunnyService { resolution: null, format: null, encoding: null, - faceCenterPosition: null, - facesDetected: null, - faceConfidence: null, createdAt: new Date(bunnyVideo.dateUploaded), updatedAt: new Date(bunnyVideo.dateUploaded) };