some more updates to apple music integration

This commit is contained in:
2023-11-20 21:28:04 +01:00
parent e3fbfdd9b7
commit 290edd56ce
5 changed files with 251 additions and 855 deletions

View File

@@ -74,6 +74,24 @@ const parseExistingData = ( dat, dir ) => {
} );
}
module.exports.analyzeFile = async ( filepath ) => {
let metadata = await musicMetadata.parseFile( filepath );
return {
'artist': metadata[ 'common' ][ 'artist' ],
'title': metadata[ 'common' ][ 'title' ],
'year': metadata[ 'common' ][ 'year' ],
'bpm': metadata[ 'common' ][ 'bpm' ],
'genre': metadata[ 'common' ][ 'genre' ],
'duration': Math.round( metadata[ 'format' ][ 'duration' ] ),
'isLossless': metadata[ 'format' ][ 'lossless' ],
'sampleRate': metadata[ 'format' ][ 'sampleRate' ],
'bitrate': metadata[ 'format' ][ 'bitrate' ],
'numberOfChannels': metadata[ 'format' ][ 'numberOfChannels' ],
'container': metadata[ 'format' ][ 'container' ],
'filename': filepath,
}
}
hasCompletedFetching = {};
let files = {};
const parseDir = ( dat, req, existingData ) => {