Fixed documentation and added missing docs to the index

This commit is contained in:
Fabio Manganiello 2019-07-16 20:28:00 +02:00
parent 96c9d5460a
commit 9c4646bed5
41 changed files with 300 additions and 152 deletions

View File

@ -7,14 +7,17 @@ Backends
platypush/backend.rst platypush/backend.rst
platypush/backend/adafruit.io.rst platypush/backend/adafruit.io.rst
platypush/backend/assistant.google.pushtotalk.rst
platypush/backend/assistant.google.rst platypush/backend/assistant.google.rst
platypush/backend/assistant.snowboy.rst platypush/backend/assistant.snowboy.rst
platypush/backend/button.flic.rst platypush/backend/button.flic.rst
platypush/backend/camera.rst
platypush/backend/camera.pi.rst platypush/backend/camera.pi.rst
platypush/backend/http.poll.rst platypush/backend/google.fit.rst
platypush/backend/http.rst platypush/backend/http.rst
platypush/backend/http.poll.rst
platypush/backend/http.request.rss.rst
platypush/backend/inotify.rst platypush/backend/inotify.rst
platypush/backend/joystick.rst
platypush/backend/kafka.rst platypush/backend/kafka.rst
platypush/backend/light.hue.rst platypush/backend/light.hue.rst
platypush/backend/midi.rst platypush/backend/midi.rst
@ -22,6 +25,7 @@ Backends
platypush/backend/music.mopidy.rst platypush/backend/music.mopidy.rst
platypush/backend/music.mpd.rst platypush/backend/music.mpd.rst
platypush/backend/music.snapcast.rst platypush/backend/music.snapcast.rst
platypush/backend/nfc.rst
platypush/backend/pushbullet.rst platypush/backend/pushbullet.rst
platypush/backend/redis.rst platypush/backend/redis.rst
platypush/backend/scard.rst platypush/backend/scard.rst
@ -35,3 +39,4 @@ Backends
platypush/backend/weather.forecast.rst platypush/backend/weather.forecast.rst
platypush/backend/websocket.rst platypush/backend/websocket.rst
platypush/backend/wiimote.rst platypush/backend/wiimote.rst

View File

@ -11,22 +11,26 @@ Events
platypush/events/button.flic.rst platypush/events/button.flic.rst
platypush/events/camera.rst platypush/events/camera.rst
platypush/events/geo.rst platypush/events/geo.rst
platypush/events/http.rss.rst platypush/events/google.fit.rst
platypush/events/http.rst platypush/events/http.rst
platypush/events/http.hook.rst
platypush/events/http.rss.rst
platypush/events/joystick.rst platypush/events/joystick.rst
platypush/events/kafka.rst platypush/events/kafka.rst
platypush/events/light.rst platypush/events/light.rst
platypush/events/media.rst
platypush/events/midi.rst platypush/events/midi.rst
platypush/events/music.rst platypush/events/music.rst
platypush/events/music.snapcast.rst platypush/events/music.snapcast.rst
platypush/events/nfc.rst
platypush/events/path.rst platypush/events/path.rst
platypush/events/ping.rst platypush/events/ping.rst
platypush/events/pushbullet.rst platypush/events/pushbullet.rst
platypush/events/scard.rst platypush/events/scard.rst
platypush/events/sensor.rst
platypush/events/sensor.ir.rst platypush/events/sensor.ir.rst
platypush/events/sensor.leap.rst platypush/events/sensor.leap.rst
platypush/events/sensor.light.rst platypush/events/sensor.light.rst
platypush/events/sensor.rst
platypush/events/serial.rst platypush/events/serial.rst
platypush/events/sound.rst platypush/events/sound.rst
platypush/events/torrent.rst platypush/events/torrent.rst
@ -34,3 +38,5 @@ Events
platypush/events/weather.rst platypush/events/weather.rst
platypush/events/web.rst platypush/events/web.rst
platypush/events/web.widget.rst platypush/events/web.widget.rst
platypush/events/wiimote.rst

View File

@ -1,6 +0,0 @@
``platypush.backend.assistant.google.pushtotalk``
=================================================
.. automodule:: platypush.backend.assistant.google.pushtotalk
:members:

View File

@ -0,0 +1,6 @@
``platypush.backend.camera``
============================
.. automodule:: platypush.backend.camera
:members:

View File

@ -0,0 +1,6 @@
``platypush.backend.google.fit``
================================
.. automodule:: platypush.backend.google.fit
:members:

View File

@ -1,6 +0,0 @@
``platypush.backend.http.media.__init__``
=========================================
.. automodule:: platypush.backend.http.media.__init__
:members:

