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