devialet 1.4.3__tar.gz → 1.4.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.
devialet-1.4.5/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 fwestenberg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,15 +1,13 @@
1
- Metadata-Version: 1.1
1
+ Metadata-Version: 2.1
2
2
  Name: devialet
3
- Version: 1.4.3
3
+ Version: 1.4.5
4
4
  Summary: Devialet API
5
5
  Home-page: https://github.com/fwestenberg/devialet
6
+ Download-URL: https://github.com/fwestenberg/devialet/releases/latest
6
7
  Author: fwestenberg
7
- Author-email: UNKNOWN
8
+ Author-email:
8
9
  License: MIT
9
- Download-URL: https://github.com/fwestenberg/devialet/releases/latest
10
- Description: UNKNOWN
11
- Keywords: Reolink,Home-Assistant
12
- Platform: UNKNOWN
10
+ Keywords: Devialet,Home-Assistant
13
11
  Classifier: Development Status :: 4 - Beta
14
12
  Classifier: Intended Audience :: Developers
15
13
  Classifier: Topic :: Software Development :: Build Tools
@@ -19,3 +17,8 @@ Classifier: Programming Language :: Python :: 3.6
19
17
  Classifier: Programming Language :: Python :: 3.7
20
18
  Classifier: Programming Language :: Python :: 3.8
21
19
  Classifier: Programming Language :: Python :: 3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: aiohttp