View File

@ -1,6 +0,0 @@
``platypush.backend.http.media.handlers.__init__``
==================================================
.. automodule:: platypush.backend.http.media.handlers.__init__
:members:

View File

@ -1,6 +0,0 @@
``platypush.backend.http.media.handlers.file``
==============================================
.. automodule:: platypush.backend.http.media.handlers.file
:members:

View File

@ -0,0 +1,6 @@
``platypush.backend.http.request.rss``
======================================
.. automodule:: platypush.backend.http.request.rss
:members:

View File

@ -0,0 +1,6 @@
``platypush.backend.joystick``
==============================
.. automodule:: platypush.backend.joystick
:members:

View File

@ -0,0 +1,6 @@
``platypush.backend.nfc``
=========================
.. automodule:: platypush.backend.nfc
:members:

View File

@ -0,0 +1,6 @@
``platypush.message.event.google.fit``
======================================
.. automodule:: platypush.message.event.google.fit
:members:

View File

@ -0,0 +1,6 @@
``platypush.message.event.http.hook``
=====================================
.. automodule:: platypush.message.event.http.hook
:members:

View File

@ -0,0 +1,6 @@
``platypush.message.event.media``
=================================
.. automodule:: platypush.message.event.media
:members:

View File

@ -0,0 +1,6 @@
``platypush.message.event.nfc``
===============================
.. automodule:: platypush.message.event.nfc
:members:

View File

@ -0,0 +1,6 @@
``platypush.message.event.wiimote``
===================================
.. automodule:: platypush.message.event.wiimote
:members:

View File

@ -0,0 +1,6 @@
``platypush.plugins.google.credentials``
========================================
.. automodule:: platypush.plugins.google.credentials
:members:

View File

@ -0,0 +1,6 @@
``platypush.plugins.google.fit``
================================
.. automodule:: platypush.plugins.google.fit
:members:

View File

@ -0,0 +1,7 @@
``platypush.plugins.homeseer``
==============================
.. automodule:: platypush.plugins.homeseer
:members:

View File

@ -0,0 +1,7 @@
``platypush.plugins.http.webpage``
==================================
.. automodule:: platypush.plugins.http.webpage
:members:

View File

@ -0,0 +1,6 @@
``platypush.plugins.media.plex``
================================
.. automodule:: platypush.plugins.media.plex
:members:

View File

@ -1,6 +0,0 @@
``platypush.plugins.media.search.__init__``
===========================================
.. automodule:: platypush.plugins.media.search.__init__
:members:

View File

@ -1,5 +1,5 @@
``platypush.plugins.sound`` ``platypush.plugins.sound``
========================== ===========================
.. automodule:: platypush.plugins.sound .. automodule:: platypush.plugins.sound
:members: :members:

View File

@ -0,0 +1,6 @@
``platypush.plugins.user``
==========================
.. automodule:: platypush.plugins.user
:members:

View File

@ -17,6 +17,8 @@ Plugins
platypush/plugins/db.rst platypush/plugins/db.rst
platypush/plugins/file.rst platypush/plugins/file.rst
platypush/plugins/google.calendar.rst platypush/plugins/google.calendar.rst
platypush/plugins/google.credentials.rst
platypush/plugins/google.fit.rst
platypush/plugins/google.mail.rst platypush/plugins/google.mail.rst
platypush/plugins/google.maps.rst platypush/plugins/google.maps.rst
platypush/plugins/google.rst platypush/plugins/google.rst
@ -27,8 +29,10 @@ Plugins
platypush/plugins/gpio.sensor.mcp3008.rst platypush/plugins/gpio.sensor.mcp3008.rst
platypush/plugins/gpio.sensor.rst platypush/plugins/gpio.sensor.rst
platypush/plugins/gpio.zeroborg.rst platypush/plugins/gpio.zeroborg.rst
platypush/plugins/homeseer.rst
platypush/plugins/http.request.rss.rst platypush/plugins/http.request.rss.rst
platypush/plugins/http.request.rst platypush/plugins/http.request.rst
platypush/plugins/http.webpage.rst
platypush/plugins/ifttt.rst platypush/plugins/ifttt.rst
platypush/plugins/kafka.rst platypush/plugins/kafka.rst
platypush/plugins/light.hue.rst platypush/plugins/light.hue.rst
@ -37,6 +41,7 @@ Plugins
platypush/plugins/media.mplayer.rst platypush/plugins/media.mplayer.rst
platypush/plugins/media.mpv.rst platypush/plugins/media.mpv.rst
platypush/plugins/media.omxplayer.rst platypush/plugins/media.omxplayer.rst
platypush/plugins/media.plex.rst
platypush/plugins/media.search.local.rst platypush/plugins/media.search.local.rst
platypush/plugins/media.search.torrent.rst platypush/plugins/media.search.torrent.rst
platypush/plugins/media.search.youtube.rst platypush/plugins/media.search.youtube.rst
@ -59,8 +64,10 @@ Plugins
platypush/plugins/torrent.rst platypush/plugins/torrent.rst
platypush/plugins/tts.google.rst platypush/plugins/tts.google.rst
platypush/plugins/tts.rst platypush/plugins/tts.rst
platypush/plugins/user.rst
platypush/plugins/utils.rst platypush/plugins/utils.rst
platypush/plugins/variable.rst platypush/plugins/variable.rst
platypush/plugins/weather.forecast.rst platypush/plugins/weather.forecast.rst
platypush/plugins/websocket.rst platypush/plugins/websocket.rst
platypush/plugins/wiimote.rst platypush/plugins/wiimote.rst

