From bd2fbe60db7fc7377ff749a2bc79c99a176aad77 Mon Sep 17 00:00:00 2001 From: Borewit Date: Sun, 11 Mar 2018 17:13:56 +0100 Subject: [PATCH] Pass file length parameter to music-metadata parser. In some cases this is required to calculate the duration. --- src/renderer/webtorrent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/webtorrent.js b/src/renderer/webtorrent.js index 0a01ecd5..44b67377 100644 --- a/src/renderer/webtorrent.js +++ b/src/renderer/webtorrent.js @@ -340,7 +340,7 @@ function getAudioMetadata (infoHash, index) { const torrent = client.get(infoHash) const file = torrent.files[index] - const options = {native: false, skipCovers: true} + const options = {native: false, skipCovers: true, fileSize: file.length} const onMetaData = file.done // If completed; use direct file access ? mm.parseFile(path.join(torrent.path, file.path), options) @@ -349,7 +349,7 @@ function getAudioMetadata (infoHash, index) { onMetaData .then(function (metadata) { - console.log('got audio metadata for %s: %o', file.name, metadata) + console.log('got audio metadata for %s (length=%s): %o', file.name, file.length, metadata) ipc.send('wt-audio-metadata', infoHash, index, metadata) }).catch(function (err) { return console.log('error getting audio metadata for ' + infoHash + ':' + index, err)