lghorizon 0.7.3b4__tar.gz → 0.7.5__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.
Files changed (29) hide show
  1. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/PKG-INFO +1 -1
  2. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon/const.py +0 -2
  3. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon/lghorizon_api.py +17 -17
  4. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon.egg-info/PKG-INFO +1 -1
  5. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/.coverage +0 -0
  6. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/.flake8 +0 -0
  7. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/.github/workflows/build-on-pr.yml +0 -0
  8. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/.github/workflows/publish-to-pypi.yml +0 -0
  9. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/.gitignore +0 -0
  10. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/LICENSE +0 -0
  11. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/README.md +0 -0
  12. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/instructions.txt +0 -0
  13. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon/__init__.py +0 -0
  14. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon/exceptions.py +0 -0
  15. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon/helpers.py +0 -0
  16. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon/models.py +0 -0
  17. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon/py.typed +0 -0
  18. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon.egg-info/SOURCES.txt +0 -0
  19. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon.egg-info/dependency_links.txt +0 -0
  20. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon.egg-info/not-zip-safe +0 -0
  21. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon.egg-info/requires.txt +0 -0
  22. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lghorizon.egg-info/top_level.txt +0 -0
  23. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/lib64 +0 -0
  24. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/pyvenv.cfg +0 -0
  25. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/renovate.json +0 -0
  26. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/secrets_stub.json +0 -0
  27. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/setup.cfg +0 -0
  28. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/setup.py +0 -0
  29. {lghorizon-0.7.3b4 → lghorizon-0.7.5}/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lghorizon
3
- Version: 0.7.3b4
3
+ Version: 0.7.5
4
4
  Summary: Python client for Liberty Global Horizon settop boxes
5
5
  Home-page: https://github.com/sholofly/LGHorizon-python
6
6
  Author: Rudolf Offereins
@@ -73,13 +73,11 @@ COUNTRY_SETTINGS = {
73
73
  },
74
74
  "ch": {
75
75
  "api_url": "https://spark-prod-ch.gnp.cloud.sunrisetv.ch",
76
- "use_oauth": False,
77
76
  "channels": [],
78
77
  "language": "de",
79
78
  },
80
79
  "be-nl": {
81
80
  "api_url": "https://spark-prod-be.gnp.cloud.telenet.tv",
82
- "use_oauth": True,
83
81
  "oauth_username_fieldname": "j_username",
84
82
  "oauth_password_fieldname": "j_password",
85
83
  "oauth_add_accept_header": False,
@@ -90,8 +90,10 @@ class LGHorizonApi:
90
90
  ctry_code = self._country_code[0:2]
91
91
  if ctry_code == "be":
92
92
  self.authorize_telenet()
93
- elif ctry_code == "gb":
94
- self.authorize_gb()
93
+ elif ctry_code in ("gb", "ch"):
94
+ self.authorize_with_refreshtoken()
95
+ # elif ctry_code == "ch":
96
+ # self.authorize_sunrise()
95
97
  else:
96
98
  self._authorize_default()
97
99
 
@@ -122,7 +124,7 @@ class LGHorizonApi:
122
124
  self._auth.fill(auth_response.json())
123
125
  _logger.debug("Authorization succeeded")
124
126
 
125
- def authorize_gb(self) -> None:
127
+ def authorize_with_refreshtoken(self) -> None:
126
128
  _logger.debug("Authorizing via refresh")
127
129
  refresh_url = (
128
130
  f"{self._country_settings['api_url']}/auth-service/v1/authorization/refresh"
@@ -279,11 +281,7 @@ class LGHorizonApi:
279
281
  def _on_mqtt_message(self, message: str, topic: str) -> None:
280
282
  if "action" in message and message["action"] == "OPS.getProfilesUpdate":
281
283
  self._update_customer()
282
- self._channels.clear()
283
- self._get_channels()
284
284
  box: LGHorizonBox
285
- for box in self.settop_boxes.values():
286
- box.update_channels(self._channels)
287
285
  elif "source" in message:
288
286
  deviceId = message["source"]
289
287
  if not isinstance(deviceId, str):
@@ -433,13 +431,6 @@ class LGHorizonApi:
433
431
  channels_result = self._do_api_call(
434
432
  f"{self._config['linearService']['URL']}/v2/channels?cityId={self.customer.cityId}&language={self._country_settings['language']}&productClass=Orion-DASH"
435
433
  )
436
- profile_channels = []
437
- if self._profile_id and self._profile_id in self.customer.profiles:
438
- profile_channels = self.customer.profiles[
439
- self._profile_id
440
- ].favorite_channels
441
-
442
- has_profile_channels = len(profile_channels) > 0
443
434
  for channel in channels_result:
444
435
  if "isRadio" in channel and channel["isRadio"]:
445
436
  continue
@@ -449,12 +440,21 @@ class LGHorizonApi:
449
440
  if len(common_entitlements) == 0:
450
441
  continue
451
442
  channel_id = channel["id"]
452
- if has_profile_channels and channel_id not in profile_channels:
453
- continue
454
-
455
443
  self._channels[channel_id] = LGHorizonChannel(channel)
456
444
  _logger.info(f"{len(self._channels)} retrieved.")
457
445
 
446
+ def get_display_channels(self):
447
+ all_channels = self._channels.values()
448
+ if not self._profile_id or self._profile_id not in self.customer.profiles:
449
+ return all_channels
450
+ profile_channel_ids = self.customer.profiles[self._profile_id].favorite_channels
451
+ if len(profile_channel_ids) == 0:
452
+ return all_channels
453
+
454
+ return [
455
+ channel for channel in all_channels if channel.id in profile_channel_ids
456
+ ]
457
+
458
458
  def _get_replay_event(self, listingId) -> Any:
459
459
  """Get listing."""
460
460
  _logger.info("Retrieving replay event details...")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lghorizon
3
- Version: 0.7.3b4
3
+ Version: 0.7.5
4
4
  Summary: Python client for Liberty Global Horizon settop boxes
5
5
  Home-page: https://github.com/sholofly/LGHorizon-python
6
6
  Author: Rudolf Offereins
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