View File

@ -34,7 +34,7 @@ class GoogleFitBackend(Backend):
""" """
:param data_sources: Google Fit data source IDs to monitor. You can :param data_sources: Google Fit data source IDs to monitor. You can
get a list of the available data sources through the get a list of the available data sources through the
:method:`platypush.plugins.google.fit.get_data_sources` action :meth:`platypush.plugins.google.fit.get_data_sources` action
:type data_sources: list[str] :type data_sources: list[str]
:param user_id: Google user ID to track (default: 'me') :param user_id: Google user ID to track (default: 'me')

View File

@ -46,10 +46,26 @@ nav {
.date-time { .date-time {
position: absolute; position: absolute;
display: inline-block;
right: 0; right: 0;
margin-right: .7rem; margin-right: .7rem;
font-size: 14pt; font-size: 14pt;
text-shadow: $nav-date-time-shadow; text-shadow: $nav-date-time-shadow;
.time {
display: inline-block;
}
}
.settings {
display: inline-block;
cursor: pointer;
padding: 1rem;
&:hover {
background: $hover-bg;
border-radius: 3rem;
}
} }
.decorator { .decorator {
@ -72,10 +88,6 @@ nav {
li.selected { li.selected {
border-radius: 2rem; border-radius: 2rem;
} }
.date-time {
@extend .hidden;
}
} }
} }
} }

View File

@ -29,6 +29,10 @@
{% endfor %} {% endfor %}
<div class="date-time pull-right"> <div class="date-time pull-right">
<div class="settings">
<i class="fas fa-cog"></i>
</div>
<div class="time" v-text="now.toTimeString().substring(0,8)"></div> <div class="time" v-text="now.toTimeString().substring(0,8)"></div>
</div> </div>
</ul> </ul>

View File

@ -26,7 +26,7 @@ class MidiBackend(Backend):
""" """
:param device_name: Name of the MIDI device. *N.B.* either :param device_name: Name of the MIDI device. *N.B.* either
`device_name` or `port_number` must be set. `device_name` or `port_number` must be set.
Use :method:`platypush.plugins.midi.query_ports` to get the Use :meth:`platypush.plugins.midi.query_ports` to get the
available ports indices and names available ports indices and names
:type device_name: str :type device_name: str

View File

@ -24,11 +24,11 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin):
Triggers: Triggers:
* :class:`platypush.message.event.assistant.ConversationStartEvent` \ * :class:`platypush.message.event.assistant.ConversationStartEvent`
when a new conversation starts when a new conversation starts
* :class:`platypush.message.event.assistant.SpeechRecognizedEvent` \ * :class:`platypush.message.event.assistant.SpeechRecognizedEvent`
when a new voice command is recognized when a new voice command is recognized
* :class:`platypush.message.event.assistant.ConversationEndEvent` \ * :class:`platypush.message.event.assistant.ConversationEndEvent`
when a new conversation ends when a new conversation ends
Requires: Requires:
@ -54,15 +54,15 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin):
'device_config.json'), 'device_config.json'),
language='en-US', **kwargs): language='en-US', **kwargs):
""" """
:param credentials_file: Path to the Google OAuth credentials file \ :param credentials_file: Path to the Google OAuth credentials file
(default: ~/.config/google-oauthlib-tool/credentials.json). \ (default: ~/.config/google-oauthlib-tool/credentials.json).
See https://developers.google.com/assistant/sdk/guides/library/python/embed/install-sample#generate_credentials \ See https://developers.google.com/assistant/sdk/guides/library/python/embed/install-sample#generate_credentials
for instructions to get your own credentials file. for instructions to get your own credentials file.
:type credentials_file: str :type credentials_file: str
:param device_config: Path to device_config.json. Register your device \ :param device_config: Path to device_config.json. Register your device
(see https://developers.google.com/assistant/sdk/guides/library/python/embed/register-device) \ (see https://developers.google.com/assistant/sdk/guides/library/python/embed/register-device)
and create a project, then run the pushtotalk.py script from \ and create a project, then run the pushtotalk.py script from
googlesamples to create your device_config.json googlesamples to create your device_config.json
:type device_config: str :type device_config: str
@ -196,22 +196,28 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin):
""" """
Start a conversation Start a conversation
:param language: Language code override (default: default configured :param language: Language code override (default: default configured language)
language)
:type language: str :type language: str
:returns: A list of the interactions that happen within the conversation:: :returns: A list of the interactions that happen within the conversation.
..code-block:: json
[
{
"request": "request 1",
"response": "response 1"
},
{
"request": "request 2",
"response": "response 2"
}
]
[
{
"request": "request 1",
"response": "response 1"
},
{
"request": "request 2",
"response": "response 2"
},
]
""" """
if not language: if not language:

