lghorizon 0.6.7__tar.gz → 0.6.9__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.6.7 → lghorizon-0.6.9}/PKG-INFO +1 -1
  2. lghorizon-0.6.9/lghorizon/const.py +143 -0
  3. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon/lghorizon_api.py +7 -5
  4. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon.egg-info/PKG-INFO +1 -1
  5. {lghorizon-0.6.7 → lghorizon-0.6.9}/test.py +6 -1
  6. lghorizon-0.6.7/lghorizon/const.py +0 -207
  7. {lghorizon-0.6.7 → lghorizon-0.6.9}/.coverage +0 -0
  8. {lghorizon-0.6.7 → lghorizon-0.6.9}/.flake8 +0 -0
  9. {lghorizon-0.6.7 → lghorizon-0.6.9}/.github/workflows/build-on-pr.yml +0 -0
  10. {lghorizon-0.6.7 → lghorizon-0.6.9}/.github/workflows/publish-to-pypi.yml +0 -0
  11. {lghorizon-0.6.7 → lghorizon-0.6.9}/.gitignore +0 -0
  12. {lghorizon-0.6.7 → lghorizon-0.6.9}/LICENSE +0 -0
  13. {lghorizon-0.6.7 → lghorizon-0.6.9}/README.md +0 -0
  14. {lghorizon-0.6.7 → lghorizon-0.6.9}/instructions.txt +0 -0
  15. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon/__init__.py +0 -0
  16. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon/exceptions.py +0 -0
  17. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon/helpers.py +0 -0
  18. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon/models.py +0 -0
  19. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon/py.typed +0 -0
  20. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon.egg-info/SOURCES.txt +0 -0
  21. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon.egg-info/dependency_links.txt +0 -0
  22. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon.egg-info/not-zip-safe +0 -0
  23. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon.egg-info/requires.txt +0 -0
  24. {lghorizon-0.6.7 → lghorizon-0.6.9}/lghorizon.egg-info/top_level.txt +0 -0
  25. {lghorizon-0.6.7 → lghorizon-0.6.9}/lib64 +0 -0
  26. {lghorizon-0.6.7 → lghorizon-0.6.9}/pyvenv.cfg +0 -0
  27. {lghorizon-0.6.7 → lghorizon-0.6.9}/secrets_stub.json +0 -0
  28. {lghorizon-0.6.7 → lghorizon-0.6.9}/setup.cfg +0 -0
  29. {lghorizon-0.6.7 → lghorizon-0.6.9}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lghorizon
