core: Refer to TlTrack instead of two-tuples in docstrings

This commit is contained in:
Stein Magnus Jodal 2012-11-19 19:54:51 +01:00
parent 9159491d85
commit 62bfb9376a
2 changed files with 12 additions and 19 deletions

View File

@ -38,9 +38,7 @@ class PlaybackController(object):
#: Tracks are not removed from the playlist. #: Tracks are not removed from the playlist.
consume = option_wrapper('_consume', False) consume = option_wrapper('_consume', False)
#: The currently playing or selected track. #: The currently playing or selected :class:`mopidy.models.TlTrack`, or
#:
#: A two-tuple of (TLID integer, :class:`mopidy.models.Track`) or
#: :class:`None`. #: :class:`None`.
current_tl_track = None current_tl_track = None
@ -139,7 +137,7 @@ class PlaybackController(object):
""" """
The track that will be played at the end of the current track. The track that will be played at the end of the current track.
Read-only. A two-tuple of (TLID integer, :class:`mopidy.models.Track`). Read-only. A :class:`mopidy.models.TlTrack`.
Not necessarily the same track as :attr:`tl_track_at_next`. Not necessarily the same track as :attr:`tl_track_at_next`.
""" """
@ -190,7 +188,7 @@ class PlaybackController(object):
""" """
The track that will be played if calling :meth:`next()`. The track that will be played if calling :meth:`next()`.
Read-only. A two-tuple of (TLID integer, :class:`mopidy.models.Track`). Read-only. A :class:`mopidy.models.TlTrack`.
For normal playback this is the next track in the playlist. If repeat For normal playback this is the next track in the playlist. If repeat
is enabled the next track can loop around the playlist. When random is is enabled the next track can loop around the playlist. When random is
@ -238,7 +236,7 @@ class PlaybackController(object):
""" """
The track that will be played if calling :meth:`previous()`. The track that will be played if calling :meth:`previous()`.
A two-tuple of (TLID integer, :class:`mopidy.models.Track`). A :class:`mopidy.models.TlTrack`.
For normal playback this is the previous track in the playlist. If For normal playback this is the previous track in the playlist. If
random and/or consume is enabled it should return the current track random and/or consume is enabled it should return the current track
@ -310,12 +308,10 @@ class PlaybackController(object):
Change to the given track, keeping the current playback state. Change to the given track, keeping the current playback state.
:param tl_track: track to change to :param tl_track: track to change to
:type tl_track: two-tuple (TLID integer, :class:`mopidy.models.Track`) :type tl_track: :class:`mopidy.models.TlTrack` or :class:`None`
or :class:`None`
:param on_error_step: direction to step at play error, 1 for next :param on_error_step: direction to step at play error, 1 for next
track (default), -1 for previous track track (default), -1 for previous track
:type on_error_step: int, -1 or 1 :type on_error_step: int, -1 or 1
""" """
old_state = self.state old_state = self.state
self.stop() self.stop()
@ -383,8 +379,7 @@ class PlaybackController(object):
currently active track. currently active track.
:param tl_track: track to play :param tl_track: track to play
:type tl_track: two-tuple (TLID integer, :class:`mopidy.models.Track`) :type tl_track: :class:`mopidy.models.TlTrack` or :class:`None`
or :class:`None`
:param on_error_step: direction to step at play error, 1 for next :param on_error_step: direction to step at play error, 1 for next
track (default), -1 for previous track track (default), -1 for previous track
:type on_error_step: int, -1 or 1 :type on_error_step: int, -1 or 1

View File

@ -23,7 +23,7 @@ class TracklistController(object):
@property @property
def tl_tracks(self): def tl_tracks(self):
""" """
List of two-tuples of (TLID integer, :class:`mopidy.models.Track`). List of :class:`mopidy.models.TlTrack`.
Read-only. Read-only.
""" """
@ -72,8 +72,7 @@ class TracklistController(object):
:type at_position: int or :class:`None` :type at_position: int or :class:`None`
:param increase_version: if the tracklist version should be increased :param increase_version: if the tracklist version should be increased
:type increase_version: :class:`True` or :class:`False` :type increase_version: :class:`True` or :class:`False`
:rtype: two-tuple of (TLID integer, :class:`mopidy.models.Track`) that :rtype: :class:`mopidy.models.TlTrack` that was added to the tracklist
was added to the tracklist
""" """
assert at_position <= len(self._tl_tracks), \ assert at_position <= len(self._tl_tracks), \
'at_position can not be greater than tracklist length' 'at_position can not be greater than tracklist length'
@ -132,7 +131,7 @@ class TracklistController(object):
:param criteria: on or more criteria to match by :param criteria: on or more criteria to match by
:type criteria: dict :type criteria: dict
:rtype: two-tuple (TLID integer, :class:`mopidy.models.Track`) :rtype: :class:`mopidy.models.TlTrack`
""" """
matches = self._tl_tracks matches = self._tl_tracks
for (key, value) in criteria.iteritems(): for (key, value) in criteria.iteritems():
@ -152,13 +151,12 @@ class TracklistController(object):
def index(self, tl_track): def index(self, tl_track):
""" """
Get index of the given (TLID integer, :class:`mopidy.models.Track`) Get index of the given :class:`mopidy.models.TlTrack` in the tracklist.
two-tuple in the tracklist.
Raises :exc:`ValueError` if not found. Raises :exc:`ValueError` if not found.
:param tl_track: track to find the index of :param tl_track: track to find the index of
:type tl_track: two-tuple (TLID integer, :class:`mopidy.models.Track`) :type tl_track: :class:`mopidy.models.TlTrack`
:rtype: int :rtype: int
""" """
return self._tl_tracks.index(tl_track) return self._tl_tracks.index(tl_track)
@ -255,7 +253,7 @@ class TracklistController(object):
:type start: int :type start: int
:param end: position after last track to include in slice :param end: position after last track to include in slice
:type end: int :type end: int
:rtype: two-tuple of (TLID integer, :class:`mopidy.models.Track`) :rtype: :class:`mopidy.models.TlTrack`
""" """
return self._tl_tracks[start:end] return self._tl_tracks[start:end]