PyChromecast 14.0.7__tar.gz → 14.0.10__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 (49) hide show
  1. {pychromecast-14.0.7 → pychromecast-14.0.10}/PKG-INFO +1 -1
  2. {pychromecast-14.0.7 → pychromecast-14.0.10}/PyChromecast.egg-info/PKG-INFO +1 -1
  3. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/__init__.py +1 -1
  4. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/const.py +22 -17
  5. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/media.py +3 -3
  6. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/receiver.py +2 -2
  7. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/discovery.py +1 -1
  8. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/error.py +4 -0
  9. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/models.py +1 -0
  10. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/socket_client.py +12 -4
  11. {pychromecast-14.0.7 → pychromecast-14.0.10}/pyproject.toml +9 -4
  12. {pychromecast-14.0.7 → pychromecast-14.0.10}/requirements.txt +1 -1
  13. {pychromecast-14.0.7 → pychromecast-14.0.10}/LICENSE +0 -0
  14. {pychromecast-14.0.7 → pychromecast-14.0.10}/MANIFEST.in +0 -0
  15. {pychromecast-14.0.7 → pychromecast-14.0.10}/PyChromecast.egg-info/SOURCES.txt +0 -0
  16. {pychromecast-14.0.7 → pychromecast-14.0.10}/PyChromecast.egg-info/dependency_links.txt +0 -0
  17. {pychromecast-14.0.7 → pychromecast-14.0.10}/PyChromecast.egg-info/not-zip-safe +0 -0
  18. {pychromecast-14.0.7 → pychromecast-14.0.10}/PyChromecast.egg-info/requires.txt +0 -0
  19. {pychromecast-14.0.7 → pychromecast-14.0.10}/PyChromecast.egg-info/top_level.txt +0 -0
  20. {pychromecast-14.0.7 → pychromecast-14.0.10}/README.rst +0 -0
  21. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/config.py +0 -0
  22. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/__init__.py +0 -0
  23. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/bbciplayer.py +0 -0
  24. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/bbcsounds.py +0 -0
  25. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/bubbleupnp.py +0 -0
  26. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/dashcast.py +0 -0
  27. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/heartbeat.py +0 -0
  28. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/homeassistant.py +0 -0
  29. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/homeassistant_media.py +0 -0
  30. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/multizone.py +0 -0
  31. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/nrkradio.py +0 -0
  32. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/nrktv.py +0 -0
  33. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/plex.py +0 -0
  34. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/shaka.py +0 -0
  35. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/supla.py +0 -0
  36. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/yleareena.py +0 -0
  37. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/controllers/youtube.py +0 -0
  38. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/dial.py +0 -0
  39. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/generated/authority_keys_pb2.py +0 -0
  40. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/generated/authority_keys_pb2.pyi +0 -0
  41. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/generated/cast_channel_pb2.py +0 -0
  42. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/generated/cast_channel_pb2.pyi +0 -0
  43. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/generated/logging_pb2.py +0 -0
  44. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/generated/logging_pb2.pyi +0 -0
  45. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/generated/readme.txt +0 -0
  46. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/py.typed +0 -0
  47. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/quick_play.py +0 -0
  48. {pychromecast-14.0.7 → pychromecast-14.0.10}/pychromecast/response_handler.py +0 -0
  49. {pychromecast-14.0.7 → pychromecast-14.0.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyChromecast
3
- Version: 14.0.7
3
+ Version: 14.0.10
4
4
  Summary: Python module to talk to Google Chromecast.
5
5
  Author-email: Paulus Schoutsen <paulus@paulusschoutsen.nl>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyChromecast
3
- Version: 14.0.7
3
+ Version: 14.0.10
4
4
  Summary: Python module to talk to Google Chromecast.
5
5
  Author-email: Paulus Schoutsen <paulus@paulusschoutsen.nl>
6
6
  License: MIT
@@ -371,7 +371,7 @@ class Chromecast(CastStatusListener):
371
371
  or self.app_id in (None, IDLE_APP_ID)
372
372
  or (
373
373
  self.cast_type == CAST_TYPE_CHROMECAST
374
- and not self.status.is_active_input
374
+ and self.status.is_active_input is False
375
375
  and not self.ignore_cec
376
376
  )
377
377
  )
