Private
Public Access
Backport from the iOS version: offline downloads, home-first reconnect, stall warning, Close
- Downloads for offline listening: long-press a track, album, artist or playlist -> Download; Menu -> Downloads lists them (progress, space used/free, play/shuffle, retry, remove). Saved on the SD card (Android/data/com.minamp/ files/downloads). MP3 originals kept as they are unless above a lower download quality; the rest transcoded to MP3 (320 kbps by default). One at a time, Range resume for originals, retried when the server is back, Wi-Fi lock. - Downloaded tracks play from the SD card, offline too; plays made offline are reported to Plex when a connection works again. - Server.pick: when last time's connection was remote, give the plain home addresses 2 s first (a hairpinned remote address kept us encrypted and capped at home). test/PreferHomeTest.java. - Playback "playing" but not moving for 12 s: say so instead of staying silent. - Menu -> Close Minamp: stop the music and close every screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f7f49ecfbb
commit
f9050bbac0
15 files changed
+933
-43
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import com.minamp.plex.Server;
|
||||
|
||||
/** Server.pick() after being away: the home address wins again when it answers, quickly. */
|
||||
public class PreferHomeTest {
|
||||
static int failures = 0;
|
||||
|
||||
static void check(boolean ok, String what) {
|
||||
System.out.println((ok ? "PASS " : "FAIL ") + what);
|
||||
if (!ok) failures++;
|
||||
}
|
||||
|
||||
static Server server(String home, String remote) {
|
||||
Server s = new Server();
|
||||
s.machineId = "abc123";
|
||||
s.add(home, Server.LOCAL_HTTP);
|
||||
s.add(remote, Server.REMOTE);
|
||||
s.sortConnections();
|
||||
s.lastGoodUri = remote; // last time we were away
|
||||
return s;
|
||||
}
|
||||
|
||||
public static void main(String[] a) throws Exception {
|
||||
String home = "http://127.0.0.1:" + a[0], remote = "http://127.0.0.1:" + a[1], dead = "http://127.0.0.1:1";
|
||||
|
||||
long t0 = System.currentTimeMillis();
|
||||
Server.Conn c = server(home, remote).pick();
|
||||
check(c.kind == Server.LOCAL_HTTP, "back home: home address chosen over last time's remote one (" + (System.currentTimeMillis() - t0) + " ms)");
|
||||
|
||||
t0 = System.currentTimeMillis();
|
||||
c = server(dead, remote).pick();
|
||||
long ms = System.currentTimeMillis() - t0;
|
||||
check(c.kind == Server.REMOTE && ms < 3500, "still away: remote chosen, home check cost " + ms + " ms");
|
||||
|
||||
Server s = server(home, remote);
|
||||
s.lastGoodUri = home;
|
||||
c = s.pick();
|
||||
check(c.kind == Server.LOCAL_HTTP, "home last time: home again");
|
||||
|
||||
System.out.println(failures == 0 ? "ALL PASSED" : failures + " FAILED");
|
||||
System.exit(failures == 0 ? 0 : 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
"""Answers /identity like a Plex Media Server (for PreferHomeTest). Usage: identity_server.py PORT"""
|
||||
import json, sys
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
|
||||
class H(BaseHTTPRequestHandler):
|
||||
def log_message(self, *a): pass
|
||||
def do_GET(self):
|
||||
body = json.dumps({"MediaContainer": {"machineIdentifier": "abc123"}}).encode()
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
ThreadingHTTPServer(("127.0.0.1", int(sys.argv[1])), H).serve_forever()
|
||||
Reference in new issue
Block a user