diff --git a/main/index.js b/main/index.js index 871f1a6..74e996c 100644 --- a/main/index.js +++ b/main/index.js @@ -106,7 +106,7 @@ app.on('ready', () => { state.currentIndex = newIndex queue(null, newIndex) if (state.playing) { broadcast('play') } - } else { console.warn('Can go back, empty trackOrder array') } + } else { console.warn('Can\'t go back, empty trackOrder array') } } ipcMain.on('prev', prev) @@ -117,7 +117,7 @@ app.on('ready', () => { state.currentIndex = newIndex queue(null, newIndex) if (state.playing) { broadcast('play') } - } else { console.warn('Can go forward, empty trackOrder array') } + } else { console.warn('Can\'t go forward, empty trackOrder array') } } ipcMain.on('next', next) diff --git a/main/library.js b/main/library.js index 8787879..fa70a2d 100644 --- a/main/library.js +++ b/main/library.js @@ -31,6 +31,7 @@ function isValidFile (data, enc, cb) { function concatTrackDict (obj) { function writeTrackDict (data, enc, cb) { + console.log(`Scanning ${data.filepath}`) parseMetadata(data, handleMeta) function handleMeta (err, meta) { @@ -46,14 +47,19 @@ function parseMetadata (data, cb) { var { filepath } = data var readableStream = fs.createReadStream(filepath) mm(readableStream, { duration: true }, (err, meta) => { - readableStream.close() + readableStream.destroy() if (err) { switch (err.message) { case 'Could not find metadata header': console.warn(err.message += ` (file: ${filepath})`) break + case 'expected frame header but was not found': + console.warn(err.message += ` (file: ${filepath})`) + break default: - return cb(err) + // Ignore errors + console.warn(err.message += ` (file: ${filepath})`) + return cb(null) } }