Mopidy extension for playing music from Spotify
mopidy-spotify
Mopidy extension for playing music from Spotify.
Status
[!WARNING]
Spotify have recently disabled username and password login for playback
(#394) and we now use
access token login. You no longer need to provide your Spotify account
username or password.
Mopidy-Spotify currently has no support for the following:
- Seeking
- Gapless playback
- Volume normalization
- Saving items to My Music (#108) -
- Podcasts (#201) -
- Playback
- Search
- Playlists (read-only)
- Top lists and Your Music (read-only)
- Lookup by URI
Dependencies
- A Spotify Premium subscription. Mopidy-Spotify will not work with Spotify
- Mopidy >= 3.4. The music server that Mopidy-Spotify extends.
gst-plugins-spotify, the
We currently prefer a forked version of this plugin which provides better logging. Details in release notes here.
Verify the GStreamer spotify plugin is correctly installed:
gst-inspect-1.0 spotifyaudiosrc | grep Version | awk '{print $2}'
Installation
Install by running:
sudo python3 -m pip install --break-system-packages mopidy-spotify
Configuration
Before starting Mopidy, you must visit https://mopidy.com/ext/spotify/#authentication to authorize this extension against your Spotify account:
[spotify]
clientid = ... clientid value you got from mopidy.com ...
clientsecret = ... clientsecret value you got from mopidy.com ...
[!IMPORTANT]
Remove any credentials.json file you may have manually created.
You must also do this if you need to reauthorize the extension.
The following configuration values are available:
spotify/enabled: If the Spotify extension should be enabled or not.
true.
spotify/clientid: Your Spotify application client id. You must_ provide this.
spotify/clientsecret: Your Spotify application secret key. You must_ provide this.
spotify/bitrate: Audio bitrate in kbps.96,160, or320.
160.
spotify/volume_normalization: Whether volume normalization is active or
true.
spotify/timeout: Seconds before giving up waiting for search results,
10.
spotify/allow_cache: Whether to allow caching. The cache is stored in a
core/cache_dir. Defaults to true.
spotify/cache_size: Maximum cache size in MiB. Set to0for unlimited. Defaults to8192.
spotify/allow_playlists: Whether or not playlists should be exposed.
true.
spotify/searchalbumcount: Maximum number of albums returned in search
spotify/searchartistcount: Maximum number of artists returned in search
spotify/searchtrackcount: Maximum number of tracks returned in search
spotify/username: Deprecated since v5.0.0. Please remove from your configuration file.
spotify/password: Deprecated since v5.0.0. Please remove from your configuration file.
Project resources
Development
Set up development environment
Clone the repo using, e.g. using gh:
gh repo clone mopidy/mopidy-spotify
Enter the directory, and install dependencies using uv:
cd mopidy-spotify/
uv sync
Running tests
To run all tests and linters in isolated environments, use tox:
tox
To only run tests, use pytest:
pytest
To format the code, use ruff:
ruff format .
To check for lints with ruff, run:
ruff check .
To check for type errors, use pyright:
pyright .
Making a release
To make a release to PyPI, go to the project's GitHub releases page and click the "Draft a new release" button.
In the "choose a tag" dropdown, select the tag you want to release or create a new tag, e.g. v0.1.0. Add a title, e.g. v0.1.0, and a description of the changes.
Decide if the release is a pre-release (alpha, beta, or release candidate) or should be marked as the latest release, and click "Publish release".
Once the release is created, the release.yml GitHub Action will automatically build and publish the release to PyPI.
Credits
- Original author: Stein Magnus Jodal
- Current maintainer: Nick Steel
- Contributors