mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Improve debug messages for file operations
This commit is contained in:
@@ -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 = [
|
||||
`<?xml version="1.0" encoding="UTF-8"?>`,
|
||||
`<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"`,
|
||||
` xmlns="urn:mpeg:dash:schema:mpd:2011"`,
|
||||
@@ -42,6 +44,10 @@ function generateDash(info)
|
||||
` </Period>`,
|
||||
`</MPD>`
|
||||
].join('\n');
|
||||
|
||||
debug('dash generated');
|
||||
|
||||
return dash;
|
||||
}
|
||||
|
||||
function saveDashPromise(dash)
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user