devialet 1.4.2__tar.gz → 1.4.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.
devialet-1.4.4/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.2
3
+ Version: 1.4.4
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
10
  Keywords: Reolink,Home-Assistant
12
- Platform: UNKNOWN
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)
@@ -38,20 +38,18 @@ class DevialetApi:
38
38
  if self._general_info is None:
39
39
  self._general_info = await self.get_request(UrlSuffix.GET_GENERAL_INFO)
40
40
 
41
+ # Without general info the device has not been online yet
41
42
  if self._general_info is None:
42
43
  return False
43
44
 
45
+ self._source_state = await self.get_request(UrlSuffix.GET_CURRENT_SOURCE)
46
+ # the source state call if enough to find out if the device is available (On or Off)
44
47
  if not self._is_available:
45
- self._sources = None
48
+ return True
46
49
 
47
50
  if self._sources is None:
48
51
  self._sources = await self.get_request(UrlSuffix.GET_SOURCES)
49
52
 
50
- self._source_state = await self.get_request(UrlSuffix.GET_CURRENT_SOURCE)
51
-
52
- if self._source_state is None:
53
- return self._is_available
54
-
55
53
  self._volume = await self.get_request(UrlSuffix.GET_VOLUME)
56
54
  self._night_mode = await self.get_request(UrlSuffix.GET_NIGHT_MODE)
57
55
  self._equalizer = await self.get_request(UrlSuffix.GET_EQUALIZER)
@@ -173,8 +171,8 @@ class DevialetApi:
173
171
  if self.device_role in SPEAKER_POSITIONS and (
174
172
  source_type == "optical" or source_type == "opticaljack"
175
173
  ):
176
- # Stereo devices have the role FrontLeft or FrontRight. Add a suffix to the source to recognize the device.
177
- position = ""
174
+ # Stereo devices have the role FrontLeft or FrontRight.
175
+ # Add a suffix to the source to recognize the device.
178
176
  for role, position in SPEAKER_POSITIONS.items():
179
177
  if (device_id == self.device_id and role == self.device_role) or (
180
178
  device_id != self.device_id and role != self.device_role
@@ -261,20 +259,20 @@ class DevialetApi:
261
259
  for source in self._sources["sources"]:
262
260
  if source["sourceId"] == source_id and source["deviceId"] == device_id:
263
261
  source_type = source["type"]
262
+
263
+ if (
264
+ source_type == "optical" or source_type == "opticaljack"
265
+ ) and self.device_role in SPEAKER_POSITIONS:
266
+ for role, position in SPEAKER_POSITIONS.items():
267
+ if (device_id == self.device_id and role == self.device_role) or (
268
+ device_id != self.device_id and role != self.device_role
269
+ ):
270
+ source_type = source_type + "_" + position
271
+
264
272
  break
265
273
  except (KeyError, TypeError):
266
274
  return None
267
275
 
268
- position = ""
269
- if (
270
- source_type == "optical" or source_type == "opticaljack"
271
- ) and self.device_role in SPEAKER_POSITIONS:
272
- for role, position in SPEAKER_POSITIONS.items():
273
- if (device_id == self.device_id and role == self.device_role) or (
274
- device_id != self.device_id and role != self.device_role
275
- ):
276
- source_type = source_type + "_" + position
277
-
278
276
  return source_type
279
277
 
280
278
  @property
@@ -444,12 +442,12 @@ class DevialetApi:
444
442
  )
445
443
 
446
444
  response_json = json.loads(response)
445
+ self._is_available = True
447
446
 
448
447
  if "error" in response_json:
449
448
  LOGGER.debug(response_json["error"])
450
449
  return None
451
450
 
452
- self._is_available = True
453
451
  return response_json
454
452
 
455
453
  except aiohttp.ClientConnectorError as conn_err:
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.1
2
+ Name: devialet
3
+ Version: 1.4.4
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: Reolink,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,9 +3,11 @@ from distutils.core import setup
3
3
  setup(
4
4
  name='devialet',
5
5
  packages=['devialet'],
6
- version='1.4.2',
6
+ version='1.4.4',
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',
File without changes
File without changes