···100100 "kind": "prelude",
101101 "category": "Data",
102102 "featured": true,
103103- "desc": "Process all your audio inputs automatically when opening any interface. Happens once every 10 minutes."
103103+ "desc": "Process all your audio inputs automatically into tracks when opening any interface. Only happens once every 10 minutes, if the processing was completed."
104104 },
105105 {
106106 "url": "facets/misc/scrobble/index.html",
+8-13
src/facets/data/process-tracks/index.inline.js
···11import foundation from "~/common/foundation.js";
2233const KEY = "facets/data/process-tracks/timestamp";
44+const MAX_TIME_DIFF = 10 * 60 * 1000;
55+46const lastTimestamp = localStorage.getItem(KEY);
57const now = Date.now();
88+const diff = lastTimestamp ? now - JSON.parse(lastTimestamp) : MAX_TIME_DIFF;
6977-if (lastTimestamp) {
88- const diff = now - JSON.parse(lastTimestamp);
99-1010- if (diff >= 10 * 60 * 1000) {
1111- foundation.orchestrator.processTracks({
1212- disableWhenReady: false,
1313- });
1414-1515- localStorage.setItem(KEY, JSON.stringify(now));
1616- }
1717-} else {
1818- foundation.orchestrator.processTracks({
1919- disableWhenReady: false,
1010+if (diff >= MAX_TIME_DIFF) {
1111+ const orchestrator = await foundation.orchestrator.processTracks({
1212+ disableWhenReady: true,
2013 });
21141515+ // Wait until we're actually done processing, only then set the timestamp
1616+ await orchestrator.process();
2217 localStorage.setItem(KEY, JSON.stringify(now));
2318}