Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Last-Order committed Oct 1, 2021
1 parent b8df3b6 commit 74f63a1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "minyami",
"version": "4.4.2",
"version": "4.4.3",
"description": "",
"main": "dist/exports.js",
"types": "dist/exports.d.ts",
Expand Down
15 changes: 8 additions & 7 deletions src/core/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,14 @@ class Downloader extends EventEmitter {

if (output) {
this.outputPath = output;
if (fs.existsSync(this.outputPath)) {
// output filename conflict
const pathArr = this.outputPath.split(".");
const filePath = pathArr.slice(0, -1).join(".");
const ext = pathArr[pathArr.length - 1];
this.outputPath = `${filePath}_${Date.now()}.${ext}`;
}
}

if (fs.existsSync(this.outputPath)) {
// output filename conflict
const pathArr = this.outputPath.split(".");
const filePath = pathArr.slice(0, -1).join(".");
const ext = pathArr[pathArr.length - 1];
this.outputPath = `${filePath}_${Date.now()}.${ext}`;
}

if (key) {
Expand Down
4 changes: 3 additions & 1 deletion src/core/m3u8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ export class Playlist {
}
this.chunks.push({
url: CommonUtils.buildFullUrl(this.m3u8Url, initialSegmentUrl),
isEncrypted: false,
isEncrypted: true,
length: 0,
sequenceId: 0,
key,
iv,
});
}
if (currentLine.startsWith("#EXT-X-ENDLIST")) {
Expand Down

0 comments on commit 74f63a1

Please sign in to comment.