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: [Server][EDCB] 設定再読み込みなどのコマンドを追加 #76

Merged
merged 1 commit into from
Feb 6, 2024
Merged
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
52 changes: 52 additions & 0 deletions server/app/utils/EDCB.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,12 @@ class ManualAutoAddData(TypedDict, total=False):
rec_setting: RecSettingData


class NWPlayTimeShiftInfo(TypedDict):
""" CMD_EPG_SRV_NWPLAY_TF_OPEN で受け取る情報 """
ctrl_id: int
file_path: str


class NotifySrvInfo(TypedDict):
""" 情報通知用パラメーター """
notify_id: int # 通知情報の種類
Expand Down Expand Up @@ -905,6 +911,16 @@ async def sendViewAppClose(self) -> bool:
ret, _ = await self.__sendCmd(self.__CMD_VIEW_APP_CLOSE)
return ret == self.__CMD_SUCCESS

async def sendReloadEpg(self) -> bool:
""" EPG 再読み込みを開始する """
ret, _ = await self.__sendCmd(self.__CMD_EPG_SRV_RELOAD_EPG)
return ret == self.__CMD_SUCCESS

async def sendReloadSetting(self) -> bool:
""" 設定を再読み込みする """
ret, _ = await self.__sendCmd(self.__CMD_EPG_SRV_RELOAD_SETTING)
return ret == self.__CMD_SUCCESS

async def sendEnumService(self) -> list[ServiceInfo] | None:
""" サービス一覧を取得する """
ret, rbuf = await self.__sendCmd(self.__CMD_EPG_SRV_ENUM_SERVICE)
Expand Down Expand Up @@ -1075,6 +1091,22 @@ async def sendGetRecFileNetworkPath(self, path: str) -> str | None:
pass
return None

async def sendGetRecFilePath(self, reserve_id: int) -> str | None:
""" 録画中かつ視聴予約でない予約の録画ファイルパスを取得する """
ret, rbuf = await self.__sendCmd(self.__CMD_EPG_SRV_NWPLAY_TF_OPEN,
lambda buf: self.__writeInt(buf, reserve_id))
if ret == self.__CMD_SUCCESS:
bufview = memoryview(rbuf)
pos = [0]
try:
info = self.__readNWPlayTimeShiftInfo(bufview, pos, len(rbuf))
await self.__sendCmd(self.__CMD_EPG_SRV_NWPLAY_CLOSE,
lambda buf: self.__writeInt(buf, info['ctrl_id']))
return info['file_path']
except self.__ReadError:
pass
return None

async def sendEnumTunerReserve(self) -> list[TunerReserveInfo] | None:
""" チューナーごとの予約一覧を取得する """
ret, rbuf = await self.__sendCmd(self.__CMD_EPG_SRV_ENUM_TUNER_RESERVE)
Expand All @@ -1085,6 +1117,11 @@ async def sendEnumTunerReserve(self) -> list[TunerReserveInfo] | None:
pass
return None

async def sendEpgCapNow(self) -> bool:
""" EPG 取得開始を要求する """
ret, _ = await self.__sendCmd(self.__CMD_EPG_SRV_EPG_CAP_NOW)
return ret == self.__CMD_SUCCESS

async def sendEnumPlugIn(self, index: Literal[1, 2]) -> list[str] | None:
""" PlugIn ファイルの一覧を取得する """
ret, rbuf = await self.__sendCmd(self.__CMD_EPG_SRV_ENUM_PLUGIN,
Expand Down Expand Up @@ -1236,6 +1273,8 @@ async def openViewStream(self, process_id: int) -> tuple[asyncio.StreamReader, a
__CMD_VIEW_APP_GET_BONDRIVER = 202
__CMD_VIEW_APP_SET_CH = 205
__CMD_VIEW_APP_CLOSE = 208
__CMD_EPG_SRV_RELOAD_EPG = 2
__CMD_EPG_SRV_RELOAD_SETTING = 3
__CMD_EPG_SRV_RELAY_VIEW_STREAM = 301
__CMD_EPG_SRV_DEL_RESERVE = 1014
__CMD_EPG_SRV_ENUM_TUNER_RESERVE = 1016
Expand All @@ -1247,10 +1286,13 @@ async def openViewStream(self, process_id: int) -> tuple[asyncio.StreamReader, a
__CMD_EPG_SRV_ENUM_PG_ARC = 1030
__CMD_EPG_SRV_DEL_AUTO_ADD = 1033
__CMD_EPG_SRV_DEL_MANU_ADD = 1043
__CMD_EPG_SRV_EPG_CAP_NOW = 1053
__CMD_EPG_SRV_FILE_COPY = 1060
__CMD_EPG_SRV_ENUM_PLUGIN = 1061
__CMD_EPG_SRV_NWTV_ID_SET_CH = 1073
__CMD_EPG_SRV_NWTV_ID_CLOSE = 1074
__CMD_EPG_SRV_NWPLAY_CLOSE = 1081
__CMD_EPG_SRV_NWPLAY_TF_OPEN = 1087
__CMD_EPG_SRV_GET_NETWORK_PATH = 1299
__CMD_EPG_SRV_ENUM_RESERVE2 = 2011
__CMD_EPG_SRV_GET_RESERVE2 = 2012
Expand Down Expand Up @@ -2053,6 +2095,16 @@ def __readManualAutoAddData(cls, buf: memoryview, pos: list[int], size: int) ->
pos[0] = size
return v

@classmethod
def __readNWPlayTimeShiftInfo(cls, buf: memoryview, pos: list[int], size: int) -> NWPlayTimeShiftInfo:
size = cls.__readStructIntro(buf, pos, size)
v: NWPlayTimeShiftInfo = {
'ctrl_id': cls.__readInt(buf, pos, size),
'file_path': cls.__readString(buf, pos, size)
}
pos[0] = size
return v

@classmethod
def __readNotifySrvInfo(cls, buf: memoryview, pos: list[int], size: int) -> NotifySrvInfo:
size = cls.__readStructIntro(buf, pos, size)
Expand Down