@@ -29,6 +29,9 @@ MF_VIZIO = "Vizio"
29
29
  MF_WNC = "wnc"
30
30
  MF_XIAOMI = "Xiaomi"
31
31
 
32
+ # Map model names to cast types and manufacturers
33
+ # Note: The keys should be in lowercase to ensure case-insensitive matching
34
+ # when checking against device names.
32
35
  CAST_TYPES = {
33
36
  "chromecast audio": (CAST_TYPE_AUDIO, MF_GOOGLE),
34
37
  "chromecast": (CAST_TYPE_CHROMECAST, MF_GOOGLE),
@@ -45,27 +48,29 @@ CAST_TYPES = {
45
48
  "nest wifi point": (CAST_TYPE_AUDIO, MF_GOOGLE),
46
49
  "bravia 4k vh2": (CAST_TYPE_CHROMECAST, MF_SONY),
47
50
  "bravia 4k vh21": (CAST_TYPE_CHROMECAST, MF_SONY),
48
- "Bose Smart Ultra Soundbar": (CAST_TYPE_AUDIO, MF_BOSE),
49
- "C4A": (CAST_TYPE_AUDIO, MF_SONY),
50
- "JBL Link 10": (CAST_TYPE_AUDIO, MF_JBL),
51
- "JBL Link 20": (CAST_TYPE_AUDIO, MF_JBL),
52
- "JBL Link 300": (CAST_TYPE_AUDIO, MF_JBL),
53
- "JBL Link 500": (CAST_TYPE_AUDIO, MF_JBL),
54
- "JBL Link Portable": (CAST_TYPE_AUDIO, MF_HARMAN),
51
+ "bose smart ultra soundbar": (CAST_TYPE_AUDIO, MF_BOSE),
52
+ "c4a": (CAST_TYPE_AUDIO, MF_SONY),
53
+ "jbl link 10": (CAST_TYPE_AUDIO, MF_JBL),
54
+ "jbl link 20": (CAST_TYPE_AUDIO, MF_JBL),
55
+ "jbl link 300": (CAST_TYPE_AUDIO, MF_JBL),
56
+ "jbl link 500": (CAST_TYPE_AUDIO, MF_JBL),
57
+ "jbl link portable": (CAST_TYPE_AUDIO, MF_HARMAN),
55
58
  "lenovocd-24502f": (CAST_TYPE_AUDIO, MF_LENOVO),
56
- "Lenovo Smart Display 7": (CAST_TYPE_CHROMECAST, MF_LENOVO),
57
- "LG WK7 ThinQ Speaker": (CAST_TYPE_AUDIO, MF_LG),
59
+ "lenovo smart display 7": (CAST_TYPE_CHROMECAST, MF_LENOVO),
60
+ "lenovo smart display 10": (CAST_TYPE_CHROMECAST, MF_LENOVO),
61
+ "lg wk7 thinq speaker": (CAST_TYPE_AUDIO, MF_LG),
58
62
  "marshall stanmore ii": (CAST_TYPE_AUDIO, MF_MARSHALL),
59
63
  "mitv-mssp2": (CAST_TYPE_CHROMECAST, MF_XIAOMI),
60
- "Pioneer VSX-831": (CAST_TYPE_AUDIO, MF_PIONEER),
61
- "Pioneer VSX-1131": (CAST_TYPE_AUDIO, MF_PIONEER),
62
- "Pioneer VSX-LX305": (CAST_TYPE_AUDIO, MF_PIONEER),
64
+ "pioneer vsx-831": (CAST_TYPE_AUDIO, MF_PIONEER),
65
+ "pioneer vsx-1131": (CAST_TYPE_AUDIO, MF_PIONEER),
66
+ "pioneer vsx-lx305": (CAST_TYPE_AUDIO, MF_PIONEER),
63
67
  "shield android tv": (CAST_TYPE_CHROMECAST, MF_NVIDIA),
64
- "Smart Soundbar 10": (CAST_TYPE_AUDIO, MF_CANTON),
65
- "Stream TV": (CAST_TYPE_CHROMECAST, MF_WNC),
66
- "SVS Pro SoundBase": (CAST_TYPE_AUDIO, MF_SVS),
67
- "TPM191E": (CAST_TYPE_CHROMECAST, MF_PHILIPS),
68
- "V705-H3": (CAST_TYPE_CHROMECAST, MF_VIZIO),
68
+ "smart soundbar 10": (CAST_TYPE_AUDIO, MF_CANTON),
69
+ "stream tv": (CAST_TYPE_CHROMECAST, MF_WNC),
70
+ "svs pro soundbase": (CAST_TYPE_AUDIO, MF_SVS),
71
+ "tpm191e": (CAST_TYPE_CHROMECAST, MF_PHILIPS),
72
+ "v705-h3": (CAST_TYPE_CHROMECAST, MF_VIZIO),
73
+ "d24f-j09": (CAST_TYPE_CHROMECAST, MF_VIZIO),
69
74
  }
70
75
 
71
76
 
@@ -4,7 +4,7 @@ on the Chromecast.
4
4
  """
5
5
 
6
6
  import abc
7
- from datetime import datetime
7
+ from datetime import datetime, timezone
8
8
  from dataclasses import dataclass
9
9
  import logging
10
10
  import threading
@@ -153,7 +153,7 @@ class MediaStatus:
153
153
  return (
154
154
  self.current_time
155
155
  + self.playback_rate
156
- * (datetime.utcnow() - self.last_updated).total_seconds()
156
+ * (datetime.now(timezone.utc) - self.last_updated).total_seconds()
157
157
  )
158
158
  # Not playing, return last reported seek time
159
159
  return self.current_time
@@ -336,7 +336,7 @@ class MediaStatus:
336
336
  self.current_subtitle_tracks = status_data.get(
337
337
  "activeTrackIds", self.current_subtitle_tracks
338
338
  )
339
- self.last_updated = datetime.utcnow()
339
+ self.last_updated = datetime.now(timezone.utc)
340
340
 
341
341
  def __repr__(self) -> str:
342
342
  info = {
@@ -286,8 +286,8 @@ class ReceiverController(BaseController):
286
286
  is_audio = cast_type in (CAST_TYPE_AUDIO, CAST_TYPE_GROUP)
287
287
 
288
288
  status = CastStatus(
289
- data.get("isActiveInput", None if is_audio else False),
290
- data.get("isStandBy", None if is_audio else True),
289
+ status_data.get("isActiveInput"),
290
+ status_data.get("isStandBy", None if is_audio else True),
291
291
  volume_data.get("level", 1.0),
292
292
  volume_data.get("muted", False),
293
293
  app_data.get(APP_ID),
@@ -121,7 +121,7 @@ class ZeroConfListener(zeroconf.ServiceListener):
121
121
  _LOGGER.debug("remove_service %s, %s", type_, name)
122
122
  cast_info = None
123
123
  device_removed = False
124
- uuid = None
124
+ uuid: UUID
125
125
  service_info = MDNSServiceInfo(name)
126
126
  # Lock because the HostBrowser may also add or remove items
127
127
  with self._services_lock:
@@ -11,6 +11,10 @@ class ChromecastConnectionError(PyChromecastError):
11
11
  """When a connection error occurs within PyChromecast."""
12
12
 
13
13
 
14
+ class ChromecastConnectionClosed(PyChromecastError):
15
+ """When a connection was closed by remote device."""
16
+
17
+
14
18
  class PyChromecastStopped(PyChromecastError):
15
19
  """Raised when a command is invoked while the Chromecast's socket_client
16
20
  is stopped.
@@ -10,6 +10,7 @@ from uuid import UUID
10
10
 
11
11
  import zeroconf
12
12
 
13
+ # pylint: disable=invalid-name
13
14
  ZEROCONF_ERRORS: tuple[type[Exception], ...] = (IOError, asyncio.TimeoutError)
14
15
  if hasattr(zeroconf, "EventLoopBlocked"):
15
16
  # Added in zeroconf 0.37.0
@@ -33,6 +33,7 @@ from .controllers.receiver import CastStatus, CastStatusListener, ReceiverContro
33
33
  from .dial import get_host_from_service
34
34
  from .error import (
35
35
  ChromecastConnectionError,
36
+ ChromecastConnectionClosed,
36
37
  ControllerNotRegistered,
37
38
  NotConnected,
38
39
  PyChromecastStopped,
@@ -267,9 +268,7 @@ class SocketClient(threading.Thread, CastStatusListener):
267
268
  retry["delay"] = min(retry["delay"] * 2, 300)
268
269
  retries[service] = retry
269
270
 
270
- while not self.stop.is_set() and (
271
- tries is None or tries > 0
272
- ): # pylint:disable=too-many-nested-blocks
271
+ while not self.stop.is_set() and (tries is None or tries > 0):
273
272
  # Prune retries dict
274
273
  retries = {
275
274
  key: retries[key]
@@ -619,6 +618,15 @@ class SocketClient(threading.Thread, CastStatusListener):
619
618
  if self.stop.is_set():
620
619
  return 1
621
620
  raise
621
+ except ChromecastConnectionClosed as exc:
622
+ self._force_recon = True
623
+ self.logger.debug(
624
+ "[%s(%s):%s] %s",
625
+ self.fn or "",
626
+ self.host,
627
+ self.port,
628
+ exc,
629
+ )
622
630
  except socket.error as exc:
623
631
  self._force_recon = True
624
632
  self.logger.error(
@@ -817,7 +825,7 @@ class SocketClient(threading.Thread, CastStatusListener):
817
825
  try:
818
826
  chunk = self.socket.recv(min(msglen - bytes_recd, 2048))
819
827
  if chunk == b"":
820
- raise socket.error("socket connection broken")
828
+ raise ChromecastConnectionClosed("Connection was closed by remote")
821
829
  chunks.append(chunk)
822
830
  bytes_recd += len(chunk)
823
831
  except TimeoutError:
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
- requires = ["setuptools>=65.6,<78.0", "wheel>=0.37.1,<0.46.0"]
2
+ requires = ["setuptools>=65.6,<83.0", "wheel>=0.37.1,<0.47.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PyChromecast"
7
- version = "14.0.7"
7
+ version = "14.0.10"
8
8
  license = {text = "MIT"}
9
9
  description = "Python module to talk to Google Chromecast."
10
10
  readme = "README.rst"
@@ -30,8 +30,8 @@ classifiers=[
30
30
  [project.urls]
31
31
  "Homepage" = "https://github.com/home-assistant-libs/pychromecast"
32
32
 
33
- [tool.black]
34
- exclude = 'pb2'
33
+ [tool.ruff]
34
+ exclude = ['*_pb2.*']
35
35
 
36
36
  [tool.rstcheck]
37
37
  # README.rst has embedded python examples which show the interactive interpreter output
@@ -48,3 +48,8 @@ include = ["pychromecast*"]
48
48
 
49
49
  [tool.setuptools.package-data]
50
50
  "*" = ["py.typed"]
51
+
52
+ [dependency-groups]
53
+ dev = [
54
+ "pre-commit>=4.5.0",
55
+ ]
@@ -1,3 +1,3 @@
1
1
  casttube==0.2.1
2
2
  protobuf==5.29.3
3
- zeroconf==0.146.1
3
+ zeroconf==0.148.0
File without changes
File without changes
File without changes