lghorizon 0.7.0__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lghorizon-0.7.0 → lghorizon-0.7.2}/PKG-INFO +1 -1
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon/lghorizon_api.py +28 -7
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon.egg-info/PKG-INFO +1 -1
- {lghorizon-0.7.0 → lghorizon-0.7.2}/.coverage +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/.flake8 +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/.github/workflows/build-on-pr.yml +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/.github/workflows/publish-to-pypi.yml +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/.gitignore +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/LICENSE +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/README.md +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/instructions.txt +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon/__init__.py +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon/const.py +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon/exceptions.py +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon/helpers.py +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon/models.py +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon/py.typed +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon.egg-info/SOURCES.txt +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon.egg-info/dependency_links.txt +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon.egg-info/not-zip-safe +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon.egg-info/requires.txt +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lghorizon.egg-info/top_level.txt +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/lib64 +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/pyvenv.cfg +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/renovate.json +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/secrets_stub.json +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/setup.cfg +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/setup.py +0 -0
- {lghorizon-0.7.0 → lghorizon-0.7.2}/test.py +0 -0
|
@@ -35,7 +35,7 @@ from .const import (
|
|
|
35
35
|
RECORDING_TYPE_SEASON,
|
|
36
36
|
RECORDING_TYPE_SHOW,
|
|
37
37
|
)
|
|
38
|
-
from typing import Any, Dict, List
|
|
38
|
+
from typing import Any, Callable, Dict, List
|
|
39
39
|
|
|
40
40
|
_logger = logging.getLogger(__name__)
|
|
41
41
|
_supported_platforms = ["EOS", "EOS2", "HORIZON", "APOLLO"]
|
|
@@ -56,6 +56,7 @@ class LGHorizonApi:
|
|
|
56
56
|
_entitlements: List[str] = None
|
|
57
57
|
_identifier: str = None
|
|
58
58
|
_config: str = None
|
|
59
|
+
_refresh_callback: Callable = None
|
|
59
60
|
|
|
60
61
|
def __init__(
|
|
61
62
|
self,
|
|
@@ -63,7 +64,7 @@ class LGHorizonApi:
|
|
|
63
64
|
password: str,
|
|
64
65
|
country_code: str = "nl",
|
|
65
66
|
identifier: str = None,
|
|
66
|
-
refresh_token
|
|
67
|
+
refresh_token=None,
|
|
67
68
|
) -> None:
|
|
68
69
|
"""Create LGHorizon API."""
|
|
69
70
|
self.username = username
|
|
@@ -117,7 +118,9 @@ class LGHorizonApi:
|
|
|
117
118
|
|
|
118
119
|
def authorize_gb(self) -> None:
|
|
119
120
|
_logger.debug("Authorizing via refresh")
|
|
120
|
-
refresh_url = (
|
|
121
|
+
refresh_url = (
|
|
122
|
+
f"{self._country_settings['api_url']}/auth-service/v1/authorization/refresh"
|
|
123
|
+
)
|
|
121
124
|
headers = {"content-type": "application/json", "charset": "utf-8"}
|
|
122
125
|
payload = '{"refreshToken":"' + self.refresh_token + '"}'
|
|
123
126
|
|
|
@@ -144,8 +147,15 @@ class LGHorizonApi:
|
|
|
144
147
|
self._auth.fill(auth_response.json())
|
|
145
148
|
self.refresh_token = self._auth.refreshToken
|
|
146
149
|
self._session.cookies["ACCESSTOKEN"] = self._auth.accessToken
|
|
150
|
+
|
|
151
|
+
if self._refresh_callback:
|
|
152
|
+
self._refresh_callback ()
|
|
153
|
+
|
|
147
154
|
_logger.debug("Authorization succeeded")
|
|
148
155
|
|
|
156
|
+
def set_callback(self, refresh_callback: Callable) -> None:
|
|
157
|
+
self._refresh_callback = refresh_callback
|
|
158
|
+
|
|
149
159
|
def authorize_telenet(self):
|
|
150
160
|
try:
|
|
151
161
|
login_session = Session()
|
|
@@ -255,6 +265,9 @@ class LGHorizonApi:
|
|
|
255
265
|
def _on_mqtt_message(self, message: str, topic: str) -> None:
|
|
256
266
|
if "source" in message:
|
|
257
267
|
deviceId = message["source"]
|
|
268
|
+
if not isinstance(deviceId,str):
|
|
269
|
+
_logger.debug("ignoring message - not a string")
|
|
270
|
+
return
|
|
258
271
|
if not deviceId in self.settop_boxes.keys():
|
|
259
272
|
return
|
|
260
273
|
try:
|
|
@@ -290,10 +303,14 @@ class LGHorizonApi:
|
|
|
290
303
|
self.settop_boxes[deviceId].playing_info.set_paused(
|
|
291
304
|
playerState["speed"] == 0
|
|
292
305
|
)
|
|
293
|
-
if
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
306
|
+
if (
|
|
307
|
+
source_type
|
|
308
|
+
in (
|
|
309
|
+
BOX_PLAY_STATE_CHANNEL,
|
|
310
|
+
BOX_PLAY_STATE_BUFFER,
|
|
311
|
+
BOX_PLAY_STATE_REPLAY,
|
|
312
|
+
)
|
|
313
|
+
and "eventId" in state_source
|
|
297
314
|
):
|
|
298
315
|
eventId = state_source["eventId"]
|
|
299
316
|
raw_replay_event = self._do_api_call(
|
|
@@ -414,6 +431,10 @@ class LGHorizonApi:
|
|
|
414
431
|
|
|
415
432
|
def get_recording_capacity(self) -> int:
|
|
416
433
|
"""Returns remaining recording capacity"""
|
|
434
|
+
ctry_code = self._country_code[0:2]
|
|
435
|
+
if ctry_code == "gb":
|
|
436
|
+
_logger.debug("GB: not supported")
|
|
437
|
+
return None
|
|
417
438
|
try:
|
|
418
439
|
_logger.info("Retrieving recordingcapacity...")
|
|
419
440
|
quota_content = self._do_api_call(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|