small fixes for radio and chromecast status
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 1 Jun 2021 11:12:38 +0000 (13:12 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 1 Jun 2021 11:12:38 +0000 (13:12 +0200)
music_assistant/constants.py
music_assistant/helpers/process.py
music_assistant/managers/config.py
music_assistant/providers/chromecast/player.py

index c6b19ee2c62d6d268f7f2d95183f3c86f7b2a692..6574f9d99631bab563c1d5bd764ef9662340c690 100755 (executable)
@@ -1,6 +1,6 @@
 """All constants for Music Assistant."""
 
-__version__ = "0.1.8"
+__version__ = "0.1.9"
 REQUIRED_PYTHON_VER = "3.8"
 
 # configuration keys/attributes
index 853be329184cf0d4c7c9f12bda6360c1d305c336..27309da973c49968c6bf23195799a69a7601c445 100644 (file)
@@ -14,7 +14,7 @@ from async_timeout import timeout
 LOGGER = logging.getLogger("AsyncProcess")
 
 DEFAULT_CHUNKSIZE = 512000
-DEFAULT_TIMEOUT = 5
+DEFAULT_TIMEOUT = 60
 
 
 class AsyncProcess:
@@ -67,6 +67,8 @@ class AsyncProcess:
                 return await self._proc.stdout.readexactly(chunk_size)
         except asyncio.IncompleteReadError as err:
             return err.partial
+        except AttributeError:
+            raise asyncio.CancelledError()
 
     async def write(self, data: bytes) -> None:
         """Write data to process stdin."""
@@ -75,6 +77,8 @@ class AsyncProcess:
             await self._proc.stdin.drain()
         except BrokenPipeError:
             pass
+        except AttributeError:
+            raise asyncio.CancelledError()
 
     async def write_eof(self) -> None:
         """Write eof to process."""
index 53f2a9217158b2bfac6de7f1e5cd67d4aa1cb5e7..e3a52a140e34db90c749fead0034437ba25a5cf8 100755 (executable)
@@ -73,7 +73,7 @@ DEFAULT_PLAYER_CONFIG_ENTRIES = [
     ConfigEntry(
         entry_key=CONF_TARGET_VOLUME,
         entry_type=ConfigEntryType.INT,
-        range=(-30, 0),
+        range=(-40, 0),
         default_value=-23,
         label=CONF_TARGET_VOLUME,
         description="desc_target_volume",
index 7e36c71cb8f9c98588757f17817fb3e942a954f7..4d0db6d1006a240cfde48b2f9d882d695e48615d 100644 (file)
@@ -83,7 +83,10 @@ class ChromecastPlayer(Player):
                 or self.media_status.player_is_idle
             )
         # Chromecast does not support power so we (ab)use mute instead
-        return not self.cast_status.volume_muted
+        return (
+            not self.cast_status.display_name
+            or self.cast_status.display_name == "Default Media Receiver"
+        ) and not self.cast_status.volume_muted
 
     @property
     def should_poll(self) -> bool:
@@ -93,6 +96,8 @@ class ChromecastPlayer(Player):
     @property
     def state(self) -> PlaybackState:
         """Return the state of the player."""
+        if not self.powered:
+            return PlaybackState.Off
         if self.media_status is None:
             return PlaybackState.Stopped
         if self.media_status.player_is_playing: