Update docstring (config file) and attempt to honor PEP0257 more
This commit is contained in:
parent
f9cecdee28
commit
1d910f3a84
5 changed files with 15 additions and 19 deletions
|
@ -1,7 +1,6 @@
|
||||||
"""
|
"""
|
||||||
homeassistant.components.media_player.chromecast
|
homeassistant.components.media_player.chromecast
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Provides functionality to interact with Cast devices on the network.
|
Provides functionality to interact with Cast devices on the network.
|
||||||
|
|
||||||
WARNING: This platform is currently not working due to a changed Cast API
|
WARNING: This platform is currently not working due to a changed Cast API
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
"""
|
"""
|
||||||
homeassistant.components.media_player.demo
|
homeassistant.components.media_player.demo
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Demo implementation of the media player.
|
Demo implementation of the media player.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_PLAYING, STATE_PAUSED, STATE_OFF)
|
STATE_PLAYING, STATE_PAUSED, STATE_OFF)
|
||||||
|
|
|
@ -6,7 +6,7 @@ Provides an interface to the XBMC/Kodi JSON-RPC API
|
||||||
Configuration:
|
Configuration:
|
||||||
|
|
||||||
To use the Kodi you will need to add something like the following to
|
To use the Kodi you will need to add something like the following to
|
||||||
your config/configuration.yaml.
|
your configuration.yaml file.
|
||||||
|
|
||||||
media_player:
|
media_player:
|
||||||
platform: kodi
|
platform: kodi
|
||||||
|
@ -74,7 +74,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
||||||
|
|
||||||
def _get_image_url(kodi_url):
|
def _get_image_url(kodi_url):
|
||||||
""" Helper function that parses the thumbnail URLs used by Kodi """
|
""" Helper function that parses the thumbnail URLs used by Kodi. """
|
||||||
url_components = urllib.parse.urlparse(kodi_url)
|
url_components = urllib.parse.urlparse(kodi_url)
|
||||||
|
|
||||||
if url_components.scheme == 'image':
|
if url_components.scheme == 'image':
|
||||||
|
@ -235,7 +235,7 @@ class KodiDevice(MediaPlayerDevice):
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
|
|
||||||
def _set_play_state(self, state):
|
def _set_play_state(self, state):
|
||||||
""" Helper method for play/pause/toggle """
|
""" Helper method for play/pause/toggle. """
|
||||||
players = self._get_players()
|
players = self._get_players()
|
||||||
|
|
||||||
if len(players) != 0:
|
if len(players) != 0:
|
||||||
|
@ -256,7 +256,7 @@ class KodiDevice(MediaPlayerDevice):
|
||||||
self._set_play_state(False)
|
self._set_play_state(False)
|
||||||
|
|
||||||
def _goto(self, direction):
|
def _goto(self, direction):
|
||||||
""" Helper method used for previous/next track """
|
""" Helper method used for previous/next track. """
|
||||||
players = self._get_players()
|
players = self._get_players()
|
||||||
|
|
||||||
if len(players) != 0:
|
if len(players) != 0:
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
"""
|
"""
|
||||||
homeassistant.components.media_player.mpd
|
homeassistant.components.media_player.mpd
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Provides functionality to interact with a Music Player Daemon.
|
Provides functionality to interact with a Music Player Daemon.
|
||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
|
|
||||||
To use MPD you will need to add something like the following to your
|
To use MPD you will need to add something like the following to your
|
||||||
config/configuration.yaml
|
configuration.yaml file.
|
||||||
|
|
||||||
media_player:
|
media_player:
|
||||||
platform: mpd
|
platform: mpd
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
"""
|
"""
|
||||||
homeassistant.components.media_player.squeezebox
|
homeassistant.components.media_player.squeezebox
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Provides an interface to the Logitech SqueezeBox API
|
Provides an interface to the Logitech SqueezeBox API
|
||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
|
|
||||||
To use SqueezeBox add something like this to your configuration:
|
To use SqueezeBox add something something like the following to your
|
||||||
|
configuration.yaml file.
|
||||||
|
|
||||||
media_player:
|
media_player:
|
||||||
platform: squeezebox
|
platform: squeezebox
|
||||||
|
@ -19,19 +19,19 @@ Variables:
|
||||||
|
|
||||||
host
|
host
|
||||||
*Required
|
*Required
|
||||||
The host name or address of the Logitech Media Server
|
The host name or address of the Logitech Media Server.
|
||||||
|
|
||||||
port
|
port
|
||||||
*Optional
|
*Optional
|
||||||
Telnet port to Logitech Media Server, default 9090
|
Telnet port to Logitech Media Server, default 9090.
|
||||||
|
|
||||||
usermame
|
usermame
|
||||||
*Optional
|
*Optional
|
||||||
Username, if password protection is enabled
|
Username, if password protection is enabled.
|
||||||
|
|
||||||
password
|
password
|
||||||
*Optional
|
*Optional
|
||||||
Password, if password protection is enabled
|
Password, if password protection is enabled.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
@ -91,7 +91,7 @@ class LogitechMediaServer(object):
|
||||||
self.init_success = True if self.http_port else False
|
self.init_success = True if self.http_port else False
|
||||||
|
|
||||||
def _get_http_port(self):
|
def _get_http_port(self):
|
||||||
""" Get http port from media server, it is used to get cover art """
|
""" Get http port from media server, it is used to get cover art. """
|
||||||
http_port = None
|
http_port = None
|
||||||
try:
|
try:
|
||||||
http_port = self.query('pref', 'httpport', '?')
|
http_port = self.query('pref', 'httpport', '?')
|
||||||
|
@ -111,7 +111,7 @@ class LogitechMediaServer(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
def create_players(self):
|
def create_players(self):
|
||||||
""" Create a list of SqueezeBoxDevices connected to the LMS """
|
""" Create a list of SqueezeBoxDevices connected to the LMS. """
|
||||||
players = []
|
players = []
|
||||||
count = self.query('player', 'count', '?')
|
count = self.query('player', 'count', '?')
|
||||||
for index in range(0, int(count)):
|
for index in range(0, int(count)):
|
||||||
|
@ -121,7 +121,7 @@ class LogitechMediaServer(object):
|
||||||
return players
|
return players
|
||||||
|
|
||||||
def query(self, *parameters):
|
def query(self, *parameters):
|
||||||
""" Send request and await response from server """
|
""" Send request and await response from server. """
|
||||||
telnet = telnetlib.Telnet(self.host, self.port)
|
telnet = telnetlib.Telnet(self.host, self.port)
|
||||||
if self._username and self._password:
|
if self._username and self._password:
|
||||||
telnet.write('login {username} {password}\n'.format(
|
telnet.write('login {username} {password}\n'.format(
|
||||||
|
@ -138,7 +138,7 @@ class LogitechMediaServer(object):
|
||||||
return urllib.parse.unquote(response)
|
return urllib.parse.unquote(response)
|
||||||
|
|
||||||
def get_player_status(self, player):
|
def get_player_status(self, player):
|
||||||
""" Get ithe status of a player """
|
""" Get ithe status of a player. """
|
||||||
# (title) : Song title
|
# (title) : Song title
|
||||||
# Requested Information
|
# Requested Information
|
||||||
# a (artist): Artist name 'artist'
|
# a (artist): Artist name 'artist'
|
||||||
|
|
Loading…
Add table
Reference in a new issue