View File

@ -24,22 +24,26 @@ class AutoremotePlugin(Plugin):
def __init__(self, devices=None, key=None, password=None, *args, **kwargs): def __init__(self, devices=None, key=None, password=None, *args, **kwargs):
""" """
:param devices: Set this attribute if you want to control multiple AutoRemote devices. This will be a map in the format: :param devices: Set this attribute if you want to control multiple AutoRemote devices.
This will be a map in the format::
{ {
'device_name': { 'device_name': {
'key': 'AUTOREMOTE_KEY', 'key': 'AUTOREMOTE_KEY',
'password': 'DEVICE_PASSWORD' 'password': 'DEVICE_PASSWORD'
}, },
... ...
} }
:type devices: dict :type devices: dict
:param key: The key associated to your device. Open the link in your AutoRemote app and copy the key in the target URL. Set this value if you want to communicate with only one AutoRemote device. :param key: The key associated to your device. Open the link in your AutoRemote app
and copy the key in the target URL. Set this value if you want to communicate
with only one AutoRemote device.
:type key: str :type key: str
:param password: AutoRemote password configured on the device (default: None). Set this value if you want to communicate with only one AutoRemote device. :param password: AutoRemote password configured on the device (default: None).
Set this value if you want to communicate with only one AutoRemote device.
:type password: str :type password: str
""" """
@ -60,13 +64,15 @@ class AutoremotePlugin(Plugin):
:param msg: Message to send :param msg: Message to send
:param key: Set it if you want to override the default devices (default: None, message sent to all the configured devices) :param key: Set it if you want to override the default devices
(default: None, message sent to all the configured devices)
:type key: str :type key: str
:param password: Set it if you want to override the default password (default: None) :param password: Set it if you want to override the default password (default: None)
:type password: str :type password: str
:param devices: Set it if you want to send the message to a specific list of configured devices (default: None, message sent to all the configured devices) :param devices: Set it if you want to send the message to a specific list of
configured devices (default: None, message sent to all the configured devices)
:type devices: list :type devices: list
:param target: Message target (default: None) :param target: Message target (default: None)

View File

@ -55,7 +55,8 @@ def generate_credentials(client_secret_path, scope):
def main(): def main():
""" """
Generates a Google API credentials file given client secret JSON and scopes. Generates a Google API credentials file given client secret JSON and scopes.
Usage: Usage::
python -m platypush.plugins.google.credentials [client_secret.json location] [comma-separated list of scopes] python -m platypush.plugins.google.credentials [client_secret.json location] [comma-separated list of scopes]
""" """

View File

@ -27,25 +27,25 @@ class GoogleYoutubePlugin(GooglePlugin):
""" """
Search for YouTube content. Search for YouTube content.
:param parts: List of parts to get (default: snippet). See the `YouTube API documentation :param parts: List of parts to get (default: snippet).
<https://developers.google.com/youtube/v3/getting-started#part>`_. See the `Getting started - Part <https://developers.google.com/youtube/v3/getting-started#part>`_.
:type parts: list[str] or str :type parts: list[str] or str
:param query: Query string (default: empty string) :param query: Query string (default: empty string)
:type query: str :type query: str
:param types: List of types to retrieve (default: video). See the `YouTube API documentation :param types: List of types to retrieve (default: video).
<https://developers.google.com/youtube/v3/getting-started#resources>`_. See the `Getting started - Resources <https://developers.google.com/youtube/v3/getting-started#resources>`_.
:type types: list[str] or str :type types: list[str] or str
:param max_results: Maximum number of items that will be returned (default: 25). :param max_results: Maximum number of items that will be returned (default: 25).
:type max_results: int :type max_results: int
:param kwargs: Any extra arguments that will be transparently passed to the YouTube API, see the :param kwargs: Any extra arguments that will be transparently passed to the YouTube API.
`YouTube API documentation <https://developers.google.com/youtube/v3/docs/search/list#parameters>`_. See the `Getting started - parameters <https://developers.google.com/youtube/v3/docs/search/list#parameters>`_.
:return: A list of YouTube resources, see the `YouTube API documentation :return: A list of YouTube resources.
<https://developers.google.com/youtube/v3/docs/search#resource>`_. See the `Getting started - Resource <https://developers.google.com/youtube/v3/docs/search#resource>`_.
""" """
parts = parts or self._default_parts[:] parts = parts or self._default_parts[:]

