feat: Add music search and favorite API routes, and introduce FFmpeg service for Reels.

This commit is contained in:
Michael committed 2026-03-03 12:34:09 +01:00
1 parent cb42558e52
commit 4fcc8cf53c
4 files changed
+44 -5

No files matched your search

+15 -2
View File
@@ -470,7 +470,8 @@ async function processReelBackground(
musicVolume?: number;
drawText?: boolean;
stabilize?: boolean;
}
},
storeName?: string
) {
const {
videoMediaId,
@@ -567,6 +568,7 @@ async function processReelBackground(
drawText,
stabilize,
watermarkUrl,
storeName,
});
console.log(`⏱️ [Background] FFmpeg took ${(Date.now() - startTime) / 1000}s`);
@@ -746,6 +748,17 @@ reelsRouter.post('/reels', async (req: Request, res: Response) => {
? "File d'attente pleine. Votre vidéo sera traitée dès que possible."
: "Traitement démarré en arrière-plan.";
// Récupérer le nom de la première page pour l'utiliser comme storeName
let storeName: string | undefined = undefined;
try {
const page = await storage.getSocialPage(pageIds[0]);
if (page) {
storeName = page.pageName;
}
} catch (e) {
console.error('Erreur récupération nom de page', e);
}
// Créer immédiatement le Post en base
// ON STOCKE LES PARAMS DU JOB DANS productInfo POUR POUVOIR LE REPRENDRE PLUS TARD
// C'est un hack car on n'a pas de table params_job, mais ça marche car productInfo est jsonb
@@ -764,7 +777,7 @@ reelsRouter.post('/reels', async (req: Request, res: Response) => {
if (!isQueueBusy) {
// Démarrer le traitement en arrière-plan (Fire & Forget)
processReelBackground(user.id, post.id, req.body).catch(err => {
processReelBackground(user.id, post.id, req.body, storeName).catch(err => {
console.error('🔥 Unhandled background error:', err);
});
} else {
+5
View File
@@ -19,6 +19,7 @@ interface FFmpegReelRequest {
draw_text?: boolean; // Dessiner le texte sur la vidéo (default: true)
stabilize?: boolean; // Stabilisation vidéo via vidstab (default: false)
watermark_url?: string; // URL du logo
store_name?: string; // Nom du magasin pour l'outro
}
interface FFmpegReelResponse {
@@ -75,6 +76,7 @@ export class FFmpegService {
drawText?: boolean;
stabilize?: boolean;
watermarkUrl?: string;
storeName?: string;
} = {}
): Promise<{ success: boolean; videoBase64?: string; duration?: number; error?: string }> {
const config = this.ensureConfigured();
@@ -92,6 +94,7 @@ export class FFmpegService {
draw_text: options.drawText ?? true,
stabilize: options.stabilize ?? false,
watermark_url: options.watermarkUrl,
store_name: options.storeName,
};
// Remove undefined values
@@ -172,6 +175,7 @@ export class FFmpegService {
drawText?: boolean;
stabilize?: boolean;
watermarkUrl?: string;
storeName?: string;
} = {}
): Promise<{ success: boolean; videoBase64?: string; duration?: number; error?: string }> {
const config = this.ensureConfigured();
@@ -189,6 +193,7 @@ export class FFmpegService {
draw_text: options.drawText ?? true,
stabilize: options.stabilize ?? false,
watermark_url: options.watermarkUrl,
store_name: options.storeName,
};
// Remove undefined values