custom-cards / spotify-card

Spotify playlist card for Home Assistant card
Other
379 stars 61 forks source link

Hide all Spotify connect devices turns playlists to gray scale #158

Open wkethman opened 3 years ago

wkethman commented 3 years ago

I found that Spotify Connect was inconsistent and so I am using the "Known Spotify Connect devices" to specify my devices. If you specify a known device and it automatically finds it without Hiding all Spotify connect devices there will be duplicates. However, if you use the Hide all Spotify connect devices it turns the playlist icons to grayscale. See below. I guess an issue that I am correcting with this method is the inconsistency of Spotify Connect to display my sources. All of my sources are either Amazon Alexa devices or Speaker Groups connected with Alexa Media Player.

Screen Shot 2021-08-01 at 3 59 13 PM Screen Shot 2021-08-01 at 3 59 26 PM
fondberg commented 3 years ago

Right. Hmmm. If discovery of devices are buggy you should probably look that. I haven't got that much time nowadays for this card so hopefully someone can contribute to debugging and prepare a fix

kongo09 commented 2 years ago

My feeling is, the known_spotify_connect_devices are not counted towards the devices in the DeviceList. I figure that from line 628 in spotify-card.ts https://github.com/custom-cards/spotify-card/blob/4297715dc23ff7331b1cc266ce8c2c7c09dd89bc/src/spotify-card.ts#L628

The count is then used to determine if the class .grey-scale is applied to the <div id="#content" ...> in line 505, which makes the covers go grey. https://github.com/custom-cards/spotify-card/blob/4297715dc23ff7331b1cc266ce8c2c7c09dd89bc/src/spotify-card.ts#L505

This actually also the problem behind #171 as the visibility configuration internally is modelled by emptying the devices list, again resulting in a count of zero, which makes the covers grey. https://github.com/custom-cards/spotify-card/blob/4297715dc23ff7331b1cc266ce8c2c7c09dd89bc/src/spotify-card.ts#L308

The question is, what the target state is supposed to be? I would assume, the covers are only grey, if there are no devices, known or not, independently of the view configuration. The solution would probably be to introduce a separate function to count the devices independent of the device list.

kongo09 commented 2 years ago

My quick fix is actually very simple using card_mod:

  card_mod:
    style: |
      div#content {
        filter: none;
      }

It won't solve the problem but it'll make the covers look pretty again.