[audio] manage audio download
This commit is contained in:
parent
118f5e661b
commit
c4e2255eaf
|
|
@ -64,3 +64,9 @@ const convertedFormats = [
|
|||
Format.tGP,
|
||||
Format.flv,
|
||||
];
|
||||
|
||||
const audioFormats = [
|
||||
Format.m4a,
|
||||
Format.mp3,
|
||||
Format.mp3HD,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -151,15 +151,16 @@ class DLServices {
|
|||
Format.values.firstWhere((e) => e.format == video.format.format).ytCmd;
|
||||
FileLogger().d('Format code: $formatCmd');
|
||||
|
||||
File doneFile = File('temp/${video.filename}_tmp.mp4');
|
||||
File doneFile = File('${tempDir.path}/${video.filename}_tmp.mp4');
|
||||
if (doneFile.existsSync()) {
|
||||
FileLogger().d('File already downloaded');
|
||||
return Stream.fromIterable(['[EmbedThumbnail]']);
|
||||
}
|
||||
|
||||
var strType = convertedFormats.contains(video.format) ? 'tmp' : 'done';
|
||||
var isAudio = audioFormats.contains(video.format);
|
||||
var command =
|
||||
'${video.url.trim()} --sub-langs "all,-live_chat" --embed-subs --embed-thumbnail --embed-metadata --progress -o "${tempDir.path}/${video.filename}_$strType.%(ext)s" -f "$formatCmd"';
|
||||
'${video.url.trim()}${isAudio ? '' : '--sub-langs "all,-live_chat" --embed-subs --embed-thumbnail --embed-metadata'} --progress -o "${tempDir.path}/${video.filename}_$strType.%(ext)s" -f "$formatCmd"';
|
||||
|
||||
var shellLinesController = ShellLinesController();
|
||||
var shellErrorController = ShellLinesController();
|
||||
|
|
@ -184,7 +185,6 @@ class DLServices {
|
|||
FileLogger().e('ShellException error: ${error.result?.stderr}');
|
||||
FileLogger().e('ShellException out: ${error.result?.stdout}');
|
||||
} else {
|
||||
FileLogger().d('Error: $error');
|
||||
FileLogger().e('Error: $error');
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue