fix paths

This commit is contained in:
Tusko 2020-03-26 18:51:33 +02:00
commit be851ef9bc
2 changed files with 7 additions and 6 deletions

View file

@ -1,7 +1,7 @@
const list = [ const list = [
{ {
name: '1. Introduction', name: '1. Introduction "Double Quotes" \'SingleQuotes\' \\ can I use it?',
url: 'https://60vod-adaptive.akamaized.net/exp=1584616359~acl=%2F290272859%2F%2A~hmac=d8b0da041d43093909c4f58cf017b6ce204f085f18435b1c1ed60b6ca3708dbc/290272859/sep/video/1099558424,1099558420,1099557256,1099557251/master.json?base64_init=1' url: 'https://60vod-adaptive.akamaized.net/exp=1585247356~acl=%2F290272859%2F%2A~hmac=9e480e2a6d726afd2f54bdacd7c959c00fb8d1fb1d6225aaf73b1205bef6eb5b/290272859/sep/video/1099558424,1099558420,1099557256,1099557251/master.json?base64_init=1'
}, },
// { // {
// name: '2.1. Интро', // name: '2.1. Интро',

View file

@ -75,7 +75,8 @@ function loadVideo(num) {
} }
function processFile(type, baseUrl, initData, segments, filename, cb) { function processFile(type, baseUrl, initData, segments, filename, cb) {
if (fs.existsSync('./parts/' + filename)) { const filePath = `./parts/${filename}`;
if (fs.existsSync(filePath)) {
log("⚠️", ` ${filename} - ${type} already exists`); log("⚠️", ` ${filename} - ${type} already exists`);
cb(); cb();
} }
@ -83,13 +84,13 @@ function processFile(type, baseUrl, initData, segments, filename, cb) {
const segmentsUrl = segments.map(seg => baseUrl + seg.url); const segmentsUrl = segments.map(seg => baseUrl + seg.url);
const initBuffer = Buffer.from(initData, "base64"); const initBuffer = Buffer.from(initData, "base64");
fs.writeFileSync(filename, initBuffer); fs.writeFileSync(filePath, initBuffer);
const output = fs.createWriteStream(filename, { const output = fs.createWriteStream(filePath, {
flags: "a" flags: "a"
}); });
combineSegments(type, 0, segmentsUrl, output, filename, err => { combineSegments(type, 0, segmentsUrl, output, filePath, err => {
if (err) { if (err) {
log("⚠️", ` ${err}`); log("⚠️", ` ${err}`);
} }