Migrate music-metadata-browser to music-metadata - #89
Conversation
88a7ff5 to
7899d16
Compare
|
@Borewit So I went to have a look at my previous migration attempt and remembered why I didn't go through with it.. If I understand it correctly, I don't know if it would be possible to have like a polyfill to provide compatibility, or if there is any alternative for
|
d893428 to
8363512
Compare
|
I think I have now handled the fallback for Safari. Yet I have no Safari to test with. |
cc29bbe to
4a14286
Compare
|
I think actually the default (non byte) web stream also works: Borewit/peek-readable#786 Note that module has been merged (with the fix) with https://github.com/Borewit/strtok3 Let me know if you see any remaining issue on your old media box @hvianna . |
6c7b159 to
6e763b0
Compare
hvianna
left a comment
There was a problem hiding this comment.
Made some more observations. I hope to have time to test this more throughly over the weekend.
6da3266 to
1c62fca
Compare
aba71c0 to
2326952
Compare
dc4799c to
293c30e
Compare
I like to load a portion of my library (I have more then 1 TB) into the queue, but how do I move /drag multiple folders into the playlist queue? I have fairly large playlist as well, and I noticed some tracks did not resolved (dev branch). Not sure if this is caused by the obscure fetch implementation or of it has something to do with file encoding. |
Adding folders is not supported. You'll need to enter each folder and add all files (double arrow button). |
52a702e to
940a789
Compare
|
I did a test, using the server fastify implementation #101, using a script running in Node.js traversing my music library. import {parseWebStream} from 'music-metadata';
const rootFolder = 'http://localhost:8080/music';
let numberOfFilesScanned = 0;
function increaseCounter() {
++numberOfFilesScanned;
if (numberOfFilesScanned % 100 === 0) {
const delta = performance.now() - startTime;
const timePerFile = Math.round(100 * delta / numberOfFilesScanned) / 100;
console.log(`Scanned ${numberOfFilesScanned} audio files, in ${timePerFile} ms per file`);
}
}
async function scanFolder(folder) {
// console.log(`Scanning folder: ${folder}`);
const response = await fetch(`${folder}/`);
if (response.ok) {
const folderListing = await response.json();
for (const file of folderListing.files) {
if (isAudioFile(file.name)) {
const url = `${folder}/${encodeURIComponent(file.name)}`;
// console.log(`Fetching ${url}...`);
const response = await fetch(url);
if (response.ok && response.body) {
const mm = await parseWebStream(response.body);
// await response.body.cancel();
increaseCounter();
}
}
}
for (const subFolder of folderListing.dirs) {
await scanFolder(`${folder}/${encodeURIComponent(subFolder.name)}`); // Recursion
}
}
}
function isAudioFile(filename) {
const fileExt = filename.split('.').pop()?.toLowerCase();
return ['flac', 'mp3', 'wav', 'm4a', 'opus'].indexOf(fileExt) !== -1;
}
const startTime = performance.now();
scanFolder(rootFolder);Which outputs: These are all FLAC files. So it scans a FLAC file 50 ms, I think that performance is not to bad. |
ba9c579 to
dd71b92
Compare
Nailed the degradation in performance here: #103 |
dd71b92 to
80ce4ee
Compare
|
Restored mostly the original metadata load limitation mechanism, as I made things worse. |
b8799f8 to
5992b3e
Compare
5992b3e to
2e69c02
Compare



Changes:
music-metadata-browsertomusic-metadata.processbufferRelated:
async/await#91