[error} add downloader error

This commit is contained in:
jscampucci 2024-07-10 11:56:58 +02:00
parent 8ec63b7657
commit 5623ef5a94
1 changed files with 26 additions and 2 deletions

View File

@ -120,10 +120,34 @@ class DLServices {
'${video.url.trim()} --sub-langs "all,-live_chat" --embed-subs --embed-thumbnail --embed-metadata --progress -o "temp/${video.filename}_$strType.%(ext)s" -f "$formatCmd"';
var shellLinesController = ShellLinesController();
var shell = Shell(stdout: shellLinesController.sink, verbose: false);
var shellErrorController = ShellLinesController();
var shell = Shell(
stdout: shellLinesController.sink,
stderr: shellErrorController.sink,
verbose: false);
debugPrint('Running $ytDlpPath $command');
shell.run('$ytDlpPath $command');
await shell.run('$ytDlpPath $command').then((result) {
result.map((e) {
debugPrint('Analyse result: $e');
FileLogger().d('Analyse result: ${e.toString()}');
FileLogger().d('stdout: ${e.stdout}');
FileLogger().d('stderr: ${e.stderr}');
});
}).catchError((
error,
stackTrace,
) {
if (error is ShellException) {
debugPrint('ShellException: ${error.message}');
FileLogger().e('ShellException error: ${error.result?.stderr}');
FileLogger().e('ShellException out: ${error.result?.stdout}');
} else {
debugPrint('Error: $error');
FileLogger().e('Error: $error');
}
});
return shellLinesController.stream;
}