-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Android TV icon when screencap option is disabled #35710
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this isn't IO, wouldn't it be better to store timestamp in async_update() method? I'm mainly asking here to understand. As it is now you get different image hashes every call to this property. So from caching perspective this totally kills it.
I don't know. I just wanted to fix the issue that HA tries to display an entity picture when there isn't one (because the screencap option is off), and as a result the icon is not displayed. |
@elupus to expand a bit on my previous response, the screencap functionality was introduced in #33232, and with it came the |
I’ve tested this change and it works. Could this be cherry-picked for the next release? |
By returning the timestamp you are effectively disabling the caching. Is there a way to tell when the image is updated? |
That's a question for @i00. The screencap functionality was introduced in #33232. I'm not familiar with how HA handles the images that the integration retrieves, I just know that if you have the screencap option disabled then the |
@JeffLIrion Would you please fill out what the This also helps guide the reviewer as to what is changing here and give us an idea of the scope of the change. Please remove the |
@bdraco done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should look into getting rid of the timestamp here in a new PR as the cache exists for a reason.
Its outside of scope for a bugfix though.
@bdraco ... how is the cache a good thing for something that continually changes?... There are at least 2 different media player integrations (I know of) that require no image caching... so maybe this should be able to be disabled within MediaPlayerEntity? On another note, I have opened a frontend issue about the flickering (I use a custom media player card that does not flicker): |
…#35710) * Don't return a media image hash if the screencap config option is False * 1-liner
It looks like system was originally designed to display album artwork in #5754 and the hash gets generated here: https://github.com/postlund/pyatv/blob/master/pyatv/interface.py#L443 When we send a timestamp instead of a hash here its abusing the original design (not a problem until it is). It does work as you are expecting sans the flickering from the original design not expecting the update frequency or image size. We should probably change |
* Don't return a media image hash if the screencap config option is False * 1-liner
As I said 👍
Yes ... but this also occurs when the song advances and still doesn't look that pleasant when this does occur; and should be fixed regardless in the media cards; and on the "circular" entity previews. |
Proposed change
If the
screencap
option is disabled, then theMediaPlayerEntity.media_image_hash
should returnNone
because an image was not fetched. This fixes an issue where the media player's icon is not displayed because it is overridden by a nonexistent entity picture.Type of change
Example entry for
configuration.yaml
:# Example configuration.yaml
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale: