Experiment to rebuild Diffuse using web applets.
1import type { Extraction, Urls } from "./types.d.ts";
2import { expose, transfer } from "@scripts/common";
3import { musicMetadataTags } from "./common.ts";
4
5////////////////////////////////////////////
6// ACTIONS
7////////////////////////////////////////////
8const actions = expose({
9 supply,
10});
11
12export type Actions = typeof actions;
13
14// Actions
15
16async function supply(args: {
17 includeArtwork?: boolean;
18 mimeType?: string;
19 stream?: ReadableStream;
20 urls?: Urls;
21}): Promise<Extraction> {
22 // Construct records
23 // TODO: Use other metadata lib as fallback: https://github.com/buzz/mediainfo.js
24 const response = await musicMetadataTags(args).catch((err): Extraction => {
25 console.warn("Metadata processor error:", err);
26 console.log(args);
27
28 return {};
29 });
30
31 // Fin
32 return transfer(response);
33}