Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recordings to notifyChange event and monitor #31

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions haphilipsjs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,8 @@ async def notifyChange(self, timeout=TIMEOUT_NOTIFYREAD):
"menuitems/settings/version": {"version": self.settings_version}
}
}
if (self.api_version == 6) and self.json_feature_supported("recordings", "List"):
data["notification"].update({"recordings/list": self.recordings_list})

timeout_ctx = httpx.Timeout(timeout=TIMEOUT, connect=TIMEOUT_CONNECT, read=timeout)
try:
Expand Down Expand Up @@ -1492,6 +1494,12 @@ async def notifyChange(self, timeout=TIMEOUT_NOTIFYREAD):
if "menuitems/settings/version" in result:
self.settings_version = result["menuitems/settings/version"]["version"]

if "recordings/list" in result:
#TV just updates the recording 'version' and doesn't sent the actual 'recordings'
if self.recordings_list != None:
if self.recordings_list["version"] != result["recordings/list"]["version"]:
self.recordings_list = self.getRecordings()

return True

if result is None:
Expand Down
14 changes: 14 additions & 0 deletions haphilipsjs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ def get_application_name():
for idx, channel in enumerate(tv.channels_current):
stdscr.addstr(1+idx, 70, channel.get("name", channel.get("ccid")))

#Recordings just known working with API level 6 currently
if tv.api_version_detected == 6:
stdscr.addstr(0, 90, "Recordings")
if tv.recordings_list != None:
for idx, rec in enumerate(tv.recordings_list["recordings"]):
title = rec.get("RecName")
type = rec.get("RecordingType")

if type == "RECORDING_NEW":
title = "*NEW* " + title
elif type == "RECORDING_ONGOING":
title = "*REC* " + title

stdscr.addstr(1+idx, 90, title)

def print_pixels(side, offset_y, offset_x):
stdscr.addstr(offset_y, offset_x, "{}".format(side))
Expand Down