diff --git a/src/dash.js b/src/dash.js index 10a4f2c1..84a9a4ef 100644 --- a/src/dash.js +++ b/src/dash.js @@ -14,6 +14,8 @@ function generateDash(info) ) return null; + debug('generating dash'); + /* TODO: Options in prefs to set preferred video formats for adaptive streaming */ const videoStream = info.streamingData.adaptiveFormats.find(stream => { return (stream.mimeType.startsWith('video/mp4') && stream.quality === 'hd1080'); @@ -27,7 +29,7 @@ function generateDash(info) const bufferSec = Math.min(4, info.videoDetails.lengthSeconds); - return [ + const dash = [ ``, ``, `` ].join('\n'); + + debug('dash generated'); + + return dash; } function saveDashPromise(dash) diff --git a/src/youtube.js b/src/youtube.js index a9069a25..2babcb4f 100644 --- a/src/youtube.js +++ b/src/youtube.js @@ -284,6 +284,8 @@ var YouTubeClient = GObject.registerClass({ this.emit('info-resolved', true); this.downloadingVideoId = null; + debug('video info is ready to use'); + return resolve(info); } @@ -643,11 +645,14 @@ var YouTubeClient = GObject.registerClass({ async _createSubdirFileAsync(place, folderName, fileName, data) { - const destDir = Gio.File.new_for_path([ + const destPath = [ GLib[`get_${place}_dir`](), Misc.appId, folderName - ].join('/')); + ].join('/'); + + const destDir = Gio.File.new_for_path(destPath); + debug(`saving file: ${destPath}`); for(let dir of [destDir.get_parent(), destDir]) { const createdDir = await FileOps.createDirPromise(dir).catch(debug); @@ -662,21 +667,22 @@ var YouTubeClient = GObject.registerClass({ Gio.FileCreateFlags.NONE, null ) - .then(() => debug(`saved file: ${destFile.get_path()}`)) + .then(() => debug(`saved file: ${destPath}`)) .catch(debug); } _getFileContentsPromise(place, folderName, fileName) { return new Promise((resolve, reject) => { - debug(`reading data from ${place} file`); - - const file = Gio.File.new_for_path([ + const destPath = [ GLib[`get_${place}_dir`](), Misc.appId, folderName, fileName - ].join('/')); + ].join('/'); + + const file = Gio.File.new_for_path(destPath); + debug(`reading data from: ${destPath}`); if(!file.query_exists(null)) { debug(`no such file: ${file.get_path()}`); @@ -689,6 +695,8 @@ var YouTubeClient = GObject.registerClass({ if(!data || !data.length) return reject(new Error('source file is empty')); + debug(`read data from: ${destPath}`); + if(data instanceof Uint8Array) resolve(ByteArray.toString(data)); else