View File

@ -34,21 +34,28 @@ class HttpWebpagePlugin(Plugin):
:param outfile: If set then the output will be written to the specified file :param outfile: If set then the output will be written to the specified file
(supported formats: pdf, html, plain (default)). The plugin will guess (supported formats: pdf, html, plain (default)). The plugin will guess
the format from the extension the format from the extension
:return: dict. Example if outfile is not specified:: :return: dict. Example if outfile is not specified
..code-block:: json
{ {
"url": <url>, "url": <url>,
"title": <page title>, "title": <page title>,
"content": <page parsed content> "content": <page parsed content>
} }
Example if outfile is specified: Example if outfile is specified:
..code-block:: json
{ {
"url": <url>, "url": <url>,
"title": <page title>, "title": <page title>,
"outfile": <output file absolute path> "outfile": <output file absolute path>
} }
""" """
if not self.mercury_api_key: if not self.mercury_api_key:

View File

@ -97,8 +97,6 @@ class LightHuePlugin(LightPlugin):
Connect to the configured Hue bridge. If the device hasn't been paired Connect to the configured Hue bridge. If the device hasn't been paired
yet, uncomment the ``.connect()`` and ``.get_api()`` lines and retry yet, uncomment the ``.connect()`` and ``.get_api()`` lines and retry
after clicking the pairing button on your bridge. after clicking the pairing button on your bridge.
:todo: Support for dynamic retry and better user interaction in case of bridge pairing needed.
""" """
# Lazy init # Lazy init
@ -137,13 +135,14 @@ class LightHuePlugin(LightPlugin):
Example output:: Example output::
output = { {
"scene-id-1": { "scene-id-1": {
"name": "Scene 1", "name": "Scene 1",
"lights": [ "lights": [
"1", "1",
"3" "3"
], ],
"owner": "owner-id", "owner": "owner-id",
"recycle": true, "recycle": true,
"locked": false, "locked": false,
@ -151,11 +150,9 @@ class LightHuePlugin(LightPlugin):
"picture": "", "picture": "",
"lastupdated": "2018-06-01T00:00:00", "lastupdated": "2018-06-01T00:00:00",
"version": 1 "version": 1
},
"scene-id-2": {
# ...
} }
} }
""" """
return self.bridge.get_scene() return self.bridge.get_scene()
@ -169,7 +166,7 @@ class LightHuePlugin(LightPlugin):
Example:: Example::
output = { {
"1": { "1": {
"state": { "state": {
"on": true, "on": true,
@ -181,22 +178,22 @@ class LightHuePlugin(LightPlugin):
0.6163, 0.6163,
0.3403 0.3403
], ],
"ct": 153, "ct": 153,
"alert": "none", "alert": "none",
"colormode": "hs", "colormode": "hs",
"reachable": true "reachable": true
}, },
"type": "Extended color light", "type": "Extended color light",
"name": "Lightbulb 1", "name": "Lightbulb 1",
"modelid": "LCT001", "modelid": "LCT001",
"manufacturername": "Philips", "manufacturername": "Philips",
"uniqueid": "00:11:22:33:44:55:66:77-88", "uniqueid": "00:11:22:33:44:55:66:77-88",
"swversion": "5.105.0.21169" "swversion": "5.105.0.21169"
},
"2": {
# ...
} }
} }
""" """
return self.bridge.get_light() return self.bridge.get_light()
@ -210,7 +207,7 @@ class LightHuePlugin(LightPlugin):
Example:: Example::
output = { {
"1": { "1": {
"name": "Living Room", "name": "Living Room",
"lights": [ "lights": [
@ -223,11 +220,13 @@ class LightHuePlugin(LightPlugin):
"1", "1",
"3" "3"
], ],
"type": "Room", "type": "Room",
"state": { "state": {
"all_on": true, "all_on": true,
"any_on": true "any_on": true
}, },
"class": "Living room", "class": "Living room",
"action": { "action": {
"on": true, "on": true,
@ -239,16 +238,14 @@ class LightHuePlugin(LightPlugin):
0.2844, 0.2844,
0.2609 0.2609
], ],
"ct": 153, "ct": 153,
"alert": "none", "alert": "none",
"colormode": "hs" "colormode": "hs"
} }
},
"2": {
# ...
} }
} }
""" """
return self.bridge.get_group() return self.bridge.get_group()
@ -258,7 +255,9 @@ class LightHuePlugin(LightPlugin):
""" """
Get the list of running light animations. Get the list of running light animations.
:returns: A dictionary with the following structure: :returns: A dictionary with the following structure.
.code-block:: json
{ {
"groups": { "groups": {
@ -271,14 +270,18 @@ class LightHuePlugin(LightPlugin):
"sat_step": 10, "sat_step": 10,
"bri_step": 2, "bri_step": 2,
"transition_seconds": 2 "transition_seconds": 2
},
... }
}, },
"lights": { "lights": {
"id_1": { ... }, "id_1": {}
...
} }
} }
""" """
return self.animations return self.animations
@ -325,7 +328,8 @@ class LightHuePlugin(LightPlugin):
""" """
Set a light (or lights) property. Set a light (or lights) property.
:param light: Light or lights to set. Can be a string representing the light name, a light object, a list of string, or a list of light objects. :param light: Light or lights to set. Can be a string representing the light name,
a light object, a list of string, or a list of light objects.
:param kwargs: key-value list of parameters to set. :param kwargs: key-value list of parameters to set.
Example call:: Example call::
@ -339,6 +343,7 @@ class LightHuePlugin(LightPlugin):
"sat": 255 "sat": 255
} }
} }
""" """
self.connect() self.connect()
@ -363,6 +368,7 @@ class LightHuePlugin(LightPlugin):
"sat": 255 "sat": 255
} }
} }
""" """
self.connect() self.connect()

