Skip to content

Mediaplayer clementine remote#5877

Merged
pvizeli merged 2 commits into
home-assistant:devfrom
jjmontesl:mediaplayer-clementine-remote
Feb 16, 2017
Merged

Mediaplayer clementine remote#5877
pvizeli merged 2 commits into
home-assistant:devfrom
jjmontesl:mediaplayer-clementine-remote

Conversation

@jjmontesl
Copy link
Copy Markdown
Contributor

@jjmontesl jjmontesl commented Feb 11, 2017

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:

media_player:
  - platform: clementine
    host: 192.168.0.20

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable ([example][ex-requir]).
  • New dependencies are only imported inside functions that use them ([example][ex-import]).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

@mention-bot
Copy link
Copy Markdown

@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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

too many blank lines (2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (88 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

block comment should start with '# '

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

block comment should start with '# '

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (85 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

block comment should start with '# '

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

block comment should start with '# '

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (117 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

'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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

'requests.RequestException' imported but unused

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

indentation is not a multiple of four

@jjmontesl jjmontesl force-pushed the mediaplayer-clementine-remote branch from a1ee85c to 1edf5bb Compare February 12, 2017 20:58
@jjmontesl jjmontesl force-pushed the mediaplayer-clementine-remote branch from 1edf5bb to 55219ec Compare February 13, 2017 23:06
@jjmontesl jjmontesl force-pushed the mediaplayer-clementine-remote branch from 55219ec to 8b9b7c3 Compare February 13, 2017 23:48
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Order is alphanumeric

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove this and use add_device(..., True)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, it is add_devices. Description is in helpers/entity_component.py

Copy link
Copy Markdown
Contributor Author

@jjmontesl jjmontesl Feb 16, 2017

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Order is alphanumeric. Why do you import asyncio?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

    @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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see it, sorry

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can also use SCAN_INTERVAL with a timedelta to controll that witout Throttle. This is only for shared object usefully.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Could you please provide an example or develop a bit further?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But only SCAN_INTERVAL = timedelta(seconds=10) as constante in your code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

'homeassistant.util' imported but unused

@jjmontesl jjmontesl force-pushed the mediaplayer-clementine-remote branch from 27cc0ee to 5a7d765 Compare February 16, 2017 00:49
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'])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Your stay inside Event Loop. Your Access only of cached value? You can not access to a file or network resource on this Point.

@pvizeli
Copy link
Copy Markdown
Member

pvizeli commented Feb 16, 2017

Please read this #4210 and can you aprove that all property stuff are cached in your library?

@jjmontesl
Copy link
Copy Markdown
Contributor Author

jjmontesl commented Feb 16, 2017 via email

Copy link
Copy Markdown
Member

@pvizeli pvizeli left a comment

Choose a reason for hiding this comment

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

Ready to merge after test pass ⚡

@pvizeli pvizeli merged commit 714ba31 into home-assistant:dev Feb 16, 2017
@home-assistant home-assistant locked and limited conversation to collaborators May 19, 2017
@jjmontesl jjmontesl deleted the mediaplayer-clementine-remote branch June 14, 2017 01:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants