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.

fix: processing issues

+10 -8
+6 -4
src/components/orchestrator/process-tracks/element.js
··· 131 131 this.output.tracks.save(tracks); 132 132 }, link); 133 133 134 - // Save intermediate batches as they arrive so progress isn't lost. 135 - // Merge with tracks not present in the batch to avoid overwriting them. 136 - listen("batch", /** @param {Track[]} tracks */ async (tracks) => { 134 + // Save patched tracks as they arrive so progress isn't lost. 135 + // Merge with existing tracks to avoid overwriting ones not yet patched. 136 + listen("patch", /** @param {Track[]} tracks */ async (tracks) => { 137 137 if (!this.output) return; 138 138 const existing = await data(this.output.tracks); 139 - this.output.tracks.save(mergeTracks(existing, tracks)); 139 + const merged = mergeTracks(existing, tracks); 140 + console.log(merged.filter((t) => !!t.tags)); 141 + this.output.tracks.save(merged); 140 142 }, link); 141 143 142 144 // Process whenever tracks are initially loaded;
+4 -4
src/components/orchestrator/process-tracks/worker.js
··· 61 61 62 62 // Fetch metadata if needed 63 63 let processed = 0; 64 + let patchedCount = 0; 64 65 const BATCH_SIZE = 100; 65 66 66 67 const tracksWithMetadata = await tracks.reduce( ··· 74 75 if ((track.tags && track.stats) || track.kind === "placeholder") { 75 76 processed++; 76 77 $progress.value = { processed, total: tracks.length }; 77 - const result = [...acc, track]; 78 - if (processed % BATCH_SIZE === 0) announce("batch", result, context); 79 - return result; 78 + return [...acc, track]; 80 79 } 81 80 82 81 const patched = await metadata.patch(track); 83 82 84 83 processed++; 84 + patchedCount++; 85 85 $progress.value = { processed, total: tracks.length }; 86 86 87 87 const result = [...acc, patched]; 88 - if (processed % BATCH_SIZE === 0) announce("batch", result, context); 88 + if (patchedCount % BATCH_SIZE === 0) announce("patch", result, context); 89 89 return result; 90 90 }, 91 91 Promise.resolve([]),