if (cmd === "playlist_import_probe") { const path = String(args?.path || ""); if (!path) return Promise.resolve(null); /* the desktop's dialog, dismissed */ /* the NAME decides the format, the way playlist_formats::detect_format does — the extension first, the stem as the draft's title. The path is only where the bytes were. */ const name = String(args?.name || path.split(/[\\/]/).filter(Boolean).pop() || "Playlist"); const ext = (name.split(".").pop() || "").toLowerCase(); const format = ext === "m3u" || ext === "m3u8" ? "m3u" : ext === "pls" ? "pls" : ext === "xspf" ? "xspf" : ext === "csv" ? "csv" : ext === "json" ? "soulstream" : "text"; /* the paste door's own three lines, so the verdicts are already proven: one in the library, one stream, one unresolved */ const entries = impParse("Daft Punk - One More Time\nAphex Twin - Track 1\nID - ID"); return new Promise((r) => setTimeout(() => r(impDraft(entries, name, format, name.replace(/\.[^.]*$/, ""))), 500)); }