23
+
24
+ Devialet API
@@ -0,0 +1,4 @@
1
+ # Devialet
2
+ Devialet Home Assistant implementation
3
+
4
+ The Home Assistant integration has moved [here:](https://github.com/fwestenberg/homeassistant-devialet)
@@ -168,12 +168,12 @@ class DevialetApi:
168
168
  source_type = source["type"]
169
169
  device_id = source["deviceId"]
170
170
 
171
- if self.device_role in SPEAKER_POSITIONS and (
172
- source_type == "optical" or source_type == "opticaljack"
171
+ if self.device_role in SPEAKER_POSITIONS and source_type in (
172
+ "optical",
173
+ "opticaljack",
173
174
  ):
174
175
  # Stereo devices have the role FrontLeft or FrontRight.
175
176
  # Add a suffix to the source to recognize the device.
176
- position = ""
177
177
  for role, position in SPEAKER_POSITIONS.items():
178
178
  if (device_id == self.device_id and role == self.device_role) or (
179
179
  device_id != self.device_id and role != self.device_role
@@ -260,21 +260,21 @@ class DevialetApi:
260
260
  for source in self._sources["sources"]:
261
261
  if source["sourceId"] == source_id and source["deviceId"] == device_id:
262
262
  source_type = source["type"]
263
- break
263
+
264
+ if (
265
+ source_type == "optical" or source_type == "opticaljack"
266
+ ) and self.device_role in SPEAKER_POSITIONS:
267
+ for role, position in SPEAKER_POSITIONS.items():
268
+ if (
269
+ device_id == self.device_id and role == self.device_role
270
+ ) or (
271
+ device_id != self.device_id and role != self.device_role
272
+ ):
273
+ source_type = source_type + "_" + position
274
+ return source_type
264
275
  except (KeyError, TypeError):
265
276
  return None
266
-
267
- position = ""
268
- if (
269
- source_type == "optical" or source_type == "opticaljack"
270
- ) and self.device_role in SPEAKER_POSITIONS:
271
- for role, position in SPEAKER_POSITIONS.items():
272
- if (device_id == self.device_id and role == self.device_role) or (
273
- device_id != self.device_id and role != self.device_role
274
- ):
275
- source_type = source_type + "_" + position
276
-
277
- return source_type
277
+ return None
278
278
 
279
279
  @property
280
280
  def night_mode(self) -> bool | None:
@@ -371,7 +371,6 @@ class DevialetApi:
371
371
 
372
372
  async def async_set_equalizer(self, preset: str) -> None:
373
373
  """Set the equalizer preset."""
374
-
375
374
  await self.post_request(
376
375
  UrlSuffix.EQUALIZER,
377
376
  {"preset": preset},
@@ -395,24 +394,26 @@ class DevialetApi:
395
394
  name_split = name.split("_")
396
395
 
397
396
  for role, position in SPEAKER_POSITIONS.items():
398
- if position == name_split[1]:
399
- if role == self.device_role:
400
- for _source in self._sources["sources"]:
401
- if (
402
- _source["deviceId"] == self.device_id
403
- and _source["type"] == name_split[0]
404
- ):
405
- source_id = _source["sourceId"]
406
- break
407
- else:
408
- for _source in self._sources["sources"]:
409
- if (
410
- _source["deviceId"] != self.device_id
411
- and _source["type"] == name_split[0]
412
- ):
413
- source_id = _source["sourceId"]
414
- break
415
- break
397
+ if position != name_split[1]:
398
+ continue
399
+
400
+ if role == self.device_role:
401
+ for _source in self._sources["sources"]:
402
+ if (
403
+ _source["deviceId"] == self.device_id
404
+ and _source["type"] == name_split[0]
405
+ ):
406
+ source_id = _source["sourceId"]
407
+ break
408
+ else:
409
+ for _source in self._sources["sources"]:
410
+ if (
411
+ _source["deviceId"] != self.device_id
412
+ and _source["type"] == name_split[0]
413
+ ):
414
+ source_id = _source["sourceId"]
415
+ break
416
+ break
416
417
  else:
417
418
  for _source in self._sources["sources"]:
418
419
  if _source["type"] == name:
@@ -428,7 +429,6 @@ class DevialetApi:
428
429
 
429
430
  async def get_request(self, suffix=str) -> any | None:
430
431
  """Generic GET method."""
431
-
432
432
  url = "http://" + self._host + str(suffix)
433
433
 
434
434
  try:
@@ -470,7 +470,6 @@ class DevialetApi:
470
470
 
471
471
  async def post_request(self, suffix=str, body=str) -> any | None:
472
472
  """Generic POST method."""
473
-
474
473
  url = "http://" + self._host + str(suffix)
475
474
 
476
475
  try:
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.1
2
+ Name: devialet
3
+ Version: 1.4.5
4
+ Summary: Devialet API
5
+ Home-page: https://github.com/fwestenberg/devialet
6
+ Download-URL: https://github.com/fwestenberg/devialet/releases/latest
7
+ Author: fwestenberg
8
+ Author-email:
9
+ License: MIT
10
+ Keywords: Devialet,Home-Assistant
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Software Development :: Build Tools
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.6
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: aiohttp
23
+
24
+ Devialet API
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ setup.cfg
4
+ setup.py
5
+ devialet/__init__.py
6
+ devialet/const.py
7
+ devialet/devialet_api.py
8
+ devialet.egg-info/PKG-INFO
9
+ devialet.egg-info/SOURCES.txt
10
+ devialet.egg-info/dependency_links.txt
11
+ devialet.egg-info/requires.txt
12
+ devialet.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ aiohttp
@@ -0,0 +1 @@
1
+ devialet
@@ -1,2 +1,7 @@
1
1
  [metadata]
2
2
  description-file = README.md
3
+
4
+ [egg_info]
5
+ tag_build =
6
+ tag_date = 0
7
+
@@ -3,14 +3,16 @@ from distutils.core import setup
3
3
  setup(
4
4
  name='devialet',
5
5
  packages=['devialet'],
6
- version='1.4.3',
6
+ version='1.4.5',
7
7
  license='MIT',
8
8
  description='Devialet API',
9
+ long_description_content_type="text/markdown",
10
+ long_description='Devialet API',
9
11
  author='fwestenberg',
10
12
  author_email='',
11
13
  url='https://github.com/fwestenberg/devialet',
12
14
  download_url='https://github.com/fwestenberg/devialet/releases/latest',
13
- keywords=['Reolink', 'Home-Assistant'],
15
+ keywords=['Devialet', 'Home-Assistant'],
14
16
  install_requires=[
15
17
  'aiohttp'
16
18
  ],
File without changes
File without changes