mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-20 05:28:05 +02:00
feat(recording): add ffmpeg logs writing and viewing in UI
This commit is contained in:
1 parent
abbac75926
commit
966311f560
3 files changed
+110
-2
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user