Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
androidtvremote2==0.2.1
ucapi==0.3.1
androidtvremote2==0.2.3
ucapi==0.3.2
pyee~=13.0.0
google_play_scraper==1.2.7
pillow>=11.2.1
requests>=2.32
pychromecast~=14.0.7
pychromecast~=14.0.9
httpx~=0.28.1
sanitize-filename~=1.2.0
6 changes: 4 additions & 2 deletions src/tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,9 @@ async def _apply_current_app_metadata(self, current_app: str) -> dict:
else:
icon_to_use = ""
elif self._media_image_url:
icon_to_use = await encode_icon_to_data_uri(self._media_image_url)
# TODO what's the intended logic?
# `icon_to_use` is never used because of the inverse `if not self._media_image_url:` check below!
icon_to_use = self._media_image_url

update[MediaAttr.STATE] = media_player.States.PLAYING.value
# Skip applying app icon if media image from cast is present
Expand Down Expand Up @@ -911,7 +913,7 @@ async def _handle_new_media_status(self, status: MediaStatus):

if status.images and len(status.images) > 0 and status.images[0].url != self._media_image_url:
self._media_image_url = status.images[0].url
update[MediaAttr.MEDIA_IMAGE_URL] = await encode_icon_to_data_uri(self._media_image_url)
update[MediaAttr.MEDIA_IMAGE_URL] = self._media_image_url
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense and removes quite a bit of overhead. As the name implies, this should be an URL and usually the UI app will download and resize the image.
A base64 encoding should only be used for local images that he UI app cannot access. For example the app icons or the homescreen icon.

There's one more reference where the image URL is set in _apply_current_app_metadata on line 670:
However, the encoded image in icon_to_use is never applied with the inverse if not self._media_image_url logic:

        elif self._media_image_url:
            icon_to_use = await encode_icon_to_data_uri(self._media_image_url)
        update[MediaAttr.STATE] = media_player.States.PLAYING.value
        # Skip applying app icon if media image from cast is present
        if not self._media_image_url:
            if not icon_to_use:
                update[MediaAttr.MEDIA_IMAGE_URL] = HOMESCREEN_IMAGE
            else:
                update[MediaAttr.MEDIA_IMAGE_URL] = icon_to_use

For consistency reasons I'll update it in this PR. It needs to be checked later what the correct logic should be: either be removed, because it's not needed, or fixed if the media image must be set as a fallback.

self._use_app_url = False
else:
self._media_image_url = None
Expand Down