1919 LGHorizonNDVRSource ,
2020 LGHorizonReviewBufferSource ,
2121 LGHorizonRecordingSource ,
22+ LGHorizonMediaType ,
2223)
2324from .lghorizon_models import LGHorizonAuth
2425from .lghorizon_models import LGHorizonReplayEvent , LGHorizonVOD , LGHorizonVODType
@@ -124,6 +125,7 @@ async def _process_apps_state(
124125 device_state .show_title = apps_state .app_name
125126 device_state .image = apps_state .logo_path
126127 device_state .ui_state_type = LGHorizonUIStateType .APPS
128+ device_state .media_type = LGHorizonMediaType .APP
127129
128130 async def _process_linear_state (
129131 self ,
@@ -145,8 +147,10 @@ async def _process_linear_state(
145147 service_path ,
146148 )
147149 replay_event = LGHorizonReplayEvent (event_json )
148- device_state .id = replay_event .event_id
149150 channel = self ._channels [replay_event .channel_id ]
151+
152+ device_state .media_type = LGHorizonMediaType .CHANNEL
153+ device_state .id = replay_event .event_id
150154 device_state .source_type = source .source_type
151155 device_state .channel_id = channel .id
152156 device_state .channel_name = channel .title
@@ -189,8 +193,10 @@ async def _process_reviewbuffer_state(
189193 service_path ,
190194 )
191195 replay_event = LGHorizonReplayEvent (event_json )
192- device_state .id = replay_event .event_id
193196 channel = self ._channels [replay_event .channel_id ]
197+
198+ device_state .media_type = LGHorizonMediaType .CHANNEL
199+ device_state .id = replay_event .event_id
194200 device_state .source_type = source .source_type
195201 device_state .channel_id = channel .id
196202 device_state .channel_name = channel .title
@@ -205,6 +211,7 @@ async def _process_reviewbuffer_state(
205211 device_state .start_time = replay_event .start_time
206212 device_state .end_time = replay_event .end_time
207213 device_state .duration = replay_event .end_time - replay_event .start_time
214+
208215 # Add random number to url to force refresh
209216 join_param = "?"
210217 if join_param in channel .stream_image :
@@ -234,9 +241,11 @@ async def _process_replay_state(
234241 service_path ,
235242 )
236243 replay_event = LGHorizonReplayEvent (event_json )
237- device_state .id = replay_event .event_id
238244 # Iets met buffer doen
239245 channel = self ._channels [replay_event .channel_id ]
246+
247+ device_state .media_type = LGHorizonMediaType .CHANNEL
248+ device_state .id = replay_event .event_id
240249 device_state .source_type = source .source_type
241250 device_state .channel_id = channel .id
242251 device_state .episode_title = replay_event .episode_name
@@ -279,8 +288,10 @@ async def _process_vod_state(
279288 device_state .episode_title = vod .title
280289 device_state .season_number = vod .season
281290 device_state .episode_number = vod .episode
291+ device_state .media_type = LGHorizonMediaType .EPISODE
282292 else :
283293 device_state .show_title = vod .title
294+ device_state .media_type = LGHorizonMediaType .MOVIE
284295
285296 device_state .duration = vod .duration
286297 device_state .last_position_update = int (time .time ())
@@ -335,6 +346,8 @@ async def _process_ndvr_state(
335346 else :
336347 device_state .show_title = recording .show_title
337348
349+ device_state .media_type = LGHorizonMediaType .CHANNEL
350+
338351 device_state .image = await self ._get_intent_image_url (recording .id )
339352
340353 async def _get_intent_image_url (self , intent_id : str ) -> Optional [str ]:
0 commit comments