This commit is contained in:
@@ -16,6 +16,11 @@ import urllib.parse
|
||||
import urllib.request
|
||||
|
||||
|
||||
class ZidooError(RuntimeError):
|
||||
"""The Zidoo did not do what it was asked -- off, unreachable, or with
|
||||
nothing loaded to do it to."""
|
||||
|
||||
|
||||
class ZidooClient:
|
||||
def __init__(self, host, port=9529, timeout=1.5):
|
||||
self.base_url = f"http://{host}:{port}"
|
||||
@@ -65,6 +70,15 @@ class ZidooClient:
|
||||
track["duration_ms"] = video["duration"]
|
||||
return track
|
||||
|
||||
def seek(self, position_ms):
|
||||
"""Jump the loaded video to position_ms. Unlike now_playing(), this
|
||||
is something someone asked for, so a Zidoo that does not answer is
|
||||
an error rather than simply nothing to show."""
|
||||
# "positon" [sic] is the Zidoo's own spelling.
|
||||
payload = self._get_json("ZidooVideoPlay/seekTo", positon=int(position_ms))
|
||||
if not payload or payload.get("status") != 200:
|
||||
raise ZidooError("The Zidoo did not seek -- is a film still loaded on it?")
|
||||
|
||||
def _film(self, path):
|
||||
"""The poster wall's entry for the film a file belongs to -- its
|
||||
"id" (which is also its poster's) and "year" among the rest -- or {}
|
||||
|
||||
Reference in New Issue
Block a user