Skip to content

Commit

Permalink
Merge pull request #27 from Floyer007/recordings
Browse files Browse the repository at this point in the history
Added new function to read recordings/list
  • Loading branch information
elupus authored Jan 23, 2023
2 parents 258f041 + 71e7636 commit f40827d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
14 changes: 14 additions & 0 deletions haphilipsjs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
ChannelsType,
ContextType,
FavoriteListType,
RecordingsListed,
MenuItemsSettingsCurrent,
MenuItemsSettingsCurrentPost,
MenuItemsSettingsCurrentValueValue,
Expand Down Expand Up @@ -238,6 +239,7 @@ def __init__(
self.ambilight_current_configuration: Optional[
AmbilightCurrentConfiguration
] = None
self.recordings_list: Optional[RecordingsListed] = None
self.huelamp_power: Optional[str] = None
self.powerstate = None
if auth_shared_key:
Expand Down Expand Up @@ -1225,6 +1227,18 @@ async def setAmbilightCurrentConfiguration(

return True

async def getRecordings(self):
if self.json_feature_supported("recordings", "List"):
r = cast(
Optional[RecordingsListed],
await self.getReq("recordings/list"),
)
if r:
self.recordings_list = r
else:
self.recordings_list = None
return r

async def openURL(self, url: str):
if self.json_feature_supported("activities", "browser"):
r = await self.postReq("activities/browser", {"url": url})
Expand Down
44 changes: 44 additions & 0 deletions haphilipsjs/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,50 @@ class AmbilightCurrentConfiguration(TypedDict, total=False):
audioSettings: AmbilightAudioSettingsType
colorSettings: AmbilightColorSettingsType

class RecordingsListedType(TypedDict, total=False):
RecordingId: int
ServerRecordingId: int
RecordingType: str #RECORDING_ONGOING, RECORDING_SCHEDULED, RECORDING_NEW, RECORDING_PARTIALLY_VIEWED, RECORDING_VIEWED
RecName: str
EventId: int
EventInfo: str
EventExtendedInfo: str
EventGenre: str
EventRating: int
SeriesID: str
StartTime: int
ActualStartTime: int
Duration: int
MarginStart: int
MarginEnd: int
AutoMarginStart: int
AutoMarginEnd: int
RetentionInfo: int
SeasonNo: int
EpisodeNo: int
EpisodeCount: int
ProgramNumber: int
ProgramDuration: int
ResumeInfo: int
LastPinChangedTime: int
HasCicamPin: bool
hasDot: bool
HasLicenseFile: bool
IsRadio: bool
IsPartial: bool
IsIpEpgRec: bool
isFTARecording: bool
EITVersion: int
EITSource: str #EIT_SOURCE_PF, ...
RecError: str #REC_ERROR_NONE, ...
Version: int
Size: int
ccid: int

class RecordingsListed(TypedDict):
version: str
recordings: List[RecordingsListedType]

class MenuItemsSettingsNodeDataSliderData(TypedDict):
min: int
max: int
Expand Down

0 comments on commit f40827d

Please sign in to comment.