mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-23 19:32:15 +00:00
fix: qmcv2 db name matching when musicex
was not found
This commit is contained in:
parent
2d50a45ef2
commit
5d7f5b76ef
@ -10,6 +10,7 @@ export const workerParseMusicExMediaName = async ({ id, blobURI }: FetchMusicExN
|
|||||||
const blob = await timedLogger(`${label}/fetch-src`, async () =>
|
const blob = await timedLogger(`${label}/fetch-src`, async () =>
|
||||||
fetch(blobURI, { headers: { Range: 'bytes=-1024' } }).then((r) => r.blob()),
|
fetch(blobURI, { headers: { Range: 'bytes=-1024' } }).then((r) => r.blob()),
|
||||||
);
|
);
|
||||||
|
|
||||||
const buffer = await timedLogger(`${label}/read-src`, async () => {
|
const buffer = await timedLogger(`${label}/read-src`, async () => {
|
||||||
// Firefox: the range header does not work...?
|
// Firefox: the range header does not work...?
|
||||||
const blobBuffer = await blob.arrayBuffer();
|
const blobBuffer = await blob.arrayBuffer();
|
||||||
@ -18,10 +19,12 @@ export const workerParseMusicExMediaName = async ({ id, blobURI }: FetchMusicExN
|
|||||||
}
|
}
|
||||||
return blobBuffer;
|
return blobBuffer;
|
||||||
});
|
});
|
||||||
|
|
||||||
const parsed = makeQMCv2FooterParser(parakeet).parse(buffer);
|
const parsed = makeQMCv2FooterParser(parakeet).parse(buffer);
|
||||||
if (parsed.state === FooterParserState.OK) {
|
if (parsed.state === FooterParserState.OK) {
|
||||||
return parsed.mediaName;
|
return parsed.mediaName;
|
||||||
}
|
}
|
||||||
return '# N/A';
|
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user