View File

@ -200,7 +200,7 @@ class MediaMplayerPlugin(MediaPlugin):
""" """
Execute a raw MPlayer command. See Execute a raw MPlayer command. See
http://www.mplayerhq.hu/DOCS/tech/slave.txt for a reference or call http://www.mplayerhq.hu/DOCS/tech/slave.txt for a reference or call
:method:`platypush.plugins.media.mplayer.list_actions` to get a list :meth:`platypush.plugins.media.mplayer.list_actions` to get a list
""" """
args = args or [] args = args or []

View File

@ -59,8 +59,8 @@ class MediaSubtitlesPlugin(Plugin):
:param resource: Media file, torrent or URL to the media resource :param resource: Media file, torrent or URL to the media resource
:type resource: str :type resource: str
:param language: Language name or code (default: configured preferred :param language: Language name or code (default: configured preferred language).
language). Choose 'all' for all the languages Choose 'all' for all the languages
:type language: str :type language: str
""" """
@ -118,14 +118,12 @@ class MediaSubtitlesPlugin(Plugin):
@action @action
def download(self, link, media_resource=None, path=None, convert_to_vtt=False): def download(self, link, media_resource=None, path=None, convert_to_vtt=False):
""" """
Downloads a subtitle link (.srt/.vtt file or gzip/zip OpenSubtitles Downloads a subtitle link (.srt/.vtt file or gzip/zip OpenSubtitles archive link) to the specified directory
archive link) to the specified directory
:param link: Local subtitles file or OpenSubtitles gzip download link :param link: Local subtitles file or OpenSubtitles gzip download link
:type link: str :type link: str
:param path: Path where the subtitle file will be downloaded (default: :param path: Path where the subtitle file will be downloaded (default: temporary file under /tmp)
temporary file under /tmp)
:type path: str :type path: str
:param media_resource: Name of the media resource. If set and if it's a :param media_resource: Name of the media resource. If set and if it's a
@ -136,11 +134,14 @@ class MediaSubtitlesPlugin(Plugin):
will be converted to VTT format (default: no conversion) will be converted to VTT format (default: no conversion)
:type convert_to_vtt: bool :type convert_to_vtt: bool
:returns: dict. Format:: :returns: dict.
Format::
{ {
"filename": "/path/to/subtitle/file.srt" "filename": "/path/to/subtitle/file.srt"
} }
""" """
if link.startswith('file://'): if link.startswith('file://'):

View File