3
- Version: 0.6.7
3
+ Version: 0.6.9
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
@@ -0,0 +1,143 @@
1
+ """Python client for LGHorizon."""
2
+ # flake8: noqa
3
+ # Box states
4
+ ONLINE_RUNNING = "ONLINE_RUNNING"
5
+ ONLINE_STANDBY = "ONLINE_STANDBY"
6
+ UNKNOWN = "UNKNOWN"
7
+
8
+ BOX_PLAY_STATE_CHANNEL = "linear"
9
+ BOX_PLAY_STATE_REPLAY = "replay"
10
+ BOX_PLAY_STATE_DVR = "nDVR"
11
+ BOX_PLAY_STATE_BUFFER = "reviewbuffer"
12
+ BOX_PLAY_STATE_APP = "app"
13
+ BOX_PLAY_STATE_VOD = "VOD"
14
+
15
+ # List with available media keys.
16
+ MEDIA_KEY_POWER = "Power"
17
+ MEDIA_KEY_ENTER = "Enter"
18
+ MEDIA_KEY_ESCAPE = "Escape" # Not yet implemented
19
+
20
+ MEDIA_KEY_HELP = "Help" # Not yet implemented
21
+ MEDIA_KEY_INFO = "Info" # Not yet implemented
22
+ MEDIA_KEY_GUIDE = "Guide" # Not yet implemented
23
+
24
+ MEDIA_KEY_CONTEXT_MENU = "ContextMenu" # Not yet implemented
25
+ MEDIA_KEY_CHANNEL_UP = "ChannelUp"
26
+ MEDIA_KEY_CHANNEL_DOWN = "ChannelDown"
27
+
28
+ MEDIA_KEY_RECORD = "MediaRecord"
29
+ MEDIA_KEY_PLAY_PAUSE = "MediaPlayPause"
30
+ MEDIA_KEY_STOP = "MediaStop"
31
+ MEDIA_KEY_REWIND = "MediaRewind"
32
+ MEDIA_KEY_FAST_FORWARD = "MediaFastForward"
33
+
34
+ RECORDING_TYPE_SINGLE = "single"
35
+ RECORDING_TYPE_SHOW = "show"
36
+ RECORDING_TYPE_SEASON = "season"
37
+
38
+ BE_AUTH_URL = "https://login.prd.telenet.be/openid/login.do"
39
+
40
+ COUNTRY_SETTINGS = {
41
+ "nl": {
42
+ "api_url": "https://prod.spark.ziggogo.tv",
43
+ "mqtt_url": "obomsg.prod.nl.horizon.tv",
44
+ "use_oauth": False,
45
+ "channels": [
46
+ {
47
+ "channelId": "NL_000073_019506",
48
+ "channelName": "Netflix",
49
+ "channelNumber": "150",
50
+ },
51
+ {
52
+ "channelId": "NL_000074_019507",
53
+ "channelName": "Videoland",
54
+ "channelNumber": "151",
55
+ },
56
+ {
57
+ "channelId": "NL_000194_019352",
58
+ "channelName": "NPO",
59
+ "channelNumber": "152",
60
+ },
61
+ {
62
+ "channelId": "NL_000199_019356",
63
+ "channelName": "Prime Video",
64
+ "channelNumber": "153",
65
+ },
66
+ ],
67
+ "platform_types": {
68
+ "EOS": {"manufacturer": "Arris", "model": "DCX960"},
69
+ "APOLLO": {"manufacturer": "Arris", "model": "VIP5002W"},
70
+ },
71
+ "language": "nl",
72
+ "use_legacy_auth": False,
73
+ },
74
+ "ch": {
75
+ "api_url": "https://prod.spark.sunrisetv.ch",
76
+ "use_oauth": False,
77
+ "channels": [],
78
+ "language": "de",
79
+ "use_legacy_auth": True,
80
+ },
81
+ "be-nl": {
82
+ "api_url": "https://spark-prod-be.gnp.cloud.telenet.tv",
83
+ "use_oauth": True,
84
+ "oauth_username_fieldname": "j_username",
85
+ "oauth_password_fieldname": "j_password",
86
+ "oauth_add_accept_header": False,
87
+ "oauth_url": "https://login.prd.telenet.be/openid/login.do",
88
+ "oauth_quote_login": False,
89
+ "oauth_redirect_header": "Location",
90
+ "channels": [
91
+ {"channelId": "netflix", "channelName": "Netflix", "channelNumber": "600"},
92
+ {"channelId": "youtube", "channelName": "Youtube", "channelNumber": "-1"},
93
+ ],
94
+ "platform_types": {
95
+ "EOS": {"manufacturer": "Arris", "model": "DCX960"},
96
+ "HORIZON": {"manufacturer": "Arris", "model": "DCX960"},
97
+ "EOS2": {"manufacturer": "HUMAX", "model": "2008C-STB-TN"},
98
+ },
99
+ "language": "nl",
100
+ "use_legacy_auth": False,
101
+ },
102
+ "be-nl-preprod": {
103
+ "api_url": "https://spark-preprod-be.gnp.cloud.telenet.tv",
104
+ "use_oauth": True,
105
+ "oauth_username_fieldname": "j_username",
106
+ "oauth_password_fieldname": "j_password",
107
+ "oauth_add_accept_header": False,
108
+ "oauth_url": "https://login.prd.telenet.be/openid/login.do",
109
+ "oauth_quote_login": False,
110
+ "oauth_redirect_header": "Location",
111
+ "channels": [
112
+ {"channelId": "netflix", "channelName": "Netflix", "channelNumber": "600"},
113
+ {"channelId": "youtube", "channelName": "Youtube", "channelNumber": "-1"},
114
+ ],
115
+ "use_legacy_auth": False,
116
+ },
117
+ "gb": {
118
+ "api_url": "https://spark-prod-gb.gnp.cloud.virgintvgo.virginmedia.com",
119
+ "oauth_url": "https://id.virginmedia.com/rest/v40/session/start?protocol=oidc&rememberMe=true",
120
+ "channels": [],
121
+ "oesp_url": "https://prod.oesp.virginmedia.com/oesp/v4/GB/eng/web",
122
+ "language": "en",
123
+ "use_legacy_auth": False,
124
+ },
125
+ "ie": {
126
+ "api_url": "https://spark-prod-ie.gnp.cloud.virginmediatv.ie",
127
+ "use_oauth": False,
128
+ "channels": [],
129
+ "language": "en",
130
+ "use_legacy_auth": False,
131
+ },
132
+ "pl": {
133
+ "api_url": "https://spark-prod-pl.gnp.cloud.upctv.pl",
134
+ "use_oauth": False,
135
+ "channels": [],
136
+ "language": "pl",
137
+ "platform_types": {
138
+ "EOS": {"manufacturer": "Arris", "model": "DCX960"},
139
+ "APOLLO": {"manufacturer": "Arris", "model": "VIP5002W"},
140
+ },
141
+ "use_legacy_auth": False,
142
+ }
143
+ }
@@ -79,9 +79,10 @@ class LGHorizonApi:
79
79
  backoff.expo, LGHorizonApiConnectionError, max_tries=3, logger=_logger
