Plexamp Lite 1.13: read ahead the next two tracks, keep loaded roots

Read-ahead keeps the next two tracks on the SD card (one without it) and drops files
that are no longer coming up. Trusted roots are cached once read, and a failed read
is retried instead of leaving every server untrusted until a restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
XoséandClaude Opus 5.5 committed 2026-10-20 14:00:46 +02:00
1 parent 30d7742fb5
commit b6f696a8c8
6 files changed
+136 -37

No files matched your search

+18
View File
@@ -25,6 +25,12 @@ public class QueueTest {
return sb.toString().trim();
}
static String titles(List<Item> l) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < l.size(); i++) sb.append(i > 0 ? " " : "").append(l.get(i).title);
return sb.toString();
}
public static void main(String[] a) {
PlayQueue q = PlayQueue.get();
q.set(tracks(5), 2, false, "Album");
@@ -65,6 +71,18 @@ public class QueueTest {
check(q.size() == 10 && q.index() == 0 && q.shuffle(), "shuffle play from random start");
q.clear();
check(q.current() == null && q.size() == 0, "clear");
// read-ahead window: the next two tracks, wrapping only with repeat all, never the current one
q.set(tracks(4), 1, false, "Ahead");
check(titles(q.peekAhead(2)).equals("T2 T3"), "peekAhead 2 from T1: " + titles(q.peekAhead(2)));
q.advance(false); q.advance(false);
check(titles(q.peekAhead(2)).equals(""), "peekAhead at the end, repeat off: empty");
q.cycleRepeat(); // all
check(titles(q.peekAhead(2)).equals("T0 T1"), "peekAhead wraps with repeat all: " + titles(q.peekAhead(2)));
q.cycleRepeat(); q.cycleRepeat(); // off
q.set(tracks(2), 0, false, "Two");
q.cycleRepeat(); // all
check(titles(q.peekAhead(2)).equals("T1"), "peekAhead skips the current track on wrap: " + titles(q.peekAhead(2)));
q.cycleRepeat(); q.cycleRepeat(); // off
System.out.println(fails == 0 ? "ALL PASSED" : fails + " FAILED");
System.exit(fails == 0 ? 0 : 1);
}