Add Media Player Stop command + Kodi support for it (#1960)
* Started adding Stop command to Kodi media player * minor * minor * minor * abstract-method fixed
This commit is contained in:
parent
e5d1ed9439
commit
393bd88091
5 changed files with 42 additions and 4 deletions
|
@ -9,7 +9,7 @@ import urllib
|
|||
|
||||
from homeassistant.components.media_player import (
|
||||
SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_PREVIOUS_TRACK, SUPPORT_SEEK,
|
||||
SUPPORT_PLAY_MEDIA, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET,
|
||||
SUPPORT_PLAY_MEDIA, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, SUPPORT_STOP,
|
||||
MediaPlayerDevice)
|
||||
from homeassistant.const import (
|
||||
STATE_IDLE, STATE_OFF, STATE_PAUSED, STATE_PLAYING)
|
||||
|
@ -19,7 +19,7 @@ REQUIREMENTS = ['jsonrpc-requests==0.2']
|
|||
|
||||
SUPPORT_KODI = SUPPORT_PAUSE | SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
|
||||
SUPPORT_PREVIOUS_TRACK | SUPPORT_NEXT_TRACK | SUPPORT_SEEK | \
|
||||
SUPPORT_PLAY_MEDIA
|
||||
SUPPORT_PLAY_MEDIA | SUPPORT_STOP
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
|
@ -229,6 +229,13 @@ class KodiDevice(MediaPlayerDevice):
|
|||
"""Pause the media player."""
|
||||
self._set_play_state(False)
|
||||
|
||||
def media_stop(self):
|
||||
"""Stop the media player."""
|
||||
players = self._get_players()
|
||||
|
||||
if len(players) != 0:
|
||||
self._server.Player.Stop(players[0]['playerid'])
|
||||
|
||||
def _goto(self, direction):
|
||||
"""Helper method used for previous/next track."""
|
||||
players = self._get_players()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue