From 2d717a485d42e4b74996191b8780d43baf4064fd Mon Sep 17 00:00:00 2001 From: scanab <104446114+scanab@users.noreply.github.com> Date: Wed, 28 Dec 2022 18:01:36 +0100 Subject: [PATCH 1/3] Ajout des commandes contenant l'url de la pochette de l'album et du titre de l'album quand on lit une musique si disponible --- core/class/googlecast.class.php | 28 ++++++++++++++++++++++++++++ resources/googlecast.py | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/core/class/googlecast.class.php b/core/class/googlecast.class.php index f403798..0c43562 100644 --- a/core/class/googlecast.class.php +++ b/core/class/googlecast.class.php @@ -442,6 +442,34 @@ public function postSave() //$cmd->setDisplay('generic_type', 'GENERIC'); $cmd->save(); + $cmd = $this->getCmd(null, 'image'); + if (!is_object($cmd)) { + $cmd = new googlecastCmd(); + $cmd->setLogicalId('image'); + $cmd->setIsVisible(0); + $cmd->setName(__('Image', __FILE__)); + $cmd->setConfiguration('googlecast_cmd', true); + $cmd->setOrder($order++); + } + $cmd->setType('info'); + $cmd->setSubType('string'); + $cmd->setEqLogic_id($this->getId()); + $cmd->save(); + + $cmd = $this->getCmd(null, 'album_name'); + if (!is_object($cmd)) { + $cmd = new googlecastCmd(); + $cmd->setLogicalId('album_name'); + $cmd->setIsVisible(0); + $cmd->setName(__('Nom album', __FILE__)); + $cmd->setConfiguration('googlecast_cmd', true); + $cmd->setOrder($order++); + } + $cmd->setType('info'); + $cmd->setSubType('string'); + $cmd->setEqLogic_id($this->getId()); + $cmd->save(); + $cmd = $this->getCmd(null, 'title'); if (!is_object($cmd)) { $cmd = new googlecastCmd(); diff --git a/resources/googlecast.py b/resources/googlecast.py index 1f228a4..d3883a3 100644 --- a/resources/googlecast.py +++ b/resources/googlecast.py @@ -582,10 +582,16 @@ def _internal_send_now_playing_statusupdate(self, new_nowplaying): test_dif = True if test_dif is True: + if len(new_nowplaying.images) > 0: + img = str(new_nowplaying.images[0].url) + else: + img = None mediastatus = { "uuid": self.uuid, "title": '' if new_nowplaying.title is None else new_nowplaying.title, "artist": '' if new_nowplaying.artist is None else new_nowplaying.artist, + "album_name": '' if new_nowplaying.album_name is None else new_nowplaying.album_name, + "image": img, "series_title": '' if new_nowplaying.series_title is None else new_nowplaying.series_title, "player_state": '' if new_nowplaying.player_state is None else new_nowplaying.player_state, } From 1c2b57fedd47cc830de6547260cfc5befa21c645 Mon Sep 17 00:00:00 2001 From: scanab <104446114+scanab@users.noreply.github.com> Date: Wed, 28 Dec 2022 18:33:30 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Correction=20bug=20lors=20de=20l'arret=20de?= =?UTF-8?q?=20la=20musique=20qui=20faisait=20que=20l'url=20de=20la=20poche?= =?UTF-8?q?tte=20et=20le=20titre=20de=20l'album=20n'=C3=A9tait=20pas=20eff?= =?UTF-8?q?ac=C3=A9=20des=20commandes=20corresspondantes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/googlecast.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/googlecast.py b/resources/googlecast.py index d3883a3..1eddeb5 100644 --- a/resources/googlecast.py +++ b/resources/googlecast.py @@ -523,6 +523,10 @@ def _internal_get_status(self): if self.gcast.status is not None and self.online is True: uuid = self.uuid playStatus = self.gcast.media_controller.status + if len(playStatus.images) > 0: + img = str(playStatus.images[0].url) + else: + img = "" status = { "uuid": uuid, "uri": self.gcast.uri, "friendly_name": self.gcast.cast_info.friendly_name, @@ -536,6 +540,8 @@ def _internal_get_status(self): "status_text": self.gcast.status.status_text if self.gcast.status.status_text != "" else globals.DEFAULT_NOSTATUS, "is_busy": not self.gcast.is_idle, "title": "" if playStatus.title is None else playStatus.title, + "album_name": "" if playStatus.album_name is None else playStatus.album_name, + "image": img, "artist": "" if playStatus.artist is None else playStatus.artist, "series_title": "" if playStatus.series_title is None else playStatus.series_title, "stream_type": "" if playStatus.stream_type is None else playStatus.stream_type, @@ -585,7 +591,7 @@ def _internal_send_now_playing_statusupdate(self, new_nowplaying): if len(new_nowplaying.images) > 0: img = str(new_nowplaying.images[0].url) else: - img = None + img = "" mediastatus = { "uuid": self.uuid, "title": '' if new_nowplaying.title is None else new_nowplaying.title, From fbb334e7bd257a51ddf80e4b29e67d835c1177a6 Mon Sep 17 00:00:00 2001 From: scanab <104446114+scanab@users.noreply.github.com> Date: Wed, 28 Dec 2022 19:07:08 +0100 Subject: [PATCH 3/3] =?UTF-8?q?Petites=20corrections=20types=20g=C3=A9n?= =?UTF-8?q?=C3=A9riques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/class/googlecast.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/class/googlecast.class.php b/core/class/googlecast.class.php index 0c43562..94d9cba 100644 --- a/core/class/googlecast.class.php +++ b/core/class/googlecast.class.php @@ -186,12 +186,18 @@ public function postSave() { } */ + + public function preSave() { + $this->setGenericType('Multimedia'); + } + //public function postInsert() { public function postSave() { if ($this->_lightsave == true) { return true; } + $order = 1; $cmd = $this->getCmd(null, 'refresh'); @@ -232,6 +238,7 @@ public function postSave() $cmd->setType('info'); $cmd->setSubType('binary'); $cmd->setEqLogic_id($this->getId()); + $cmd->setGeneric_type('MEDIA_STATE'); $cmd->setDisplay('generic_type', 'ENERGY_STATE'); $cmd->save(); @@ -269,9 +276,8 @@ public function postSave() $cmd->setTemplate('dashboard', 'googlecast_busy'); $cmd->setType('info'); $cmd->setSubType('binary'); - $cmd->setEqLogic_id($this->getId()); - $cmd->setDisplay('generic_type', 'ENERGY_STATE'); + $cmd->setGeneric_type('MEDIA_STATE'); $cmd->save(); $cmd = $this->getCmd(null, 'volume_level');