80
80
  )
81
81
  def _authorize(self) -> None:
82
- if self._country_code == "be-nl":
82
+ ctry_code = self._country_code[0:2]
83
+ if ctry_code == "be":
83
84
  self.authorize_telenet()
84
- elif self._country_code == "gb":
85
+ elif ctry_code == "gb":
85
86
  self.authorize_gb()
86
87
  else:
87
88
  self._authorize_default()
@@ -269,9 +270,10 @@ class LGHorizonApi:
269
270
 
270
271
  def _obtain_mqtt_token(self):
271
272
  _logger.debug("Obtain mqtt token...")
272
- mqtt_response = self._do_api_call(
273
- f"{self._config['authorizationService']['URL']}/v1/mqtt/token"
274
- )
273
+ mqtt_auth_url = self._config["authorizationService"]["URL"]
274
+ if self._country_settings["use_legacy_auth"]:
275
+ mqtt_auth_url = self._country_settings["api_url"] + "/auth-service"
276
+ mqtt_response = self._do_api_call(f"{mqtt_auth_url}/v1/mqtt/token")
275
277
  self._auth.mqttToken = mqtt_response["token"]
276
278
  _logger.debug(f"MQTT token: {self._auth.mqttToken}")
277
279
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lghorizon
3
- Version: 0.6.7
3
+ Version: 0.6.9
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
@@ -52,7 +52,12 @@ if __name__ == "__main__":
52
52
  try:
53
53
  secrets_file_path = "secrets.json"
54
54
  secrets = read_secrets(secrets_file_path)
55
- api = LGHorizonApi(secrets["username"], secrets["password"], secrets["country"])
55
+ api = LGHorizonApi(
56
+ secrets["username"],
57
+ secrets["password"],
58
+ secrets["country"],
59
+ # identifier="DTV3907048",
60
+ )
56
61
  api.connect()
57
62
  event_loop()
58
63
  except KeyboardInterrupt:
