mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
opt download task
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -358,6 +358,10 @@ class DownloadService extends GetxService {
|
|||||||
|
|
||||||
Future<void> _startDownload(BiliDownloadEntryInfo entry) async {
|
Future<void> _startDownload(BiliDownloadEntryInfo entry) async {
|
||||||
try {
|
try {
|
||||||
|
if (!await downloadDanmaku(entry: entry)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_updateCurStatus(DownloadStatus.getPlayUrl);
|
_updateCurStatus(DownloadStatus.getPlayUrl);
|
||||||
|
|
||||||
final BiliDownloadMediaInfo mediaFileInfo =
|
final BiliDownloadMediaInfo mediaFileInfo =
|
||||||
@@ -373,15 +377,10 @@ class DownloadService extends GetxService {
|
|||||||
await videoDir.create(recursive: true);
|
await videoDir.create(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final coverTask = _downloadCover(entry: entry);
|
|
||||||
|
|
||||||
if (!await downloadDanmaku(entry: entry)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final mediaJsonFile = File(path.join(videoDir.path, _indexFile));
|
final mediaJsonFile = File(path.join(videoDir.path, _indexFile));
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
mediaJsonFile.writeAsString(jsonEncode(mediaFileInfo.toJson())),
|
mediaJsonFile.writeAsString(jsonEncode(mediaFileInfo.toJson())),
|
||||||
coverTask,
|
_downloadCover(entry: entry),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (curDownload.value?.cid != entry.cid) {
|
if (curDownload.value?.cid != entry.cid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user