Supporting types
Unstable API
There might be minor adjustments to these types as Mopidy and many of its
extensions gets type hints added. Feel free to use these types in the if
TYPE_CHECKING: blocks of Mopidy extensions, but expect to adjust your usage
a bit with future Mopidy releases.
mopidy.types
Type Aliases:
-
DateOrYear– -
DistinctField–Field name for get_distinct.
-
Query–A query mapping field names to lists of QueryValue.
-
QueryField–A superset of all field names that can be used in any query.
-
QueryValue–A single query value; either a string or an integer.
-
SearchField–Field name for search.
-
SearchQuery–A search query mapping SearchField names
-
TracklistField–A field name that can be used in a tracklist query.
Classes:
-
PlaybackState–Enum of playback states.
Attributes:
-
Date–A date string on the form
YYYY-MM-DD. -
DurationMs–A duration in milliseconds.
-
Percentage–An integer in the range 0-100 representing a percentage.
-
TracklistId–A unique integer ID for a tracklist item.
-
Uri–A URI string identifying a resource, e.g. a track or stream.
-
UriScheme–The scheme part of a URI, e.g.
spotifyorfile. -
Year–A year string on the form
YYYY.
Percentage
module-attribute
An integer in the range 0-100 representing a percentage.
TracklistId
module-attribute
A unique integer ID for a tracklist item.
Uri
module-attribute
A URI string identifying a resource, e.g. a track or stream.
UriScheme
module-attribute
The scheme part of a URI, e.g. spotify or file.
DistinctField
DistinctField = Literal[
"uri",
"track_name",
"album",
"artist",
"albumartist",
"composer",
"performer",
"track_no",
"genre",
"date",
"comment",
"disc_no",
"musicbrainz_albumid",
"musicbrainz_artistid",
"musicbrainz_trackid",
]
Field name for get_distinct.
QueryField
QueryField = DistinctField | SearchField | TracklistField
A superset of all field names that can be used in any query.
SearchQuery
SearchQuery = dict[SearchField, Iterable[QueryValue]]
A search query mapping SearchField names to lists of QueryValue.
TracklistField
TracklistField = Literal[
"tlid", "uri", "name", "genre", "comment", "musicbrainz_id"
]
A field name that can be used in a tracklist query.
PlaybackState
Bases: StrEnum
Enum of playback states.
Attributes:
-
PAUSED–Constant representing the paused state.
-
PLAYING–Constant representing the playing state.
-
STOPPED–Constant representing the stopped state.
PAUSED
class-attribute
instance-attribute
PAUSED = 'paused'
Constant representing the paused state.
PLAYING
class-attribute
instance-attribute
PLAYING = 'playing'
Constant representing the playing state.
STOPPED
class-attribute
instance-attribute
STOPPED = 'stopped'
Constant representing the stopped state.