This commit is contained in:
Feross Aboukhadijeh
2019-08-13 20:32:42 -07:00
parent 6336bbd6e3
commit c61234dd4c
2 changed files with 6 additions and 3 deletions

View File

@@ -18,7 +18,8 @@ function torrentPoster (torrent, cb) {
const bestScore = ['audio', 'video', 'image'].map(mediaType => { const bestScore = ['audio', 'video', 'image'].map(mediaType => {
return { return {
type: mediaType, type: mediaType,
size: calculateDataLengthByExtension(torrent, mediaExtensions[mediaType]) } size: calculateDataLengthByExtension(torrent, mediaExtensions[mediaType])
}
}).sort((a, b) => { // sort descending on size }).sort((a, b) => { // sort descending on size
return b.size - a.size return b.size - a.size
})[0] })[0]

View File

@@ -345,12 +345,14 @@ function getAudioMetadata (infoHash, index) {
const metadata = { title: file.name } const metadata = { title: file.name }
ipc.send('wt-audio-metadata', infoHash, index, metadata) ipc.send('wt-audio-metadata', infoHash, index, metadata)
const options = { native: false, const options = {
native: false,
skipCovers: true, skipCovers: true,
fileSize: file.length, fileSize: file.length,
observer: event => { observer: event => {
ipc.send('wt-audio-metadata', infoHash, index, event.metadata) ipc.send('wt-audio-metadata', infoHash, index, event.metadata)
} } }
}
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)