Make progress bar cursor draggable
Deploy HEOS panel / deploy (push) Successful in 26s

This commit is contained in:
2026-09-16 23:19:08 +02:00
parent 51dff45b54
commit ec684b7803
12 changed files with 319 additions and 29 deletions
+17 -1
View File
@@ -14,7 +14,7 @@ from urllib.parse import parse_qs, urlparse
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from zidoo import ZidooClient # noqa: E402
from zidoo import ZidooClient, ZidooError # noqa: E402
PATH = "/storage/disk/Movies/A.Private.War.2018.1080p.mp4"
PNG = b"\x89PNG\r\n\x1a\n" + b"\0" * 16
@@ -25,6 +25,7 @@ class FakeZidoo(BaseHTTPRequestHandler):
library = {} # file path -> getAggregationOfFile's answer
posters = {} # poster id -> image bytes
lookups = [] # paths getAggregationOfFile was asked about
seeks = [] # every seekTo's position
def do_GET(self):
url = urlparse(self.path)
@@ -33,6 +34,11 @@ class FakeZidoo(BaseHTTPRequestHandler):
if self.video is None:
return self._send(404, b"")
return self._json({"status": 200, "video": self.video})
if url.path == "/ZidooVideoPlay/seekTo":
if self.video is None:
return self._send(404, b"")
self.seeks.append(int(query["positon"])) # sic, as the real one spells it
return self._json({"status": 200})
if url.path == "/ZidooPoster/v2/getAggregationOfFile":
self.lookups.append(query["path"])
return self._json(self.library.get(query["path"], {"status": 804, "msg": "Error!!!"}))
@@ -62,6 +68,7 @@ class ZidooTest(unittest.TestCase):
"movie": {"id": 108, "name": "A Private War", "year": 2018}}}
FakeZidoo.posters = {108: PNG}
FakeZidoo.lookups = []
FakeZidoo.seeks = []
self.server = ThreadingHTTPServer(("127.0.0.1", 0), FakeZidoo)
threading.Thread(target=self.server.serve_forever, args=(0.05,), daemon=True).start()
self.zidoo = ZidooClient("127.0.0.1", self.server.server_address[1])
@@ -95,6 +102,15 @@ class ZidooTest(unittest.TestCase):
FakeZidoo.video = None
self.assertIsNone(self.zidoo.now_playing())
def test_seek_moves_the_loaded_film(self):
self.zidoo.seek(3600000)
self.assertEqual(FakeZidoo.seeks, [3600000])
def test_seeking_with_nothing_loaded_is_an_error(self):
FakeZidoo.video = None
with self.assertRaises(ZidooError):
self.zidoo.seek(3600000)
def test_poster_is_sniffed_from_its_bytes(self):
self.assertEqual(self.zidoo.poster(108), (PNG, "image/png"))