Skip to main content

Mopidy extension for controlling Mopidy through the MPRIS D-Bus interface

Project description

Latest PyPI version Number of PyPI downloads Travis CI build status Test coverage

Mopidy extension for controlling Mopidy through the MPRIS D-Bus interface.

An example of an MPRIS client is the Ubuntu Sound Menu.

Dependencies

  • D-Bus Python bindings. The package is named python-dbus in Ubuntu/Debian.

  • libindicate Python bindings is needed to expose Mopidy in e.g. the Ubuntu Sound Menu. The package is named python-indicate in Ubuntu/Debian.

  • An .desktop file for Mopidy installed at the path set in the mpris/desktop_file config value. Mopidy installs this by default. See usage section below for details.

Installation

Install by running:

pip install Mopidy-MPRIS

Or, if available, install the Debian/Ubuntu package from apt.mopidy.com.

Configuration

There’s no configuration needed for the MPRIS extension to work.

The following configuration values are available:

  • mpris/enabled: If the MPRIS extension should be enabled or not.

  • mpris/desktop_file: Path to Mopidy’s .desktop file.

Usage

The extension is enabled by default if all dependencies are available.

Controlling Mopidy through the Ubuntu Sound Menu

If you are running Ubuntu and installed Mopidy using the Debian package from APT you should be able to control Mopidy through the Ubuntu Sound Menu without any changes.

If you installed Mopidy in any other way and want to control Mopidy through the Ubuntu Sound Menu, you must install the mopidy.desktop file which can be found in the data/ dir of the Mopidy source repo into the /usr/share/applications dir by hand:

cd /path/to/mopidy/source
sudo cp data/mopidy.desktop /usr/share/applications/

If the correct path to the installed mopidy.desktop file on your system isn’t /usr/share/applications/mopidy.conf, you’ll need to set the mpris/desktop_file config value.

After you have installed the file, start Mopidy in any way, and Mopidy should appear in the Ubuntu Sound Menu. When you quit Mopidy, it will still be listed in the Ubuntu Sound Menu, and may be restarted by selecting it there.

The Ubuntu Sound Menu interacts with Mopidy’s MPRIS frontend. The MPRIS frontend supports the minimum requirements of the MPRIS specification. The TrackList interface of the spec is not supported.

Testing the MPRIS API directly

To use the MPRIS API directly, start Mopidy, and then run the following in a Python shell:

import dbus
bus = dbus.SessionBus()
player = bus.get_object('org.mpris.MediaPlayer2.mopidy',
    '/org/mpris/MediaPlayer2')

Now you can control Mopidy through the player object. Examples:

  • To get some properties from Mopidy, run:

    props = player.GetAll('org.mpris.MediaPlayer2',
        dbus_interface='org.freedesktop.DBus.Properties')
  • To quit Mopidy through D-Bus, run:

    player.Quit(dbus_interface='org.mpris.MediaPlayer2')

For details on the API, please refer to the MPRIS specification.

Project resources

Changelog

v1.0.0 (2013-10-08)

  • Moved extension out of the main Mopidy project.

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-MPRIS-1.0.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

Mopidy_MPRIS-1.0.0-py27-none-any.whl (11.9 kB view details)

Uploaded Python 2.7

File details

Details for the file Mopidy-MPRIS-1.0.0.tar.gz.

File metadata

  • Download URL: Mopidy-MPRIS-1.0.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Mopidy-MPRIS-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8fe649408fd3b4bf0ef1be1a4e9fd476c99dae0f7d1cd6551944efa8d341099c
MD5 2692d2d5288b147f4f40f24b0ff46481
BLAKE2b-256 ff6599c215e6e1bdbd4ea5f56af203c5d0d4d40a94702d2554aeee1bb7caae80

See more details on using hashes here.

File details

Details for the file Mopidy_MPRIS-1.0.0-py27-none-any.whl.

File metadata

File hashes

Hashes for Mopidy_MPRIS-1.0.0-py27-none-any.whl
Algorithm Hash digest
SHA256 72b16ae1aeaabb280845009c6b2248d5eeb03907ca1a103cc6937aa2e6c83b52
MD5 20bb0d178f15822edf263534137a40d5
BLAKE2b-256 1280c8aa25fcf85caf682860a124ba5be6b6645867ceccc059c7dd6a408319ea

See more details on using hashes here.

Supported by

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