feat(recording): add ffmpeg logs writing and viewing in UI

This commit is contained in:
Michael committed 2026-03-08 19:26:54 +01:00
1 parent abbac75926
commit 966311f560
3 files changed
+110 -2

No files matched your search

+27
View File
@@ -1,3 +1,4 @@
import 'dart:io';
import 'dart:convert';
import 'package:shelf/shelf.dart';
import 'package:shelf_router/shelf_router.dart';
@@ -85,6 +86,32 @@ class RecordingsApi {
);
});
// Consulter les logs d'un enregistrement
router.get('/<id>/log', (Request request, String id) async {
final recording = _db.getRecordingById(id);
if (recording == null) {
return Response.notFound(json.encode({'error': 'Enregistrement non trouvé'}));
}
if (recording.filePath == null) {
return Response.notFound(json.encode({'error': 'Aucun fichier ni log associé pour le moment.'}));
}
final logFilePath = recording.filePath!.replaceAll('.mp4', '.log');
final logFile = File(logFilePath);
if (!await logFile.exists()) {
return Response.notFound(json.encode({'error': 'Le fichier de log est introuvable.'}));
}
final logs = await logFile.readAsString();
return Response.ok(
json.encode({'logs': logs}),
headers: {'Content-Type': 'application/json'},
);
});
return router;
}
}