1import { ostiary, rpc } from "@common/worker.js";
2import { musicMetadataTags } from "./common.js";
3
4/**
5 * @import { Actions, Extraction } from "./types.d.ts";
6 */
7
8////////////////////////////////////////////
9// ACTIONS
10////////////////////////////////////////////
11
12/**
13 * @type {Actions['supply']}
14 */
15export async function supply(args) {
16 // Construct records
17 // TODO: Use other metadata lib as fallback: https://github.com/buzz/mediainfo.js
18 return await musicMetadataTags(args).catch(
19 /**
20 * @param {Error} err
21 * @returns {Extraction}
22 */
23 (err) => {
24 console.warn("Metadata processor error:", err, args);
25 return {};
26 },
27 );
28}
29
30////////////////////////////////////////////
31// ⚡️
32////////////////////////////////////////////
33
34ostiary((context) => {
35 rpc(context, {
36 supply,
37 });
38});