lghorizon 0.7.3b3__tar.gz → 0.7.4__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.3b3 → lghorizon-0.7.4}/PKG-INFO +1 -1
  2. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon/lghorizon_api.py +13 -12
  3. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon/models.py +3 -0
  4. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon.egg-info/PKG-INFO +1 -1
  5. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/.coverage +0 -0
  6. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/.flake8 +0 -0
  7. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/.github/workflows/build-on-pr.yml +0 -0
  8. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/.github/workflows/publish-to-pypi.yml +0 -0
  9. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/.gitignore +0 -0
  10. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/LICENSE +0 -0
  11. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/README.md +0 -0
  12. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/instructions.txt +0 -0
  13. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon/__init__.py +0 -0
  14. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon/const.py +0 -0
  15. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon/exceptions.py +0 -0
  16. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon/helpers.py +0 -0
  17. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon/py.typed +0 -0
  18. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon.egg-info/SOURCES.txt +0 -0
  19. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon.egg-info/dependency_links.txt +0 -0
  20. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon.egg-info/not-zip-safe +0 -0
  21. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon.egg-info/requires.txt +0 -0
  22. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lghorizon.egg-info/top_level.txt +0 -0
  23. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/lib64 +0 -0
  24. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/pyvenv.cfg +0 -0
  25. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/renovate.json +0 -0
  26. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/secrets_stub.json +0 -0
  27. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/setup.cfg +0 -0
  28. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/setup.py +0 -0
  29. {lghorizon-0.7.3b3 → lghorizon-0.7.4}/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lghorizon
3
- Version: 0.7.3b3
3
+ Version: 0.7.4
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
@@ -279,8 +279,7 @@ class LGHorizonApi:
279
279
  def _on_mqtt_message(self, message: str, topic: str) -> None:
280
280
  if "action" in message and message["action"] == "OPS.getProfilesUpdate":
281
281
  self._update_customer()
282
- self._channels.clear()
283
- self._get_channels()
282
+ box: LGHorizonBox
284
283
  elif "source" in message:
285
284
  deviceId = message["source"]
286
285
  if not isinstance(deviceId, str):
@@ -430,13 +429,6 @@ class LGHorizonApi:
430
429
  channels_result = self._do_api_call(
431
430
  f"{self._config['linearService']['URL']}/v2/channels?cityId={self.customer.cityId}&language={self._country_settings['language']}&productClass=Orion-DASH"
432
431
  )
433
- profile_channels = []
434
- if self._profile_id and self._profile_id in self.customer.profiles:
435
- profile_channels = self.customer.profiles[
436
- self._profile_id
437
- ].favorite_channels
438
-
439
- has_profile_channels = len(profile_channels) > 0
440
432
  for channel in channels_result:
441
433
  if "isRadio" in channel and channel["isRadio"]:
442
434
  continue
@@ -446,12 +438,21 @@ class LGHorizonApi:
446
438
  if len(common_entitlements) == 0:
447
439
  continue
448
440
  channel_id = channel["id"]
449
- if has_profile_channels and channel_id not in profile_channels:
450
- continue
451
-
452
441
  self._channels[channel_id] = LGHorizonChannel(channel)
453
442
  _logger.info(f"{len(self._channels)} retrieved.")
454
443
 
444
+ def get_display_channels(self):
445
+ all_channels = self._channels.values()
446
+ if not self._profile_id or self._profile_id not in self.customer.profiles:
447
+ return all_channels
448
+ profile_channel_ids = self.customer.profiles[self._profile_id].favorite_channels
449
+ if len(profile_channel_ids) == 0:
450
+ return all_channels
451
+
452
+ return [
453
+ channel for channel in all_channels if channel.id in profile_channel_ids
454
+ ]
455
+
455
456
  def _get_replay_event(self, listingId) -> Any:
456
457
  """Get listing."""
457
458
  _logger.info("Retrieving replay event details...")
@@ -438,6 +438,9 @@ class LGHorizonBox:
438
438
  self.manufacturer = platform_type["manufacturer"]
439
439
  self.model = platform_type["model"]
440
440
 
441
+ def update_channels(self, channels: Dict[str, LGHorizonChannel]):
442
+ self._channels = channels
443
+
441
444
  def register_mqtt(self) -> None:
442
445
  if not self._mqtt_client.is_connected:
443
446
  raise Exception("MQTT client not connected.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lghorizon
3
- Version: 0.7.3b3
3
+ Version: 0.7.4
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