Skip to main content

Mopidy extension for playing music from Pandora

Project description

mopidy-pandora

Latest PyPI version CI build status Test coverage

Mopidy extension for playing music from Pandora.

Maintainer wanted

I no longer have access to the Pandora music service in the region that I live, which has made maintaining this project impossible. mopidy-pandora is looking for a new maintainer, preferably someone who is familiar with the codebase, familiar with Python development, and uses the paid Pandora subscription service on a regular basis.

If you're interested, please take a look at the code base and work on submitting a pull request or two to show you understand how everything works together.

Features

  • Support for both Pandora Premium and ad-supported free accounts.
  • Add ratings to tracks (thumbs up, thumbs down, sleep, etc.).
  • Bookmark songs or artists.
  • Browse and add genre stations.
  • Search for song, artist, and genre stations.
  • Play QuickMix stations.
  • Sort stations alphabetically or by date added.
  • Delete stations from the user's Pandora profile.
  • Scrobbling to Last.fm using mopidy-scrobbler.

Usage

Ideally, Mopidy needs dynamic playlists and core extensions to properly support Pandora. In the meantime, mopidy-pandora comes bundled with a frontend extension that automatically adds more tracks to the tracklist as needed. mopidy-pandora will ensure that there are always just two tracks in the tracklist: the currently playing track and the track that is up next. It is not possible to mix Pandora and non-Pandora tracks for playback at the same time, so any non-Pandora tracks will be removed from the tracklist when playback starts.

Pandora expects users to interact with tracks at the point in time and in the sequence that it serves them up. For this reason, trying to save tracks to playlists or messing with the Mopidy-Pandora generated tracklist is probably not a good idea. And not recommended.

Dependencies

Requires a Pandora user account. Users with a Pandora Premium subscription will have access to the higher quality 192 Kbps audio stream. Free accounts will play advertisements.

Installation

Install by running:

python3 -m pip install mopidy-pandora

See https://mopidy.com/ext/pandora/ for alternative installation methods.

Configuration

Before starting Mopidy, you must add your Pandora username and password to your Mopidy configuration file. The minimum configuration also requires that you provide the details of the JSON API endpoint that you would like to use:

[pandora]
enabled = true
api_host = tuner.pandora.com/services/json/
partner_encryption_key =
partner_decryption_key =
partner_username = android
partner_password =
partner_device = android-generic
username =
password =

The following configuration values are available:

  • pandora/enabled: If the Pandora extension should be enabled or not. Defaults to true.

  • pandora/api_host: Which of the JSON API endpoints <https://6xq.net/pandora-apidoc/json/>_ to use. Note that the endpoints are different for Pandora Premium and free accounts (details in the link provided).

  • pandora/partner_* related values: The credentials to use for the Pandora API entry point. You must provide these values based on your device preferences.

  • pandora/username: Your Pandora username. You must provide this.

  • pandora/password: Your Pandora password. You must provide this.

  • pandora/preferred_audio_quality: can be one of lowQuality, mediumQuality, or highQuality (default). If the preferred audio quality is not available for the partner device specified, then the next-lowest bitrate stream that Pandora supports for the chosen device will be used. Note that this setting has no effect for partner device types that only provide one audio stream (notably credentials associated with iOS). In such instances, mopidy-pandora will always revert to the default stream provided by the Pandora server.

  • pandora/sort_order: defaults to a-z. Use date to display the list of stations in the order that the stations were added.

  • pandora/auto_setup: Specifies if Mopidy-Pandora should automatically configure the Mopidy player for best compatibility with the Pandora radio stream. Defaults to true and turns consume on and repeat, random, and single modes off.

  • pandora/cache_time_to_live: Specifies the length of time (in seconds) that station and genre lists should be cached for between automatic refreshes. Using a local cache greatly speeds up browsing the library. It should not be necessary to fiddle with this unless the Mopidy frontend that you are using does not support manually refreshing the library, and you want mopidy-pandora to immediately detect changes to your Pandora user profile that are made in other Pandora players. Setting this to 0 will disable caching completely and ensure that the latest lists are always retrieved directly from the Pandora server. Defaults to 86400 (i.e. 24 hours).

It is also possible to apply Pandora ratings and perform other actions on the currently playing track using the standard pause/play/previous/next buttons.

  • pandora/event_support_enabled: Setting this to true will enable the event triggers. Event support is disabled by default as this is still an experimental feature, and not something that is provided for in the Mopidy API. It works, but it is not impossible that the wrong events may be triggered for tracks or (in the worst case scenario) that one of your stations may be deleted accidentally. Mileage may vary - use at your own risk.

  • pandora/double_click_interval: Successive button clicks that occur within this interval will trigger an event. Defaults to 2.50 seconds.

  • pandora/on_pause_resume_click: Click pause and then play while a song is playing to trigger the event. Defaults to thumbs_up.

  • pandora/on_pause_next_click: Click pause and then next in quick succession. Calls event and skips to next song. Defaults to thumbs_down.

  • pandora/on_pause_previous_click: Click pause and then previous in quick succession. Calls event and restarts the current song. Defaults to sleep.

  • pandora/on_pause_resume_pause_click: Click pause, resume, and pause again in quick succession (i.e. triple click). Calls event. Defaults to delete_station.

The full list of supported events are: thumbs_up, thumbs_down, sleep, add_artist_bookmark, add_song_bookmark, and delete_station.

Project resources

Development

Set up development environment

Clone the repo using, e.g. using gh:

gh repo clone mopidy/mopidy-pandora

Enter the directory, and install dependencies using uv:

cd mopidy-pandora/
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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mopidy_pandora-2.0.0a2.tar.gz (49.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mopidy_pandora-2.0.0a2-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file mopidy_pandora-2.0.0a2.tar.gz.

File metadata

  • Download URL: mopidy_pandora-2.0.0a2.tar.gz
  • Upload date:
  • Size: 49.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mopidy_pandora-2.0.0a2.tar.gz
Algorithm Hash digest
SHA256 e44d70ddffce4d941e01bb3049ebd57efdff98bc4f9026b61aedd9c3f630172f
MD5 11490465b57f8230adbc9544024165cb
BLAKE2b-256 7da8ce3c1a5ed182d34cc45810d2b221c29644ace1686b02abd82f390fdc8d16

See more details on using hashes here.

Provenance

The following attestation bundles were made for mopidy_pandora-2.0.0a2.tar.gz:

Publisher: release.yml on mopidy/mopidy-pandora

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mopidy_pandora-2.0.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for mopidy_pandora-2.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 35fa8fc7d1725d3e7fe90cc911f6881ff2389b247b4bd1bb388b6a62ecb0a64c
MD5 a80edadb2f3227b9fd018ccfed89a7e9
BLAKE2b-256 34e926abfa5f3c1600318a3c9d97352521dbffe4314a53cc231958a57351c3e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mopidy_pandora-2.0.0a2-py3-none-any.whl:

Publisher: release.yml on mopidy/mopidy-pandora

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page