Skip to content

Commit

Permalink
Merge pull request #1772 from webtorrent/greenkeeper/music-metadata-6…
Browse files Browse the repository at this point in the history
….1.0

Update music metadata 6.1.0
  • Loading branch information
Borewit committed Jan 8, 2020
2 parents e341367 + 38aef81 commit 6f2aa86
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 30 deletions.
87 changes: 63 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"location-history": "^1.1.1",
"material-ui": "^0.20.2",
"mkdirp": "^0.5.1",
"music-metadata": "4.9.2",
"music-metadata": "6.1.0",
"network-address": "^1.1.2",
"parse-torrent": "^7.0.1",
"prettier-bytes": "^1.0.4",
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/lib/media-extensions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const mediaExtensions = {
audio: [
'.aac', '.aif', '.aiff', '.asf', '.dff', '.dsf', '.flac', '.m2a',
'.m4a', '.m4b', '.mp2', '.mp3', '.mpc', '.oga', '.ogg', '.opus',
'.spx', '.wma', '.wav', '.wv', '.wvp'],
'.m2a', '.m4a', '.mpc', '.m4b', '.mka', '.mp2', '.mp3', '.mpc', '.oga',
'.ogg', '.opus', '.spx', '.wma', '.wav', '.wv', '.wvp'],
video: [
'.avi', '.mp4', '.m4v', '.webm', '.mov', '.mkv', '.mpg', '.mpeg',
'.ogv', '.webm', '.wmv'],
Expand Down
9 changes: 6 additions & 3 deletions src/renderer/webtorrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,18 @@ function getAudioMetadata (infoHash, index) {
ipc.send('wt-audio-metadata', infoHash, index, event.metadata)
}
}
const onMetaData = file.done
const onMetadata = file.done
// If completed; use direct file access
? mm.parseFile(path.join(torrent.path, file.path), options)
// otherwise stream
: mm.parseStream(file.createReadStream(), file.name, options)

onMetaData
onMetadata
.then(
() => console.log(`metadata for file='${file.name}' completed.`),
metadata => {
ipc.send('wt-audio-metadata', infoHash, index, metadata)
console.log(`metadata for file='${file.name}' completed.`)
},
err => {
console.log(
`error getting audio metadata for ${infoHash}:${index}`,
Expand Down

0 comments on commit 6f2aa86

Please sign in to comment.