leetreveil / musicmetadata

Streaming music metadata parser for node and the browser.
561 stars 66 forks source link

Completion callback invoked twice #144

Open mycoboco opened 7 years ago

mycoboco commented 7 years ago

The issue #122 I reported before seemed to be fixed by fdb1b5d7d9802143d26fc92a3292fba3cdbc961f, but that fix introduced another issue.

The latest release invokes the completion callback twice for this file.

var fs = require('fs')
var mm = require('musicmetadata')

mm(fs.createReadStream('./twice.mp3'), { duration: true }, function (err, data) { console.log(err, data) })

results in

undefined { title: '내가 꿈꾸는 그곳 (Place Of My Dreams)',
  artist: [ '배송희' ],
  albumartist: [],
  album: 'We Are Walking In Faith',
  year: '2001',
  track: { no: 5, of: 0 },
  genre: [ 'Contemporary Christian' ],
  disk: { no: 1, of: 1 },
  picture: [],
  duration: 0 }
undefined { title: '내가 꿈꾸는 그곳 (Place Of My Dreams)',
  artist: [ '배송희' ],
  albumartist: [],
  album: 'We Are Walking In Faith',
  year: '2001',
  track: { no: 5, of: 0 },
  genre: [ 'Contemporary Christian' ],
  disk: { no: 1, of: 1 },
  picture: [],
  duration: 240 }

Reverting fdb1b5d7d9802143d26fc92a3292fba3cdbc961f is not a solution, because it would resuscitate #122.

leetreveil commented 7 years ago

Confirmed.