From 9c4646bed570d1561765b09caf3dbdab50e17355 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 16 Jul 2019 20:28:00 +0200 Subject: [PATCH] Fixed documentation and added missing docs to the index --- docs/source/backends.rst | 9 +++- docs/source/events.rst | 10 +++- .../backend/assistant.google.pushtotalk.rst | 6 --- docs/source/platypush/backend/camera.rst | 6 +++ docs/source/platypush/backend/google.fit.rst | 6 +++ .../platypush/backend/http.media.__init__.rst | 6 --- .../backend/http.media.handlers.__init__.rst | 6 --- .../backend/http.media.handlers.file.rst | 6 --- .../platypush/backend/http.request.rss.rst | 6 +++ docs/source/platypush/backend/joystick.rst | 6 +++ docs/source/platypush/backend/nfc.rst | 6 +++ docs/source/platypush/events/google.fit.rst | 6 +++ docs/source/platypush/events/http.hook.rst | 6 +++ docs/source/platypush/events/media.rst | 6 +++ docs/source/platypush/events/nfc.rst | 6 +++ docs/source/platypush/events/wiimote.rst | 6 +++ .../platypush/plugins/google.credentials.rst | 6 +++ docs/source/platypush/plugins/google.fit.rst | 6 +++ docs/source/platypush/plugins/homeseer.rst | 7 +++ .../source/platypush/plugins/http.webpage.rst | 7 +++ docs/source/platypush/plugins/media.plex.rst | 6 +++ .../plugins/media.search.__init__.rst | 6 --- docs/source/platypush/plugins/sound.rst | 2 +- docs/source/platypush/plugins/user.rst | 6 +++ docs/source/plugins.rst | 7 +++ platypush/backend/google/fit.py | 2 +- .../http/static/css/source/webpanel/nav.scss | 20 ++++++-- platypush/backend/http/templates/nav.html | 4 ++ platypush/backend/midi.py | 2 +- .../plugins/assistant/google/pushtotalk.py | 50 +++++++++++-------- platypush/plugins/autoremote.py | 30 ++++++----- platypush/plugins/google/credentials.py | 3 +- platypush/plugins/google/youtube.py | 16 +++--- platypush/plugins/http/webpage.py | 9 +++- platypush/plugins/light/hue/__init__.py | 48 ++++++++++-------- platypush/plugins/media/mplayer.py | 2 +- platypush/plugins/media/subtitles.py | 15 +++--- platypush/plugins/music/snapcast.py | 44 ++++++++-------- platypush/plugins/sound/__init__.py | 18 ++++--- platypush/plugins/user.py | 11 +++- platypush/plugins/utils.py | 22 +++++--- 41 files changed, 300 insertions(+), 152 deletions(-) delete mode 100644 docs/source/platypush/backend/assistant.google.pushtotalk.rst create mode 100644 docs/source/platypush/backend/camera.rst create mode 100644 docs/source/platypush/backend/google.fit.rst delete mode 100644 docs/source/platypush/backend/http.media.__init__.rst delete mode 100644 docs/source/platypush/backend/http.media.handlers.__init__.rst delete mode 100644 docs/source/platypush/backend/http.media.handlers.file.rst create mode 100644 docs/source/platypush/backend/http.request.rss.rst create mode 100644 docs/source/platypush/backend/joystick.rst create mode 100644 docs/source/platypush/backend/nfc.rst create mode 100644 docs/source/platypush/events/google.fit.rst create mode 100644 docs/source/platypush/events/http.hook.rst create mode 100644 docs/source/platypush/events/media.rst create mode 100644 docs/source/platypush/events/nfc.rst create mode 100644 docs/source/platypush/events/wiimote.rst create mode 100644 docs/source/platypush/plugins/google.credentials.rst create mode 100644 docs/source/platypush/plugins/google.fit.rst create mode 100644 docs/source/platypush/plugins/homeseer.rst create mode 100644 docs/source/platypush/plugins/http.webpage.rst create mode 100644 docs/source/platypush/plugins/media.plex.rst delete mode 100644 docs/source/platypush/plugins/media.search.__init__.rst create mode 100644 docs/source/platypush/plugins/user.rst diff --git a/docs/source/backends.rst b/docs/source/backends.rst index 5ab4efb7..0fc9495d 100644 --- a/docs/source/backends.rst +++ b/docs/source/backends.rst @@ -7,14 +7,17 @@ Backends platypush/backend.rst platypush/backend/adafruit.io.rst - platypush/backend/assistant.google.pushtotalk.rst platypush/backend/assistant.google.rst platypush/backend/assistant.snowboy.rst platypush/backend/button.flic.rst + platypush/backend/camera.rst platypush/backend/camera.pi.rst - platypush/backend/http.poll.rst + platypush/backend/google.fit.rst platypush/backend/http.rst + platypush/backend/http.poll.rst + platypush/backend/http.request.rss.rst platypush/backend/inotify.rst + platypush/backend/joystick.rst platypush/backend/kafka.rst platypush/backend/light.hue.rst platypush/backend/midi.rst @@ -22,6 +25,7 @@ Backends platypush/backend/music.mopidy.rst platypush/backend/music.mpd.rst platypush/backend/music.snapcast.rst + platypush/backend/nfc.rst platypush/backend/pushbullet.rst platypush/backend/redis.rst platypush/backend/scard.rst @@ -35,3 +39,4 @@ Backends platypush/backend/weather.forecast.rst platypush/backend/websocket.rst platypush/backend/wiimote.rst + diff --git a/docs/source/events.rst b/docs/source/events.rst index c28d6bbf..a1125b10 100644 --- a/docs/source/events.rst +++ b/docs/source/events.rst @@ -11,22 +11,26 @@ Events platypush/events/button.flic.rst platypush/events/camera.rst platypush/events/geo.rst - platypush/events/http.rss.rst + platypush/events/google.fit.rst platypush/events/http.rst + platypush/events/http.hook.rst + platypush/events/http.rss.rst platypush/events/joystick.rst platypush/events/kafka.rst platypush/events/light.rst + platypush/events/media.rst platypush/events/midi.rst platypush/events/music.rst platypush/events/music.snapcast.rst + platypush/events/nfc.rst platypush/events/path.rst platypush/events/ping.rst platypush/events/pushbullet.rst platypush/events/scard.rst + platypush/events/sensor.rst platypush/events/sensor.ir.rst platypush/events/sensor.leap.rst platypush/events/sensor.light.rst - platypush/events/sensor.rst platypush/events/serial.rst platypush/events/sound.rst platypush/events/torrent.rst @@ -34,3 +38,5 @@ Events platypush/events/weather.rst platypush/events/web.rst platypush/events/web.widget.rst + platypush/events/wiimote.rst + diff --git a/docs/source/platypush/backend/assistant.google.pushtotalk.rst b/docs/source/platypush/backend/assistant.google.pushtotalk.rst deleted file mode 100644 index 21634b90..00000000 --- a/docs/source/platypush/backend/assistant.google.pushtotalk.rst +++ /dev/null @@ -1,6 +0,0 @@ -``platypush.backend.assistant.google.pushtotalk`` -================================================= - -.. automodule:: platypush.backend.assistant.google.pushtotalk - :members: - diff --git a/docs/source/platypush/backend/camera.rst b/docs/source/platypush/backend/camera.rst new file mode 100644 index 00000000..9c2ec180 --- /dev/null +++ b/docs/source/platypush/backend/camera.rst @@ -0,0 +1,6 @@ +``platypush.backend.camera`` +============================ + +.. automodule:: platypush.backend.camera + :members: + diff --git a/docs/source/platypush/backend/google.fit.rst b/docs/source/platypush/backend/google.fit.rst new file mode 100644 index 00000000..eb531293 --- /dev/null +++ b/docs/source/platypush/backend/google.fit.rst @@ -0,0 +1,6 @@ +``platypush.backend.google.fit`` +================================ + +.. automodule:: platypush.backend.google.fit + :members: + diff --git a/docs/source/platypush/backend/http.media.__init__.rst b/docs/source/platypush/backend/http.media.__init__.rst deleted file mode 100644 index e6d40169..00000000 --- a/docs/source/platypush/backend/http.media.__init__.rst +++ /dev/null @@ -1,6 +0,0 @@ -``platypush.backend.http.media.__init__`` -========================================= - -.. automodule:: platypush.backend.http.media.__init__ - :members: - diff --git a/docs/source/platypush/backend/http.media.handlers.__init__.rst b/docs/source/platypush/backend/http.media.handlers.__init__.rst deleted file mode 100644 index 97204b60..00000000 --- a/docs/source/platypush/backend/http.media.handlers.__init__.rst +++ /dev/null @@ -1,6 +0,0 @@ -``platypush.backend.http.media.handlers.__init__`` -================================================== - -.. automodule:: platypush.backend.http.media.handlers.__init__ - :members: - diff --git a/docs/source/platypush/backend/http.media.handlers.file.rst b/docs/source/platypush/backend/http.media.handlers.file.rst deleted file mode 100644 index f7fc325f..00000000 --- a/docs/source/platypush/backend/http.media.handlers.file.rst +++ /dev/null @@ -1,6 +0,0 @@ -``platypush.backend.http.media.handlers.file`` -============================================== - -.. automodule:: platypush.backend.http.media.handlers.file - :members: - diff --git a/docs/source/platypush/backend/http.request.rss.rst b/docs/source/platypush/backend/http.request.rss.rst new file mode 100644 index 00000000..da97d58a --- /dev/null +++ b/docs/source/platypush/backend/http.request.rss.rst @@ -0,0 +1,6 @@ +``platypush.backend.http.request.rss`` +====================================== + +.. automodule:: platypush.backend.http.request.rss + :members: + diff --git a/docs/source/platypush/backend/joystick.rst b/docs/source/platypush/backend/joystick.rst new file mode 100644 index 00000000..946a5ebe --- /dev/null +++ b/docs/source/platypush/backend/joystick.rst @@ -0,0 +1,6 @@ +``platypush.backend.joystick`` +============================== + +.. automodule:: platypush.backend.joystick + :members: + diff --git a/docs/source/platypush/backend/nfc.rst b/docs/source/platypush/backend/nfc.rst new file mode 100644 index 00000000..56b26616 --- /dev/null +++ b/docs/source/platypush/backend/nfc.rst @@ -0,0 +1,6 @@ +``platypush.backend.nfc`` +========================= + +.. automodule:: platypush.backend.nfc + :members: + diff --git a/docs/source/platypush/events/google.fit.rst b/docs/source/platypush/events/google.fit.rst new file mode 100644 index 00000000..f32c72dd --- /dev/null +++ b/docs/source/platypush/events/google.fit.rst @@ -0,0 +1,6 @@ +``platypush.message.event.google.fit`` +====================================== + +.. automodule:: platypush.message.event.google.fit + :members: + diff --git a/docs/source/platypush/events/http.hook.rst b/docs/source/platypush/events/http.hook.rst new file mode 100644 index 00000000..ed51d6e8 --- /dev/null +++ b/docs/source/platypush/events/http.hook.rst @@ -0,0 +1,6 @@ +``platypush.message.event.http.hook`` +===================================== + +.. automodule:: platypush.message.event.http.hook + :members: + diff --git a/docs/source/platypush/events/media.rst b/docs/source/platypush/events/media.rst new file mode 100644 index 00000000..00f4acf0 --- /dev/null +++ b/docs/source/platypush/events/media.rst @@ -0,0 +1,6 @@ +``platypush.message.event.media`` +================================= + +.. automodule:: platypush.message.event.media + :members: + diff --git a/docs/source/platypush/events/nfc.rst b/docs/source/platypush/events/nfc.rst new file mode 100644 index 00000000..aefea791 --- /dev/null +++ b/docs/source/platypush/events/nfc.rst @@ -0,0 +1,6 @@ +``platypush.message.event.nfc`` +=============================== + +.. automodule:: platypush.message.event.nfc + :members: + diff --git a/docs/source/platypush/events/wiimote.rst b/docs/source/platypush/events/wiimote.rst new file mode 100644 index 00000000..f984017c --- /dev/null +++ b/docs/source/platypush/events/wiimote.rst @@ -0,0 +1,6 @@ +``platypush.message.event.wiimote`` +=================================== + +.. automodule:: platypush.message.event.wiimote + :members: + diff --git a/docs/source/platypush/plugins/google.credentials.rst b/docs/source/platypush/plugins/google.credentials.rst new file mode 100644 index 00000000..6e485869 --- /dev/null +++ b/docs/source/platypush/plugins/google.credentials.rst @@ -0,0 +1,6 @@ +``platypush.plugins.google.credentials`` +======================================== + +.. automodule:: platypush.plugins.google.credentials + :members: + diff --git a/docs/source/platypush/plugins/google.fit.rst b/docs/source/platypush/plugins/google.fit.rst new file mode 100644 index 00000000..77ba67a3 --- /dev/null +++ b/docs/source/platypush/plugins/google.fit.rst @@ -0,0 +1,6 @@ +``platypush.plugins.google.fit`` +================================ + +.. automodule:: platypush.plugins.google.fit + :members: + diff --git a/docs/source/platypush/plugins/homeseer.rst b/docs/source/platypush/plugins/homeseer.rst new file mode 100644 index 00000000..40752610 --- /dev/null +++ b/docs/source/platypush/plugins/homeseer.rst @@ -0,0 +1,7 @@ +``platypush.plugins.homeseer`` +============================== + +.. automodule:: platypush.plugins.homeseer + :members: + + diff --git a/docs/source/platypush/plugins/http.webpage.rst b/docs/source/platypush/plugins/http.webpage.rst new file mode 100644 index 00000000..4a5e2e8b --- /dev/null +++ b/docs/source/platypush/plugins/http.webpage.rst @@ -0,0 +1,7 @@ +``platypush.plugins.http.webpage`` +================================== + +.. automodule:: platypush.plugins.http.webpage + :members: + + diff --git a/docs/source/platypush/plugins/media.plex.rst b/docs/source/platypush/plugins/media.plex.rst new file mode 100644 index 00000000..6a09a320 --- /dev/null +++ b/docs/source/platypush/plugins/media.plex.rst @@ -0,0 +1,6 @@ +``platypush.plugins.media.plex`` +================================ + +.. automodule:: platypush.plugins.media.plex + :members: + diff --git a/docs/source/platypush/plugins/media.search.__init__.rst b/docs/source/platypush/plugins/media.search.__init__.rst deleted file mode 100644 index 32a7218a..00000000 --- a/docs/source/platypush/plugins/media.search.__init__.rst +++ /dev/null @@ -1,6 +0,0 @@ -``platypush.plugins.media.search.__init__`` -=========================================== - -.. automodule:: platypush.plugins.media.search.__init__ - :members: - diff --git a/docs/source/platypush/plugins/sound.rst b/docs/source/platypush/plugins/sound.rst index 70e1b107..7cb44155 100644 --- a/docs/source/platypush/plugins/sound.rst +++ b/docs/source/platypush/plugins/sound.rst @@ -1,5 +1,5 @@ ``platypush.plugins.sound`` -========================== +=========================== .. automodule:: platypush.plugins.sound :members: diff --git a/docs/source/platypush/plugins/user.rst b/docs/source/platypush/plugins/user.rst new file mode 100644 index 00000000..97047db7 --- /dev/null +++ b/docs/source/platypush/plugins/user.rst @@ -0,0 +1,6 @@ +``platypush.plugins.user`` +========================== + +.. automodule:: platypush.plugins.user + :members: + diff --git a/docs/source/plugins.rst b/docs/source/plugins.rst index 2c682a00..ce46f730 100644 --- a/docs/source/plugins.rst +++ b/docs/source/plugins.rst @@ -17,6 +17,8 @@ Plugins platypush/plugins/db.rst platypush/plugins/file.rst platypush/plugins/google.calendar.rst + platypush/plugins/google.credentials.rst + platypush/plugins/google.fit.rst platypush/plugins/google.mail.rst platypush/plugins/google.maps.rst platypush/plugins/google.rst @@ -27,8 +29,10 @@ Plugins platypush/plugins/gpio.sensor.mcp3008.rst platypush/plugins/gpio.sensor.rst platypush/plugins/gpio.zeroborg.rst + platypush/plugins/homeseer.rst platypush/plugins/http.request.rss.rst platypush/plugins/http.request.rst + platypush/plugins/http.webpage.rst platypush/plugins/ifttt.rst platypush/plugins/kafka.rst platypush/plugins/light.hue.rst @@ -37,6 +41,7 @@ Plugins platypush/plugins/media.mplayer.rst platypush/plugins/media.mpv.rst platypush/plugins/media.omxplayer.rst + platypush/plugins/media.plex.rst platypush/plugins/media.search.local.rst platypush/plugins/media.search.torrent.rst platypush/plugins/media.search.youtube.rst @@ -59,8 +64,10 @@ Plugins platypush/plugins/torrent.rst platypush/plugins/tts.google.rst platypush/plugins/tts.rst + platypush/plugins/user.rst platypush/plugins/utils.rst platypush/plugins/variable.rst platypush/plugins/weather.forecast.rst platypush/plugins/websocket.rst platypush/plugins/wiimote.rst + diff --git a/platypush/backend/google/fit.py b/platypush/backend/google/fit.py index e8af7bcf..486597c1 100644 --- a/platypush/backend/google/fit.py +++ b/platypush/backend/google/fit.py @@ -34,7 +34,7 @@ class GoogleFitBackend(Backend): """ :param data_sources: Google Fit data source IDs to monitor. You can 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] :param user_id: Google user ID to track (default: 'me') diff --git a/platypush/backend/http/static/css/source/webpanel/nav.scss b/platypush/backend/http/static/css/source/webpanel/nav.scss index d2ff0f0d..6910dd0d 100644 --- a/platypush/backend/http/static/css/source/webpanel/nav.scss +++ b/platypush/backend/http/static/css/source/webpanel/nav.scss @@ -46,10 +46,26 @@ nav { .date-time { position: absolute; + display: inline-block; right: 0; margin-right: .7rem; font-size: 14pt; 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 { @@ -72,10 +88,6 @@ nav { li.selected { border-radius: 2rem; } - - .date-time { - @extend .hidden; - } } } } diff --git a/platypush/backend/http/templates/nav.html b/platypush/backend/http/templates/nav.html index a423bf80..cfd34a6b 100644 --- a/platypush/backend/http/templates/nav.html +++ b/platypush/backend/http/templates/nav.html @@ -29,6 +29,10 @@ {% endfor %}
+
+ +
+
diff --git a/platypush/backend/midi.py b/platypush/backend/midi.py index 61f182e4..791c401d 100644 --- a/platypush/backend/midi.py +++ b/platypush/backend/midi.py @@ -26,7 +26,7 @@ class MidiBackend(Backend): """ :param device_name: Name of the MIDI device. *N.B.* either `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 :type device_name: str diff --git a/platypush/plugins/assistant/google/pushtotalk.py b/platypush/plugins/assistant/google/pushtotalk.py index 5f0d7ee8..9523966e 100644 --- a/platypush/plugins/assistant/google/pushtotalk.py +++ b/platypush/plugins/assistant/google/pushtotalk.py @@ -24,11 +24,11 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin): Triggers: - * :class:`platypush.message.event.assistant.ConversationStartEvent` \ + * :class:`platypush.message.event.assistant.ConversationStartEvent` when a new conversation starts - * :class:`platypush.message.event.assistant.SpeechRecognizedEvent` \ + * :class:`platypush.message.event.assistant.SpeechRecognizedEvent` when a new voice command is recognized - * :class:`platypush.message.event.assistant.ConversationEndEvent` \ + * :class:`platypush.message.event.assistant.ConversationEndEvent` when a new conversation ends Requires: @@ -54,15 +54,15 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin): 'device_config.json'), language='en-US', **kwargs): """ - :param credentials_file: Path to the Google OAuth credentials file \ - (default: ~/.config/google-oauthlib-tool/credentials.json). \ - See https://developers.google.com/assistant/sdk/guides/library/python/embed/install-sample#generate_credentials \ + :param credentials_file: Path to the Google OAuth credentials file + (default: ~/.config/google-oauthlib-tool/credentials.json). + See https://developers.google.com/assistant/sdk/guides/library/python/embed/install-sample#generate_credentials for instructions to get your own credentials file. :type credentials_file: str - :param device_config: Path to device_config.json. Register your 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 \ + :param device_config: Path to device_config.json. Register your 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 googlesamples to create your device_config.json :type device_config: str @@ -196,22 +196,28 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin): """ Start a conversation - :param language: Language code override (default: default configured - language) + :param language: Language code override (default: default configured language) :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: diff --git a/platypush/plugins/autoremote.py b/platypush/plugins/autoremote.py index ef9f219f..61597108 100644 --- a/platypush/plugins/autoremote.py +++ b/platypush/plugins/autoremote.py @@ -24,22 +24,26 @@ class AutoremotePlugin(Plugin): 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': { - 'key': 'AUTOREMOTE_KEY', - 'password': 'DEVICE_PASSWORD' - }, - ... - } + { + 'device_name': { + 'key': 'AUTOREMOTE_KEY', + 'password': 'DEVICE_PASSWORD' + }, + ... + } :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 - :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 """ @@ -60,13 +64,15 @@ class AutoremotePlugin(Plugin): :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 :param password: Set it if you want to override the default password (default: None) :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 :param target: Message target (default: None) diff --git a/platypush/plugins/google/credentials.py b/platypush/plugins/google/credentials.py index 3ce4091f..66b0a0db 100644 --- a/platypush/plugins/google/credentials.py +++ b/platypush/plugins/google/credentials.py @@ -55,7 +55,8 @@ def generate_credentials(client_secret_path, scope): def main(): """ 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] """ diff --git a/platypush/plugins/google/youtube.py b/platypush/plugins/google/youtube.py index 1b447a31..2500dc6b 100644 --- a/platypush/plugins/google/youtube.py +++ b/platypush/plugins/google/youtube.py @@ -27,25 +27,25 @@ class GoogleYoutubePlugin(GooglePlugin): """ 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). + See the `Getting started - Part `_. :type parts: list[str] or str :param query: Query string (default: empty string) :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). + See the `Getting started - Resources `_. :type types: list[str] or str :param max_results: Maximum number of items that will be returned (default: 25). :type max_results: int - :param kwargs: Any extra arguments that will be transparently passed to the YouTube API, see the - `YouTube API documentation `_. + :param kwargs: Any extra arguments that will be transparently passed to the YouTube API. + See the `Getting started - parameters `_. - :return: A list of YouTube resources, see the `YouTube API documentation - `_. + :return: A list of YouTube resources. + See the `Getting started - Resource `_. """ parts = parts or self._default_parts[:] diff --git a/platypush/plugins/http/webpage.py b/platypush/plugins/http/webpage.py index c55c2c44..d3e6c45e 100644 --- a/platypush/plugins/http/webpage.py +++ b/platypush/plugins/http/webpage.py @@ -34,21 +34,28 @@ class HttpWebpagePlugin(Plugin): :param outfile: If set then the output will be written to the specified file (supported formats: pdf, html, plain (default)). The plugin will guess 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": , "title": , "content": + } Example if outfile is specified: + ..code-block:: json + { "url": , "title": , "outfile": + } + """ if not self.mercury_api_key: diff --git a/platypush/plugins/light/hue/__init__.py b/platypush/plugins/light/hue/__init__.py index b2c4eb42..ade90952 100644 --- a/platypush/plugins/light/hue/__init__.py +++ b/platypush/plugins/light/hue/__init__.py @@ -97,8 +97,6 @@ class LightHuePlugin(LightPlugin): Connect to the configured Hue bridge. If the device hasn't been paired yet, uncomment the ``.connect()`` and ``.get_api()`` lines and retry 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 @@ -137,13 +135,14 @@ class LightHuePlugin(LightPlugin): Example output:: - output = { + { "scene-id-1": { "name": "Scene 1", "lights": [ "1", "3" ], + "owner": "owner-id", "recycle": true, "locked": false, @@ -151,11 +150,9 @@ class LightHuePlugin(LightPlugin): "picture": "", "lastupdated": "2018-06-01T00:00:00", "version": 1 - }, - "scene-id-2": { - # ... } } + """ return self.bridge.get_scene() @@ -169,7 +166,7 @@ class LightHuePlugin(LightPlugin): Example:: - output = { + { "1": { "state": { "on": true, @@ -181,22 +178,22 @@ class LightHuePlugin(LightPlugin): 0.6163, 0.3403 ], + "ct": 153, "alert": "none", "colormode": "hs", "reachable": true }, + "type": "Extended color light", "name": "Lightbulb 1", "modelid": "LCT001", "manufacturername": "Philips", "uniqueid": "00:11:22:33:44:55:66:77-88", "swversion": "5.105.0.21169" - }, - "2": { - # ... } } + """ return self.bridge.get_light() @@ -210,7 +207,7 @@ class LightHuePlugin(LightPlugin): Example:: - output = { + { "1": { "name": "Living Room", "lights": [ @@ -223,11 +220,13 @@ class LightHuePlugin(LightPlugin): "1", "3" ], + "type": "Room", "state": { "all_on": true, "any_on": true }, + "class": "Living room", "action": { "on": true, @@ -239,16 +238,14 @@ class LightHuePlugin(LightPlugin): 0.2844, 0.2609 ], + "ct": 153, "alert": "none", "colormode": "hs" } - }, - - "2": { - # ... } } + """ return self.bridge.get_group() @@ -258,7 +255,9 @@ class LightHuePlugin(LightPlugin): """ 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": { @@ -271,14 +270,18 @@ class LightHuePlugin(LightPlugin): "sat_step": 10, "bri_step": 2, "transition_seconds": 2 - }, - ... + + } + }, + "lights": { - "id_1": { ... }, - ... + "id_1": {} + } + } + """ return self.animations @@ -325,7 +328,8 @@ class LightHuePlugin(LightPlugin): """ 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. Example call:: @@ -339,6 +343,7 @@ class LightHuePlugin(LightPlugin): "sat": 255 } } + """ self.connect() @@ -363,6 +368,7 @@ class LightHuePlugin(LightPlugin): "sat": 255 } } + """ self.connect() diff --git a/platypush/plugins/media/mplayer.py b/platypush/plugins/media/mplayer.py index 149ac379..021af72d 100644 --- a/platypush/plugins/media/mplayer.py +++ b/platypush/plugins/media/mplayer.py @@ -200,7 +200,7 @@ class MediaMplayerPlugin(MediaPlugin): """ Execute a raw MPlayer command. See 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 [] diff --git a/platypush/plugins/media/subtitles.py b/platypush/plugins/media/subtitles.py index 11906ad6..3029b1e4 100644 --- a/platypush/plugins/media/subtitles.py +++ b/platypush/plugins/media/subtitles.py @@ -59,8 +59,8 @@ class MediaSubtitlesPlugin(Plugin): :param resource: Media file, torrent or URL to the media resource :type resource: str - :param language: Language name or code (default: configured preferred - language). Choose 'all' for all the languages + :param language: Language name or code (default: configured preferred language). + Choose 'all' for all the languages :type language: str """ @@ -118,14 +118,12 @@ class MediaSubtitlesPlugin(Plugin): @action def download(self, link, media_resource=None, path=None, convert_to_vtt=False): """ - Downloads a subtitle link (.srt/.vtt file or gzip/zip OpenSubtitles - archive link) to the specified directory + Downloads a subtitle link (.srt/.vtt file or gzip/zip OpenSubtitles archive link) to the specified directory :param link: Local subtitles file or OpenSubtitles gzip download link :type link: str - :param path: Path where the subtitle file will be downloaded (default: - temporary file under /tmp) + :param path: Path where the subtitle file will be downloaded (default: temporary file under /tmp) :type path: str :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) :type convert_to_vtt: bool - :returns: dict. Format:: + :returns: dict. + + Format:: { "filename": "/path/to/subtitle/file.srt" } + """ if link.startswith('file://'): diff --git a/platypush/plugins/music/snapcast.py b/platypush/plugins/music/snapcast.py index cb12b95f..0d0d000e 100644 --- a/platypush/plugins/music/snapcast.py +++ b/platypush/plugins/music/snapcast.py @@ -116,9 +116,9 @@ class MusicSnapcastPlugin(Plugin): :param group: Group ID or name (default: None) :type group: str - :returns: dict. Example: + :returns: dict. - .. codeblock:: json + Example:: "output": { "groups": [ @@ -177,27 +177,28 @@ class MusicSnapcastPlugin(Plugin): }, "streams": [ { - "id": "mopidy", - "meta": { - "STREAM": "mopidy" - }, - "status": "playing", - "uri": { - "fragment": "", - "host": "", - "path": "/tmp/snapfifo", - "query": { - "buffer_ms": "20", - "codec": "pcm", - "name": "mopidy", - "sampleformat": "48000:16:2" + "id": "mopidy", + "meta": { + "STREAM": "mopidy" }, - "raw": "pipe:////tmp/snapfifo?buffer_ms=20&codec=pcm&name=mopidy&sampleformat=48000:16:2", - "scheme": "pipe" - } + "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", + "scheme": "pipe" + } } ] } + """ sock = None @@ -554,7 +555,9 @@ class MusicSnapcastPlugin(Plugin): :param exclude_local: Exclude localhost connections (default: False) :type exclude_local: bool - :returns: dict with the host->port mapping. Example:: + :returns: dict with the host->port mapping. + + Example:: { "hosts": { @@ -563,6 +566,7 @@ class MusicSnapcastPlugin(Plugin): "server_3": 1705 } } + """ backend_hosts = self.get_backend_hosts().output diff --git a/platypush/plugins/sound/__init__.py b/platypush/plugins/sound/__init__.py index 1f45fc4a..f5c672f5 100644 --- a/platypush/plugins/sound/__init__.py +++ b/platypush/plugins/sound/__init__.py @@ -62,12 +62,12 @@ class SoundPlugin(Plugin): output_blocksize=Sound._DEFAULT_BLOCKSIZE, *args, **kwargs): """ :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 :type input_device: int or str :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 :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) :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 calling play multple times. :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 @@ -245,7 +247,7 @@ class SoundPlugin(Plugin): :param stream_index: If specified, play to an already active stream 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. :type stream_index: int @@ -426,7 +428,7 @@ class SoundPlugin(Plugin): :param channels: Number of channels (default: 1) :type channels: int - :param subtype: Recording subtype - see `soundfile docs `_ for a list of the available subtypes (default: PCM_24) + :param subtype: Recording subtype - see `Soundfile docs - Subtypes `_ for a list of the available subtypes (default: PCM_24) :type subtype: str """ @@ -544,7 +546,7 @@ class SoundPlugin(Plugin): :param channels: Number of channels (default: 1) :type channels: int - :param dtype: Data type for the recording - see `soundfile docs `_ for available types (default: input device default) + :param dtype: Data type for the recording - see `Soundfile docs - Recording `_ for available types (default: input device default) :type dtype: str """ @@ -816,7 +818,7 @@ class SoundPlugin(Plugin): sound_index=None, midi_note=None, frequency=None): """ 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 or absolute file path. diff --git a/platypush/plugins/user.py b/platypush/plugins/user.py index 63fde28a..7b6d9b8b 100644 --- a/platypush/plugins/user.py +++ b/platypush/plugins/user.py @@ -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 their own credentials, unless this is the first user created on the system. - :return: dict:: + :return: dict. + + Format:: { "user_id": int, "username": str, "created_at": str (in ISO format) } + """ 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), "expires_at": str (in ISO format), } + """ session = self.user_manager.create_user_session(username=username, @@ -107,13 +111,16 @@ class UserPlugin(Plugin): def authenticate_session(self, session_token): """ Authenticate a session by token and return the associated user - :return: dict:: + :return: dict. + + Format:: { "user_id": int, "username": str, "created_at": str (in ISO format) } + """ user = self.user_manager.authenticate_user_session(session_token=session_token) diff --git a/platypush/plugins/utils.py b/platypush/plugins/utils.py index 482dc8bc..eaeb54e5 100644 --- a/platypush/plugins/utils.py +++ b/platypush/plugins/utils.py @@ -105,7 +105,9 @@ class UtilsPlugin(Plugin): """ Get info about the pending timeouts - :returns: dict. Example:: + :returns: dict. Example: + + .. code-block:: json { "test_timeout": { @@ -118,8 +120,7 @@ class UtilsPlugin(Plugin): } } ] - }, - ... + } } """ @@ -138,7 +139,9 @@ class UtilsPlugin(Plugin): :param name: Name of the timeout to get :type name: str - :returns: dict. Example:: + :returns: dict. Example: + + .. code-block:: json { "test_timeout": { @@ -245,7 +248,9 @@ class UtilsPlugin(Plugin): """ Get info about the running intervals - :returns: dict. Example:: + :returns: dict. Example: + + .. code-block:: json { "test_interval": { @@ -258,8 +263,7 @@ class UtilsPlugin(Plugin): } } ] - }, - ... + } } """ @@ -278,7 +282,9 @@ class UtilsPlugin(Plugin): :param name: Name of the interval to get :type name: str - :returns: dict. Example:: + :returns: dict. Example: + + .. code-block:: json { "test_interval": {