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
This commit is contained in:
sebastjanartic 2025-09-17 07:17:55 +00:00
parent 52b6330b1b
commit 427f0511c7
2 changed files with 32 additions and 5 deletions

View File

@ -40,3 +40,4 @@ args = "npm run dev"
waitForPort = 5000
[agent]
integrations = ["javascript_log_in_with_replit:1.0.0"]

View File

@ -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)
};