Pass file length parameter to music-metadata parser.
In some cases this is required to calculate the duration.
This commit is contained in:
@@ -340,7 +340,7 @@ function getAudioMetadata (infoHash, index) {
|
|||||||
const torrent = client.get(infoHash)
|
const torrent = client.get(infoHash)
|
||||||
const file = torrent.files[index]
|
const file = torrent.files[index]
|
||||||
|
|
||||||
const options = {native: false, skipCovers: true}
|
const options = {native: false, skipCovers: true, fileSize: file.length}
|
||||||
const onMetaData = file.done
|
const onMetaData = file.done
|
||||||
// If completed; use direct file access
|
// If completed; use direct file access
|
||||||
? mm.parseFile(path.join(torrent.path, file.path), options)
|
? mm.parseFile(path.join(torrent.path, file.path), options)
|
||||||
@@ -349,7 +349,7 @@ function getAudioMetadata (infoHash, index) {
|
|||||||
|
|
||||||
onMetaData
|
onMetaData
|
||||||
.then(function (metadata) {
|
.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)
|
ipc.send('wt-audio-metadata', infoHash, index, metadata)
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
return console.log('error getting audio metadata for ' + infoHash + ':' + index, err)
|
return console.log('error getting audio metadata for ' + infoHash + ':' + index, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user