Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Last-Order committed Jun 10, 2019
1 parent 21ce8a3 commit 9a61500
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ArchiveDownloader extends Downloader {
prefix: string;

isResumed: boolean = false; // 是否为恢复模式
isDownloaded: boolean = false;

/**
*
Expand Down Expand Up @@ -354,10 +355,15 @@ class ArchiveDownloader extends Downloader {
});
this.checkQueue();
}
if (this.chunks.length === 0 && this.runningThreads === 0) {
if (this.chunks.length === 0 && this.totalChunksCount === this.finishedChunksCount && this.runningThreads === 0) {
if (this.isDownloaded) {
return;
}
this.isDownloaded = true;
this.Log.info('All chunks downloaded. Start merging chunks.');
const muxer = this.format === 'ts' ? mergeToTS : mergeToMKV;
// Save before merge
this.emit('downloaded');
this.saveTask();
muxer(this.outputFileList, this.outputPath).then(async () => {
this.Log.info('End of merging.');
Expand Down

0 comments on commit 9a61500

Please sign in to comment.