A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: improve the process-tracks prelude

+9 -14
+1 -1
src/_data/facets.json
··· 100 100 "kind": "prelude", 101 101 "category": "Data", 102 102 "featured": true, 103 - "desc": "Process all your audio inputs automatically when opening any interface. Happens once every 10 minutes." 103 + "desc": "Process all your audio inputs automatically into tracks when opening any interface. Only happens once every 10 minutes, if the processing was completed." 104 104 }, 105 105 { 106 106 "url": "facets/misc/scrobble/index.html",
+8 -13
src/facets/data/process-tracks/index.inline.js
··· 1 1 import foundation from "~/common/foundation.js"; 2 2 3 3 const KEY = "facets/data/process-tracks/timestamp"; 4 + const MAX_TIME_DIFF = 10 * 60 * 1000; 5 + 4 6 const lastTimestamp = localStorage.getItem(KEY); 5 7 const now = Date.now(); 8 + const diff = lastTimestamp ? now - JSON.parse(lastTimestamp) : MAX_TIME_DIFF; 6 9 7 - if (lastTimestamp) { 8 - const diff = now - JSON.parse(lastTimestamp); 9 - 10 - if (diff >= 10 * 60 * 1000) { 11 - foundation.orchestrator.processTracks({ 12 - disableWhenReady: false, 13 - }); 14 - 15 - localStorage.setItem(KEY, JSON.stringify(now)); 16 - } 17 - } else { 18 - foundation.orchestrator.processTracks({ 19 - disableWhenReady: false, 10 + if (diff >= MAX_TIME_DIFF) { 11 + const orchestrator = await foundation.orchestrator.processTracks({ 12 + disableWhenReady: true, 20 13 }); 21 14 15 + // Wait until we're actually done processing, only then set the timestamp 16 + await orchestrator.process(); 22 17 localStorage.setItem(KEY, JSON.stringify(now)); 23 18 }