- Refactor metadata handling to use fetchTagLib and addMetadataWithTagLib for improved loading and worker-based processing - Update prefetchMetadataObjects and addMetadataToAudio for simplified and more robust metadata extraction - Add taglib.worker.ts for audio metadata processing in a worker - Implement getMetadataWithTagLib function - Auto-fix linting issues and remove unnecessary debugger statements
26 lines
783 B
TypeScript
26 lines
783 B
TypeScript
import { InvisibleDictionary, baseCodecFrom } from './BaseCodec';
|
|
import { v7 } from 'uuid';
|
|
|
|
export const InvisibleCodec = baseCodecFrom(InvisibleDictionary);
|
|
|
|
export function doTimed<T>(message: string, callback: () => T): T {
|
|
const hiddenId = InvisibleCodec.encode(v7());
|
|
console.time(message + hiddenId);
|
|
try {
|
|
const output = callback();
|
|
return output;
|
|
} finally {
|
|
console.timeEnd(message + hiddenId);
|
|
}
|
|
}
|
|
|
|
export async function doTimedAsync<T>(message: string, callback: () => T): Promise<Awaited<T>> {
|
|
const hiddenId = InvisibleCodec.encode(v7());
|
|
console.time(message + hiddenId);
|
|
try {
|
|
const output = await callback();
|
|
return output;
|
|
} finally {
|
|
console.timeEnd(message + hiddenId);
|
|
}
|
|
}
|