@ -116,9 +116,9 @@ class MusicSnapcastPlugin(Plugin):
:param group: Group ID or name (default: None) :param group: Group ID or name (default: None)
:type group: str :type group: str
:returns: dict. Example: :returns: dict.
.. codeblock:: json Example::
"output": { "output": {
"groups": [ "groups": [
@ -177,27 +177,28 @@ class MusicSnapcastPlugin(Plugin):
}, },
"streams": [ "streams": [
{ {
"id": "mopidy", "id": "mopidy",
"meta": { "meta": {
"STREAM": "mopidy" "STREAM": "mopidy"
},
"status": "playing",
"uri": {
"fragment": "",
"host": "",
"path": "/tmp/snapfifo",
"query": {
"buffer_ms": "20",
"codec": "pcm",
"name": "mopidy",
"sampleformat": "48000:16:2"
}, },
"raw": "pipe:////tmp/snapfifo?buffer_ms=20&codec=pcm&name=mopidy&sampleformat=48000:16:2", "status": "playing",
"scheme": "pipe" "uri": {
} "fragment": "",
"host": "",
"path": "/tmp/snapfifo",
"query": {
"buffer_ms": "20",
"codec": "pcm",
"name": "mopidy",
"sampleformat": "48000:16:2"
},
"raw": "pipe:////tmp/snapfifo?buffer_ms=20&codec=pcm&name=mopidy&sampleformat=48000:16:2",
"scheme": "pipe"
}
} }
] ]
} }
""" """
sock = None sock = None
@ -554,7 +555,9 @@ class MusicSnapcastPlugin(Plugin):
:param exclude_local: Exclude localhost connections (default: False) :param exclude_local: Exclude localhost connections (default: False)
:type exclude_local: bool :type exclude_local: bool
:returns: dict with the host->port mapping. Example:: :returns: dict with the host->port mapping.
Example::
{ {
"hosts": { "hosts": {
@ -563,6 +566,7 @@ class MusicSnapcastPlugin(Plugin):
"server_3": 1705 "server_3": 1705
} }
} }
""" """
backend_hosts = self.get_backend_hosts().output backend_hosts = self.get_backend_hosts().output

View File

