Mediaplayer clementine remote#5877
Conversation
|
@jjmontesl, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @armills and @fabaff to be potential reviewers. |
There was a problem hiding this comment.
line too long (88 > 79 characters)
There was a problem hiding this comment.
block comment should start with '# '
There was a problem hiding this comment.
block comment should start with '# '
There was a problem hiding this comment.
line too long (85 > 79 characters)
There was a problem hiding this comment.
block comment should start with '# '
There was a problem hiding this comment.
block comment should start with '# '
There was a problem hiding this comment.
line too long (117 > 79 characters)
There was a problem hiding this comment.
'homeassistant.components.media_player.SUPPORT_TURN_OFF' imported but unused
'homeassistant.components.media_player.SUPPORT_VOLUME_MUTE' imported but unused
'homeassistant.components.media_player.MEDIA_TYPE_CHANNEL' imported but unused
There was a problem hiding this comment.
'requests.RequestException' imported but unused
cc84976 to
1b871d5
Compare
1b871d5 to
a1ee85c
Compare
There was a problem hiding this comment.
indentation is not a multiple of four
a1ee85c to
1edf5bb
Compare
1edf5bb to
55219ec
Compare
55219ec to
8b9b7c3
Compare
There was a problem hiding this comment.
Remove this and use add_device(..., True)
There was a problem hiding this comment.
I couldn't find the definition of add_device or add_devices (it's passed as an argument, didn't find where it is really defined). I just removed the update.
There was a problem hiding this comment.
Yeah, it is add_devices. Description is in helpers/entity_component.py
There was a problem hiding this comment.
Now I found it, thanks. For this I think it's better to defer the first update, so I leave it to False. Not a big deal, and possibly the component is not yet ready anyway (did not receive a complete initial update from Clementine).
There was a problem hiding this comment.
Order is alphanumeric. Why do you import asyncio?
There was a problem hiding this comment.
@asyncio.coroutine
def async_get_media_image(self):
"""Fetch media image of current playing image."""
This is a new method introduced by #5754 . The parent method has that signature, as it uses yield from asyncio idiom. Following your comment, I tried without @asyncio.coroutine, but it is needed.
There was a problem hiding this comment.
You can also use SCAN_INTERVAL with a timedelta to controll that witout Throttle. This is only for shared object usefully.
There was a problem hiding this comment.
Could you please provide an example or develop a bit further?
There was a problem hiding this comment.
But only SCAN_INTERVAL = timedelta(seconds=10) as constante in your code.
There was a problem hiding this comment.
Understood. I wonder if there is a lower level introduction I missed. I'll go and review the docs anyway. I have used a smaller interval, because updating this component does not involve any network access.
8b9b7c3 to
cbc3c38
Compare
cbc3c38 to
27cc0ee
Compare
There was a problem hiding this comment.
'homeassistant.util' imported but unused
27cc0ee to
5a7d765
Compare
| def async_get_media_image(self): | ||
| """Fetch media image of current playing image.""" | ||
| if self._client.current_track: | ||
| image = bytes(self._client.current_track['art']) |
There was a problem hiding this comment.
Your stay inside Event Loop. Your Access only of cached value? You can not access to a file or network resource on this Point.
|
Please read this #4210 and can you aprove that all property stuff are cached in your library? |
|
Yes, I'm aware of that. Everything is in variables, in-memory. No I/O of
any kind is performed, and all the accesses are thread safe. In fact, a
future version of this component could be made entirely async, because the
Clementine remote protocol allows for it, but this should be safe for now.
I also have been testing it for several days now.
|
pvizeli
left a comment
There was a problem hiding this comment.
Ready to merge after test pass ⚡
Description:
Adds support for Clementine Music Player (https://www.clementine-player.org) as media player. Includes album art, volume management, and playlist selection.
Pull request in home-assistant.github.io with documentation (if applicable):
home-assistant/home-assistant.io#2007
Example entry for
configuration.yaml:Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable ([example][ex-requir]).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.