Add timestamp to lg_netcast media_image_url to update image correctly (#30933)

* add timestamp to media_image_url to update image correctly

* applying isort on source

* apply black formatting on source

* using f strings in media_image_url property

* remove unnecessary casting
This commit is contained in:
Laszlo Jakab 2020-02-16 23:26:41 +01:00 committed by GitHub
parent 2516b9474d
commit 1d5d56faf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
"""Support for LG TV running on NetCast 3 or 4."""
from datetime import timedelta
from datetime import datetime, timedelta
import logging
from pylgnetcast import LgNetCastClient, LgNetCastError
@ -199,7 +199,9 @@ class LgTVDevice(MediaPlayerDevice):
@property
def media_image_url(self):
"""URL for obtaining a screen capture."""
return self._client.url + "data?target=screen_image"
return (
f"{self._client.url}data?target=screen_image&_={datetime.now().timestamp()}"
)
def turn_off(self):
"""Turn off media player."""