@ -62,12 +62,12 @@ class SoundPlugin(Plugin):
output_blocksize=Sound._DEFAULT_BLOCKSIZE, *args, **kwargs): output_blocksize=Sound._DEFAULT_BLOCKSIZE, *args, **kwargs):
""" """
:param input_device: Index or name of the default input device. Use :param input_device: Index or name of the default input device. Use
:method:`platypush.plugins.sound.query_devices` to get the :meth:`platypush.plugins.sound.query_devices` to get the
available devices. Default: system default available devices. Default: system default
:type input_device: int or str :type input_device: int or str
:param output_device: Index or name of the default output device. :param output_device: Index or name of the default output device.
Use :method:`platypush.plugins.sound.query_devices` to get the Use :meth:`platypush.plugins.sound.query_devices` to get the
available devices. Default: system default available devices. Default: system default
:type output_device: int or str :type output_device: int or str
@ -121,7 +121,9 @@ class SoundPlugin(Plugin):
:param category: Device category to query. Can be either input or output. Default: None (query all devices) :param category: Device category to query. Can be either input or output. Default: None (query all devices)
:type category: str :type category: str
:returns: A dictionary representing the available devices. Example:: :returns: A dictionary representing the available devices.
Example::
[ [
{ {
@ -215,7 +217,7 @@ class SoundPlugin(Plugin):
synthetic sounds. You can also create polyphonic sounds by just synthetic sounds. You can also create polyphonic sounds by just
calling play multple times. calling play multple times.
:type sound: Sound. You can initialize it either from a list :type sound: Sound. You can initialize it either from a list
of `Sound` objects or from its JSON representation, e.g.: of `Sound` objects or from its JSON representation, e.g.::
{ {
"midi_note": 69, # 440 Hz A "midi_note": 69, # 440 Hz A
@ -245,7 +247,7 @@ class SoundPlugin(Plugin):
:param stream_index: If specified, play to an already active stream :param stream_index: If specified, play to an already active stream
index (you can get them through index (you can get them through
:method:`platypush.plugins.sound.query_streams`). Default: :meth:`platypush.plugins.sound.query_streams`). Default:
creates a new audio stream through PortAudio. creates a new audio stream through PortAudio.
:type stream_index: int :type stream_index: int
@ -426,7 +428,7 @@ class SoundPlugin(Plugin):
:param channels: Number of channels (default: 1) :param channels: Number of channels (default: 1)
:type channels: int :type channels: int
:param subtype: Recording subtype - see `soundfile docs <https://pysoundfile.readthedocs.io/en/0.9.0/#soundfile.available_subtypes>`_ for a list of the available subtypes (default: PCM_24) :param subtype: Recording subtype - see `Soundfile docs - Subtypes <https://pysoundfile.readthedocs.io/en/0.9.0/#soundfile.available_subtypes>`_ for a list of the available subtypes (default: PCM_24)
:type subtype: str :type subtype: str
""" """
@ -544,7 +546,7 @@ class SoundPlugin(Plugin):
:param channels: Number of channels (default: 1) :param channels: Number of channels (default: 1)
:type channels: int :type channels: int
:param dtype: Data type for the recording - see `soundfile docs <https://python-sounddevice.readthedocs.io/en/0.3.12/_modules/sounddevice.html#rec>`_ for available types (default: input device default) :param dtype: Data type for the recording - see `Soundfile docs - Recording <https://python-sounddevice.readthedocs.io/en/0.3.12/_modules/sounddevice.html#rec>`_ for available types (default: input device default)
:type dtype: str :type dtype: str
""" """
@ -816,7 +818,7 @@ class SoundPlugin(Plugin):
sound_index=None, midi_note=None, frequency=None): sound_index=None, midi_note=None, frequency=None):
""" """
Remove a sound from an active stream, either by sound index (use Remove a sound from an active stream, either by sound index (use
:method:`platypush.sound.plugin.SoundPlugin.query_streams` to get :meth:`platypush.sound.plugin.SoundPlugin.query_streams` to get
the sounds playing on the active streams), midi_note, frequency the sounds playing on the active streams), midi_note, frequency
or absolute file path. or absolute file path.

View File

@ -17,13 +17,16 @@ class UserPlugin(Plugin):
Create a user. This action needs to be executed by an already existing user, who needs to authenticate with Create a user. This action needs to be executed by an already existing user, who needs to authenticate with
their own credentials, unless this is the first user created on the system. their own credentials, unless this is the first user created on the system.
:return: dict:: :return: dict.
Format::
{ {
"user_id": int, "user_id": int,
"username": str, "username": str,
"created_at": str (in ISO format) "created_at": str (in ISO format)
} }
""" """
if self.user_manager.get_user_count() > 0 and not executing_user: if self.user_manager.get_user_count() > 0 and not executing_user:
@ -87,6 +90,7 @@ class UserPlugin(Plugin):
"created_at": str (in ISO format), "created_at": str (in ISO format),
"expires_at": str (in ISO format), "expires_at": str (in ISO format),
} }
""" """
session = self.user_manager.create_user_session(username=username, session = self.user_manager.create_user_session(username=username,
@ -107,13 +111,16 @@ class UserPlugin(Plugin):
def authenticate_session(self, session_token): def authenticate_session(self, session_token):
""" """
Authenticate a session by token and return the associated user Authenticate a session by token and return the associated user
:return: dict:: :return: dict.
Format::
{ {
"user_id": int, "user_id": int,
"username": str, "username": str,
"created_at": str (in ISO format) "created_at": str (in ISO format)
} }
""" """
user = self.user_manager.authenticate_user_session(session_token=session_token) user = self.user_manager.authenticate_user_session(session_token=session_token)

View File

@ -105,7 +105,9 @@ class UtilsPlugin(Plugin):
""" """
Get info about the pending timeouts Get info about the pending timeouts
:returns: dict. Example:: :returns: dict. Example:
.. code-block:: json
{ {
"test_timeout": { "test_timeout": {
@ -118,8 +120,7 @@ class UtilsPlugin(Plugin):
} }
} }
] ]
}, }
...
} }
""" """
@ -138,7 +139,9 @@ class UtilsPlugin(Plugin):
:param name: Name of the timeout to get :param name: Name of the timeout to get
:type name: str :type name: str
:returns: dict. Example:: :returns: dict. Example:
.. code-block:: json
{ {
"test_timeout": { "test_timeout": {
@ -245,7 +248,9 @@ class UtilsPlugin(Plugin):
""" """
Get info about the running intervals Get info about the running intervals
:returns: dict. Example:: :returns: dict. Example:
.. code-block:: json
{ {
"test_interval": { "test_interval": {
@ -258,8 +263,7 @@ class UtilsPlugin(Plugin):
} }
} }
] ]
}, }
...
} }
""" """
@ -278,7 +282,9 @@ class UtilsPlugin(Plugin):
:param name: Name of the interval to get :param name: Name of the interval to get
:type name: str :type name: str
:returns: dict. Example:: :returns: dict. Example:
.. code-block:: json
{ {
"test_interval": { "test_interval": {