[gnome-music/wip/jfelder/mpris-cleanup: 14/17] mpris: Add doctring for all MPRIS methods
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-cleanup: 14/17] mpris: Add doctring for all MPRIS methods
- Date: Thu, 6 Jun 2019 07:25:38 +0000 (UTC)
commit a194e6ff85b02fcb5fc40d2c77311db60dc3e228
Author: Jean Felder <jfelder src gnome org>
Date: Thu Apr 4 15:21:43 2019 +0200
mpris: Add doctring for all MPRIS methods
This should help distinguish internal methods from the methods exposed
by the MPRIS specification.
gnomemusic/mpris.py | 47 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 44 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 693c17cf..fdb8ef96 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -602,39 +602,50 @@ class MPRIS(DBusInterface):
self._reload_playlists()
def _raise(self):
+ """Brings user interface to the front (MPRIS Method)."""
self._app.do_activate()
def _quit(self):
+ """Causes the media player to stop running (MPRIS Method)."""
self._app.quit()
def _next(self):
+ """Skips to the next track in the tracklist (MPRIS Method)."""
self._player.next()
def _previous(self):
+ """Skips to the previous track in the tracklist.
+
+ (MPRIS Method)
+ """
self._player.previous()
def _pause(self):
+ """Pauses playback (MPRIS Method)."""
self._player.pause()
def _play_pause(self):
+ """Play or Pauses playback (MPRIS Method)."""
self._player.play_pause()
def _stop(self):
+ """Stop playback (MPRIS Method)."""
self._player.stop()
def _play(self):
- """Start or resume playback.
+ """Start or resume playback (MPRIS Method).
If there is no track to play, this has no effect.
"""
self._player.play()
def _seek(self, offset_msecond):
- """Seek forward in the current track.
+ """Seek forward in the current track (MPRIS Method).
Seek is relative to the current player position.
If the value passed in would mean seeking beyond the end of the track,
acts like a call to Next.
+
:param int offset_msecond: number of microseconds
"""
current_position_second = self._player.get_position()
@@ -647,7 +658,7 @@ class MPRIS(DBusInterface):
self._player.next()
def _set_position(self, track_id, position_msecond):
- """Set the current track position in microseconds.
+ """Set the current track position in microseconds (MPRIS Method)
:param str track_id: The currently playing track's identifier
:param int position_msecond: new position in microseconds
@@ -659,6 +670,12 @@ class MPRIS(DBusInterface):
self._player.set_position(position_msecond / 1e6)
def _open_uri(self, uri):
+ """Opens the Uri given as an argument (MPRIS Method).
+
+ Not implemented.
+
+ :param str uri: Uri of the track to load.
+ """
pass
def _seeked(self, position_msecond):
@@ -669,6 +686,14 @@ class MPRIS(DBusInterface):
self._dbus_emit_signal("Seeked", {"Position": position_msecond})
def _get_tracks_metadata(self, track_paths):
+ """Gets all the metadata available for a set of tracks.
+
+ (MPRIS Method)
+
+ :param list track_paths: list of track ids
+ :returns: Metadata of the set of tracks given as input.
+ :rtype: list
+ """
metadata = []
for path in track_paths:
index = self._path_list.index(path)
@@ -676,12 +701,24 @@ class MPRIS(DBusInterface):
return metadata
def _add_track(self, uri, after_track, set_as_current):
+ """Adds a URI in the TrackList. (MPRIS Method).
+
+ This is not implemented (CanEditTracks is set to False).
+ """
pass
def _remove_track(self, path):
+ """Removes an item from the TrackList. (MPRIS Method).
+
+ This is not implemented (CanEditTracks is set to False).
+ """
pass
def _go_to(self, path):
+ """Skip to the specified TrackId (MPRIS Method).
+
+ :param str path: Identifier of the track to skip to
+ """
current_song_path = self._get_song_dbus_path()
current_song_index = self._path_list.index(current_song_path)
goto_index = self._path_list.index(path)
@@ -695,6 +732,10 @@ class MPRIS(DBusInterface):
self._dbus_emit_signal("TrackListReplaced", parameters)
def _activate_playlist(self, playlist_path):
+ """Starts playing the given playlist (MPRIS Method).
+
+ :param str playlist_path: The id of the playlist to activate.
+ """
playlist_id = self._get_playlist_from_dbus_path(playlist_path).get_id()
self._playlists.activate_playlist(playlist_id)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]