style: auto-fix linting issues

This commit is contained in:
SamidyFR 2026-03-06 21:01:28 +00:00 committed by github-actions[bot]
parent cddf318d19
commit 60d61f74d2

View file

@ -183,7 +183,7 @@ async function readFlacMetadata(file, metadata) {
const tsLow = dataView.getUint32(offset + 14, false); const tsLow = dataView.getUint32(offset + 14, false);
// same thing for total samples // same thing for total samples
const totalSamples = (tsHigh * 0x100000000) + tsLow; const totalSamples = tsHigh * 0x100000000 + tsLow;
if (sampleRate > 0) { if (sampleRate > 0) {
// beatiful // beatiful
@ -234,7 +234,6 @@ async function readM4aMetadata(file, metadata) {
const moovData = new DataView(view.buffer, moovStart, moovLen); const moovData = new DataView(view.buffer, moovStart, moovLen);
const moovAtoms = parseMp4Atoms(moovData); const moovAtoms = parseMp4Atoms(moovData);
// mvhd metadata tag // mvhd metadata tag
const mvhd = moovAtoms.find((a) => a.type === 'mvhd'); const mvhd = moovAtoms.find((a) => a.type === 'mvhd');
if (mvhd) { if (mvhd) {
@ -253,7 +252,7 @@ async function readM4aMetadata(file, metadata) {
timeScale = view.getUint32(mvhdStart + 20, false); timeScale = view.getUint32(mvhdStart + 20, false);
const durHigh = view.getUint32(mvhdStart + 24, false); const durHigh = view.getUint32(mvhdStart + 24, false);
const durLow = view.getUint32(mvhdStart + 28, false); const durLow = view.getUint32(mvhdStart + 28, false);
duration = (durHigh * 0x100000000) + durLow; duration = durHigh * 0x100000000 + durLow;
} }
if (timeScale > 0) { if (timeScale > 0) {
@ -264,7 +263,6 @@ async function readM4aMetadata(file, metadata) {
const udta = moovAtoms.find((a) => a.type === 'udta'); const udta = moovAtoms.find((a) => a.type === 'udta');
if (!udta) return; if (!udta) return;
const udtaStart = moovStart + udta.offset + 8; const udtaStart = moovStart + udta.offset + 8;
const udtaLen = udta.size - 8; const udtaLen = udta.size - 8;
const udtaData = new DataView(view.buffer, udtaStart, udtaLen); const udtaData = new DataView(view.buffer, udtaStart, udtaLen);
@ -454,7 +452,6 @@ async function readMp3Metadata(file, metadata) {
// since mp3 file don't have metadata about duration, estimating it // since mp3 file don't have metadata about duration, estimating it
// uses evil bitwise magic // uses evil bitwise magic
async function calculateMp3Duration(file, startOffset) { async function calculateMp3Duration(file, startOffset) {
const buffer = await file.slice(startOffset, startOffset + 32768).arrayBuffer(); const buffer = await file.slice(startOffset, startOffset + 32768).arrayBuffer();
const view = new DataView(buffer); const view = new DataView(buffer);
const uint8 = new Uint8Array(buffer); const uint8 = new Uint8Array(buffer);
@ -486,12 +483,11 @@ async function calculateMp3Duration(file, startOffset) {
// this xing header is present in many mp3 files and contains total frame count, which allows for accurate duration calculation // this xing header is present in many mp3 files and contains total frame count, which allows for accurate duration calculation
const channelMode = (header >> 6) & 3; // mono or stereo const channelMode = (header >> 6) & 3; // mono or stereo
const xingOffset = offset + 4 + (mpegVer === 3 ? (channelMode === 3 ? 17 : 32) : (channelMode === 3 ? 9 : 17)); // the position of xing header const xingOffset = offset + 4 + (mpegVer === 3 ? (channelMode === 3 ? 17 : 32) : channelMode === 3 ? 9 : 17); // the position of xing header
if (xingOffset + 8 <= view.byteLength) { if (xingOffset + 8 <= view.byteLength) {
const sig = view.getUint32(xingOffset, false); const sig = view.getUint32(xingOffset, false);
if ((sig === 0x58696e67 || sig === 0x496e666f) && (view.getUint32(xingOffset + 4, false) & 1)) { if ((sig === 0x58696e67 || sig === 0x496e666f) && view.getUint32(xingOffset + 4, false) & 1) {
const frames = view.getUint32(xingOffset + 8, false); const frames = view.getUint32(xingOffset + 8, false);
// basically, duration = frames * samples per frame / sample rate // basically, duration = frames * samples per frame / sample rate
return (frames * (mpegVer === 3 ? 1152 : 576)) / sampleRate; return (frames * (mpegVer === 3 ? 1152 : 576)) / sampleRate;