/** Stage a playlist FILE. The name travels beside the path rather than * being read off it: the picked document's own name is what chooses the * parser and titles the draft, and a document the phone had no path for * arrives as a cache copy. Rows naming a file by a relative path resolve * against the file's own folder; a copied file's rows fall back to the * library's basename index, so they still find what this phone holds. A * playlist file does produce stream rows, so the catalog pass runs. */ export async function startFile(path, name) { const g = ++gen; Object.assign(importer, { door: "file", source: path, busy: true, error: "", progress: null, draft: null, name: "", includeUnresolved: true, checks: {}, committing: false, links: false }); try { const draft = await api.playlistImportProbe(path, name); if (g !== gen) return; importer.busy = false; if (!draft) { importer.error = "Nothing came back from that file."; return; } importer.draft = draft; importer.name = draft.name ?? ""; if (draft.entries?.length) queueMicrotask(() => void verifyStreams(g)); } catch (e) { if (g === gen) { importer.error = String(e); importer.busy = false; } } }