android: a playlist file, picked
The storage plugin grew `pick_file` beside `pick_folder` and `pick_image`: the document sheet with the caller's own filter, answered with a path Rust can open. A document already on this phone hands its path over as it lies — the document sibling of the same volume:relative id the folder picker resolves, plus the Downloads provider's raw: — so a 300 MB pick copies nothing; one that has no path is copied into cacheDir/picked under its own name, and only as far as the caller allows, because a playlist is kilobytes and a DJ set is not. Those copies are swept at the start of every pick, which pick_image's never were. The import sheet has its fifth door, on round 24's screen, wait card and review, and the note that apologised for its absence says the one true thing about it instead. `playlist_import_probe` took a path and a name the way `playlist_import_folder` took a path, and the name is the load-bearing half: the parser picks its format off the extension and titles the draft from the stem, so a cache copy under an invented name would have read every playlist as plain text. The mock walk drives the door and both of the picker's refusals through round 31's fail door; the phone walk opens the real sheet and dismisses it with BACK, reading nothing and writing nothing. The brief asked for a second consumer — sending a file in a chat — and there is nothing behind it: `community_pick_file` is the persona layer's three native dialogs, `soulseek-client` has `say_room` and `message_user` and nothing that sends a file, and both frontends' thread composers are text only. Nothing was invented for it. The plugin command is general enough — a caller's own filter, a zero-copy path, a bounded copy — that the one reader still waiting, the local set listener the phone puts off by design, needs no further plugin change. Playlist export is not on that list and never was: writing a document out is the share plugin's errand, not a picker's. The Kotlin is unbuilt — nothing on this machine compiles it.
This commit is contained in:
1 parent
04c87e0db1
commit
defd8c5e6d
16 files changed
+559
-57
No files matched your search
@@ -328,6 +328,21 @@ function mockImport(cmd, args) {
|
||||
}, 600);
|
||||
});
|
||||
}
|
||||
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));
|
||||
}
|
||||
if (cmd === "playlist_import_folder") {
|
||||
const root = String(args?.path || "");
|
||||
if (!root) return Promise.resolve(null); /* the desktop's dialog, dismissed */
|
||||
@@ -784,6 +799,13 @@ function mockCatalog(cmd, args) {
|
||||
if (cmd === "plugin:storage|all_files_access") return Promise.resolve({ granted: !fresh });
|
||||
if (cmd === "plugin:storage|request_all_files_access") return Promise.resolve();
|
||||
if (cmd === "plugin:storage|pick_image") return Promise.resolve({ path: "C:\\mock\\photo.jpg" });
|
||||
/* a document that HAD to be copied, with the two names apart: the cache
|
||||
file is safeName()'s — every character outside the plugin's allowed
|
||||
set replaced, so the "#" is an underscore there — and the document's
|
||||
own is what the draft must be read and titled by. Same on purpose:
|
||||
if the name stopped travelling, the path's basename would still say
|
||||
m3u8 and only the title would quietly go wrong, which is the bug. */
|
||||
if (cmd === "plugin:storage|pick_file") return Promise.resolve({ path: "C:\\mock\\picked\\Warehouse set _3.m3u8", name: "Warehouse set #3.m3u8", size: 2048, copied: true });
|
||||
/* the downloads notice: the mock walk cannot see the shade, so the calls
|
||||
are simply answered — what the walk reads is __ss.xfn, the app's own
|
||||
record of having posted and cleared */
|
||||
|
||||
Reference in new issue
Block a user