@@ -1,207 +0,0 @@
1
- """Python client for LGHorizon."""
2
- # flake8: noqa
3
- # Box states
4
- ONLINE_RUNNING = "ONLINE_RUNNING"
5
- ONLINE_STANDBY = "ONLINE_STANDBY"
6
- UNKNOWN = "UNKNOWN"
7
-
8
- BOX_PLAY_STATE_CHANNEL = "linear"
9
- BOX_PLAY_STATE_REPLAY = "replay"
10
- BOX_PLAY_STATE_DVR = "nDVR"
11
- BOX_PLAY_STATE_BUFFER = "reviewbuffer"
12
- BOX_PLAY_STATE_APP = "app"
13
- BOX_PLAY_STATE_VOD = "VOD"
14
-
15
- # List with available media keys.
16
- MEDIA_KEY_POWER = "Power"
17
- MEDIA_KEY_ENTER = "Enter"
18
- MEDIA_KEY_ESCAPE = "Escape" # Not yet implemented
19
-
20
- MEDIA_KEY_HELP = "Help" # Not yet implemented
21
- MEDIA_KEY_INFO = "Info" # Not yet implemented
22
- MEDIA_KEY_GUIDE = "Guide" # Not yet implemented
23
-
24
- MEDIA_KEY_CONTEXT_MENU = "ContextMenu" # Not yet implemented
25
- MEDIA_KEY_CHANNEL_UP = "ChannelUp"
26
- MEDIA_KEY_CHANNEL_DOWN = "ChannelDown"
27
-
28
- MEDIA_KEY_RECORD = "MediaRecord"
29
- MEDIA_KEY_PLAY_PAUSE = "MediaPlayPause"
30
- MEDIA_KEY_STOP = "MediaStop"
31
- MEDIA_KEY_REWIND = "MediaRewind"
32
- MEDIA_KEY_FAST_FORWARD = "MediaFastForward"
33
-
34
- RECORDING_TYPE_SINGLE = "single"
35
- RECORDING_TYPE_SHOW = "show"
36
- RECORDING_TYPE_SEASON = "season"
37
-
38
- BE_AUTH_URL = "https://login.prd.telenet.be/openid/login.do"
39
-
40
- COUNTRY_SETTINGS = {
41
- "nl": {
42
- "api_url": "https://prod.spark.ziggogo.tv",
43
- "mqtt_url": "obomsg.prod.nl.horizon.tv",
44
- "use_oauth": False,
45
- "channels": [
46
- {
47
- "channelId": "NL_000073_019506",
48
- "channelName": "Netflix",
49
- "channelNumber": "150",
50
- },
51
- {
52
- "channelId": "NL_000074_019507",
53
- "channelName": "Videoland",
54
- "channelNumber": "151",
55
- },
56
- {
57
- "channelId": "NL_000194_019352",
58
- "channelName": "NPO",
59
- "channelNumber": "152",
60
- },
61
- {
62
- "channelId": "NL_000199_019356",
63
- "channelName": "Prime Video",
64
- "channelNumber": "153",
65
- },
66
- ],
67
- "platform_types": {
68
- "EOS": {"manufacturer": "Arris", "model": "DCX960"},
69
- "APOLLO": {"manufacturer": "Arris", "model": "VIP5002W"},
70
- },
71
- "language": "nl",
72
- },
73
- "ch": {
74
- "api_url": "https://prod.spark.sunrisetv.ch",
75
- "use_oauth": False,
76
- "channels": [],
77
- "language": "de",
78
- },
79
- "be-nl": {
80
- "api_url": "https://spark-prod-be.gnp.cloud.telenet.tv",
81
- "use_oauth": True,
82
- "oauth_username_fieldname": "j_username",
83
- "oauth_password_fieldname": "j_password",
84
- "oauth_add_accept_header": False,
85
- "oauth_url": "https://login.prd.telenet.be/openid/login.do",
86
- "oauth_quote_login": False,
87
- "oauth_redirect_header": "Location",
88
- "channels": [
89
- {"channelId": "netflix", "channelName": "Netflix", "channelNumber": "600"},
90
- {"channelId": "youtube", "channelName": "Youtube", "channelNumber": "-1"},
91
- ],
92
- "platform_types": {
93
- "EOS": {"manufacturer": "Arris", "model": "DCX960"},
94
- "HORIZON": {"manufacturer": "Arris", "model": "DCX960"},
95
- "EOS2": {"manufacturer": "HUMAX", "model": "2008C-STB-TN"},
96
- },
97
- "language": "nl",
98
- },
99
- # "be-nl-preprod": {
100
- # "api_url": "https://web-api-preprod-obo.horizon.tv/oesp/v4/BE/nld/web",
101
- # "personalization_url_format": "https://preprod.spark.telenettv.be/nld/web/personalization-service/v1/customer/{household_id}/devices",
102
- # "mqtt_url": "obomsg.preprod.be.horizon.tv",
103
- # "use_oauth": True,
104
- # "oauth_username_fieldname": "j_username",
105
- # "oauth_password_fieldname": "j_password",
106
- # "oauth_add_accept_header": False,
107
- # "oauth_url": "https://login.prd.telenet.be/openid/login.do",
108
- # "oauth_quote_login": False,
109
- # "oauth_redirect_header": "Location",
110
- # "channels": [
111
- # {"channelId": "netflix", "channelName": "Netflix", "channelNumber": "600"},
112
- # {"channelId": "youtube", "channelName": "Youtube", "channelNumber": "-1"},
113
- # ],
114
- # },
115
- # "be-fr": {
116
- # "api_url": "https://web-api-prod-obo.horizon.tv/oesp/v4/BE/fr/web",
117
- # "personalization_url_format": "https://prod.spark.telenettv.be/fr/web/personalization-service/v1/customer/{household_id}/devices",
118
- # "mqtt_url": "obomsg.prod.be.horizon.tv",
119
- # "use_oauth": True,
120
- # "oauth_username_fieldname": "j_username",
121
- # "oauth_password_fieldname": "j_password",
122
- # "oauth_add_accept_header": False,
123
- # "oauth_url": "https://login.prd.telenet.be/openid/login.do",
124
- # "oauth_quote_login": False,
125
- # "oauth_redirect_header": "Location",
126
- # "channels": [],
127
- # },
128
- # "at": {
129
- # "api_url": "https://prod.spark.magentatv.at",
130
- # "personalization_url_format": "https://prod.spark.magentatv.at/deu/web/personalization-service/v1/customer/{householdId}/devices",
131
- # "mqtt_url": "obomsg.prod.at.horizon.tv",
132
- # "use_oauth": False,
133
- # "channels": [],
134
- # "language": "de",
135
- # },
136
- "gb": {
137
- "api_url": "https://spark-prod-gb.gnp.cloud.virgintvgo.virginmedia.com",
138
- "oauth_url": "https://id.virginmedia.com/rest/v40/session/start?protocol=oidc&rememberMe=true",
139
- "channels": [],
140
- "oesp_url": "https://prod.oesp.virginmedia.com/oesp/v4/GB/eng/web",
141
- "language": "en",
142
- },
143
- # "gb-preprod": {
144
- # "api_url": "https://web-api-preprod-obo.horizon.tv/oesp/v4/GB/eng/web/",
145
- # "personalization_url_format": "https://preprod.spark.virginmedia.com/eng/web/personalization-service/v1/customer/{household_id}/devices",
146
- # "mqtt_url": "obomsg.preprod.gb.horizon.tv",
147
- # "use_oauth": False,
148
- # "oauth_username_fieldname": "username",
149
- # "oauth_password_fieldname": "credential",
150
- # "oauth_add_accept_header": True,
151
- # "oauth_url": "https://id.virginmedia.com/rest/v40/session/start?protocol=oidc&rememberMe=true",
152
- # "oauth_quote_login": True,
153
- # "oauth_redirect_header": "x-redirect-location",
154
- # "channels": [],
155
- # },
156
- "ie": {
157
- "api_url": "https://spark-prod-ie.gnp.cloud.virginmediatv.ie",
158
- "use_oauth": False,
159
- "channels": [],
160
- "language": "en",
161
- },
162
- "pl": {
163
- "api_url": "https://spark-prod-pl.gnp.cloud.upctv.pl",
164
- "use_oauth": False,
165
- "channels": [],
166
- "language": "pl",
167
- "platform_types": {
168
- "EOS": {"manufacturer": "Arris", "model": "DCX960"},
169
- "APOLLO": {"manufacturer": "Arris", "model": "VIP5002W"},
170
- },
171
- },
172
- # "hu": {
173
- # "api_url": "https://web-api-pepper.horizon.tv/oesp/v4/HU/HUN/web",
174
- # "personalization_url_format": "https://prod.spark.upctv.hu/HUN/web/personalization-service/v1/customer/{householdId}/devices", # guessed
175
- # "mqtt_url": "obomsg.prod.hu.horizon.tv/mqtt",
176
- # "use_oauth": False,
177
- # "channels": [],
178
- # },
179
- # "de": {
180
- # "api_url": "https://web-api-pepper.horizon.tv/oesp/v4/DE/DEU/web",
181
- # "personalization_url_format": "https://prod.spark.upctv.de/DEU/web/personalization-service/v1/customer/{householdId}/devices", # guessed
182
- # "mqtt_url": "obomsg.prod.de.horizon.tv/mqtt",
183
- # "use_oauth": False,
184
- # "channels": [],
185
- # },
186
- # "cz": {
187
- # "api_url": "https://web-api-pepper.horizon.tv/oesp/v4/CZ/ces/web/",
188
- # "personalization_url_format": "https://prod.spark.upctv.cz/ces/web/personalization-service/v1/customer/{householdId}/devices", # guessed
189
- # "mqtt_url": "obomsg.prod.cz.horizon.tv/mqtt",
190
- # "use_oauth": False,
191
- # "channels": [],
192
- # },
193
- # "sk": {
194
- # "api_url": "https://web-api-pepper.horizon.tv/oesp/v4/sk/slk/web/",
195
- # "personalization_url_format": "https://prod.spark.upctv.sk/SLK/web/personalization-service/v1/customer/{householdId}/devices", # guessed
196
- # "mqtt_url": "obomsg.prod.sk.horizon.tv/mqtt",
197
- # "use_oauth": False,
198
- # "channels": [],
199
- # },
200
- # "ro": {
201
- # "api_url": "https://web-api-pepper.horizon.tv/oesp/v4/ro/ron/web/",
202
- # "personalization_url_format": "https://prod.spark.upctv.ro/ron/web/personalization-service/v1/customer/{householdId}/devices", # guessed
203
- # "mqtt_url": "obomsg.prod.ro.horizon.tv/mqtt",
204
- # "use_oauth": False,
205
- # "channels": [],
206
- # },
207
- }
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