{"id":19754950,"url":"https://github.com/mopidy/mopidy-mpris","last_synced_at":"2025-04-30T11:31:47.743Z","repository":{"id":44901129,"uuid":"13395495","full_name":"mopidy/mopidy-mpris","owner":"mopidy","description":"Mopidy extension for controlling Mopidy through the MPRIS D-Bus interface","archived":false,"fork":false,"pushed_at":"2023-06-21T20:19:41.000Z","size":198,"stargazers_count":34,"open_issues_count":8,"forks_count":12,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-04-26T04:45:31.012Z","etag":null,"topics":["mopidy","mopidy-frontend","mpris","python"],"latest_commit_sha":null,"homepage":"https://mopidy.com/ext/mpris/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mopidy.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-07T20:51:54.000Z","updated_at":"2023-12-03T01:22:17.000Z","dependencies_parsed_at":"2022-09-26T17:21:33.845Z","dependency_job_id":null,"html_url":"https://github.com/mopidy/mopidy-mpris","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopidy%2Fmopidy-mpris","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopidy%2Fmopidy-mpris/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopidy%2Fmopidy-mpris/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopidy%2Fmopidy-mpris/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mopidy","download_url":"https://codeload.github.com/mopidy/mopidy-mpris/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224208101,"owners_count":17273674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mopidy","mopidy-frontend","mpris","python"],"created_at":"2024-11-12T03:06:55.672Z","updated_at":"2024-11-12T03:06:56.339Z","avatar_url":"https://github.com/mopidy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"************\nMopidy-MPRIS\n************\n\n.. image:: https://img.shields.io/pypi/v/Mopidy-MPRIS\n    :target: https://pypi.org/project/Mopidy-MPRIS/\n    :alt: Latest PyPI version\n\n.. image:: https://img.shields.io/github/actions/workflow/status/mopidy/mopidy-mpris/ci.yml?branch=main\n    :target: https://github.com/mopidy/mopidy-mpris/actions\n    :alt: CI build status\n\n.. image:: https://img.shields.io/codecov/c/gh/mopidy/mopidy-mpris\n    :target: https://codecov.io/gh/mopidy/mopidy-mpris\n    :alt: Test coverage\n\n`Mopidy`_ extension for controlling Mopidy through D-Bus using the `MPRIS\nspecification`_.\n\nMopidy-MPRIS supports the minimum requirements of the `MPRIS specification`_\nas well as the optional `Playlists interface`_. The `TrackList interface`_\nis currently not supported.\n\n.. _Mopidy: https://www.mopidy.com/\n.. _MPRIS specification: https://specifications.freedesktop.org/mpris-spec/latest/\n.. _Playlists interface: https://specifications.freedesktop.org/mpris-spec/latest/Playlists_Interface.html\n.. _TrackList interface: https://specifications.freedesktop.org/mpris-spec/latest/Track_List_Interface.html\n\n\nMaintainer wanted\n=================\n\nMopidy-MPRIS is currently kept on life support by the Mopidy core developers.\nIt is in need of a more dedicated maintainer.\n\nIf you want to be the maintainer of Mopidy-MPRIS, please:\n\n1. Make 2-3 good pull requests improving any part of the project.\n\n2. Read and get familiar with all of the project's open issues.\n\n3. Send a pull request removing this section and adding yourself as the\n   \"Current maintainer\" in the \"Credits\" section below. In the pull request\n   description, please refer to the previous pull requests and state that\n   you've familiarized yourself with the open issues.\n\n   As a maintainer, you'll be given push access to the repo and the authority\n   to make releases to PyPI when you see fit.\n\n\nTable of contents\n=================\n\n- Requirements_\n- Installation_\n- Configuration_\n- Usage_\n- Clients_\n\n  - `GNOME Shell builtin`_\n  - `gnome-shell-extensions-mediaplayer`_\n  - `gnome-shell-extensions-mpris-indicator-button`_\n  - `Ubuntu Sound Menu`_\n\n- `Advanced setups`_\n\n  - `Running as a service`_\n  - `MPRIS on the system bus`_\n  - `UPnP/DLNA with Rygel`_\n\n- `Development tips`_\n\n  - `Browsing the MPRIS API with D-Feet`_\n  - `Testing the MPRIS API with pydbus`_\n\n- `Project resources`_\n- Credits_\n\n\nRequirements\n============\n\n- `pydbus`_ D-Bus Python bindings, which again depends on ``python-gi``. Thus\n  it is usually easiest to install with your distribution's package manager.\n\n.. _pydbus: https://github.com/LEW21/pydbus\n\n\nInstallation\n============\n\nInstall by running::\n\n    sudo python3 -m pip install Mopidy-MPRIS\n\nSee https://mopidy.com/ext/mpris/ for alternative installation methods.\n\n\nConfiguration\n=============\n\nNo configuration is required for the MPRIS extension to work.\n\nThe following configuration values are available:\n\n- ``mpris/enabled``: If the MPRIS extension should be enabled or not.\n  Defaults to ``true``.\n\n- ``mpris/bus_type``: The type of D-Bus bus Mopidy-MPRIS should connect to.\n  Choices include ``session`` (the default) and ``system``.\n\n\nUsage\n=====\n\nOnce Mopidy-MPRIS has been installed and your Mopidy server has been\nrestarted, the Mopidy-MPRIS extension announces its presence on D-Bus so that\nany MPRIS compatible clients on your system can interact with it. Exactly how\nyou control Mopidy through MPRIS depends on which MPRIS client you use.\n\n\nClients\n=======\n\nThe following clients have been tested with Mopidy-MPRIS.\n\nGNOME Shell builtin\n-------------------\n\nState:\n    Not working\nTested versions:\n    Ubuntu 18.10,\n    GNOME Shell 3.30.1-2ubuntu1,\n    Mopidy-MPRIS 2.0.0\n\nGNOME Shell, which is the default desktop on Ubuntu 18.04 onwards, has a\nbuiltin MPRIS client. This client seems to work well with Spotify's player,\nbut Mopidy-MPRIS does not show up here.\n\nIf you have any tips on what's missing to get this working, please open an\nissue.\n\ngnome-shell-extensions-mediaplayer\n----------------------------------\n\nState:\n    Working\nTested versions:\n    Ubuntu 18.10,\n    GNOME Shell 3.30.1-2ubuntu1,\n    gnome-shell-extension-mediaplayer 63,\n    Mopidy-MPRIS 2.0.0\nWebsite:\n    https://github.com/JasonLG1979/gnome-shell-extensions-mediaplayer\n\ngnome-shell-extensions-mediaplayer is a quite feature rich MPRIS client\nbuilt as an extension to GNOME Shell. With the improvements to Mopidy-MPRIS\nin v2.0, this extension works very well with Mopidy.\n\ngnome-shell-extensions-mpris-indicator-button\n---------------------------------------------\n\nState:\n    Working\nTested versions:\n    Ubuntu 18.10,\n    GNOME Shell 3.30.1-2ubuntu1,\n    gnome-shell-extensions-mpris-indicator-button 5,\n    Mopidy-MPRIS 2.0.0\nWebsite:\n    https://github.com/JasonLG1979/gnome-shell-extensions-mpris-indicator-button/\n\ngnome-shell-extensions-mpris-indicator-button is a minimalistic version of\ngnome-shell-extensions-mediaplayer. It works with Mopidy-MPRIS, with the\nexception of the play/pause button not changing state when Mopidy starts\nplaying.\n\nIf you have any tips on what's missing to get the play/pause button display\ncorrectly, please open an issue.\n\nUbuntu Sound Menu\n-----------------\n\nState:\n    Unknown\n\nHistorically, Ubuntu Sound Menu was the primary target for Mopidy-MPRIS'\ndevelopment. Since Ubuntu 18.04 replaced Unity with GNOME Shell, this is no\nlonger the case. It is currently unknown to what degree Mopidy-MPRIS works\nwith old Ubuntu setups.\n\nIf you run an Ubuntu setup with Unity and have tested Mopidy-MPRIS, please\nopen an issue to share your results.\n\n\nAdvanced setups\n===============\n\nRunning as a service\n--------------------\n\nIf you have input on how to best configure Mopidy-MPRIS when Mopidy is\nrunning as a service, please add a comment to `issue #15`_.\n\n.. _issue #15: https://github.com/mopidy/mopidy-mpris/issues/15\n\nMPRIS on the system bus\n-----------------------\n\nYou can set the ``mpris/bus_type`` config value to ``system``. This will lead\nto Mopidy-MPRIS making itself available on the system bus instead of the\nlogged in user's session bus.\n\n.. note::\n    Few MPRIS clients will try to access MPRIS devices on the system bus, so\n    this will give you limited functionality. For example, media keys in\n    GNOME Shell does not work with media players that expose their MPRIS\n    interface on the system bus instead of the user's session bus.\n\nThe default setup will often not permit Mopidy to publish its service on the\nD-Bus system bus, causing a warning similar to this in Mopidy's log::\n\n    MPRIS frontend setup failed (g-dbus-error-quark:\n    GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Connection \":1.3071\"\n    is not allowed to own the service \"org.mpris.MediaPlayer2.mopidy\" due to\n    security policies in the configuration file (9))\n\nTo solve this, create the file\n``/etc/dbus-1/system.d/org.mpris.MediaPlayer2.mopidy.conf`` with the\nfollowing contents:\n\n.. code:: xml\n\n    \u003c!DOCTYPE busconfig PUBLIC \"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN\"\n    \"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd\"\u003e\n    \u003cbusconfig\u003e\n      \u003c!-- Allow mopidy user to publish the Mopidy-MPRIS service --\u003e\n      \u003cpolicy user=\"mopidy\"\u003e\n        \u003callow own=\"org.mpris.MediaPlayer2.mopidy\"/\u003e\n      \u003c/policy\u003e\n\n      \u003c!-- Allow anyone to invoke methods on the Mopidy-MPRIS service --\u003e\n      \u003cpolicy context=\"default\"\u003e\n        \u003callow send_destination=\"org.mpris.MediaPlayer2.mopidy\"/\u003e\n        \u003callow receive_sender=\"org.mpris.MediaPlayer2.mopidy\"/\u003e\n      \u003c/policy\u003e\n    \u003c/busconfig\u003e\n\nIf you run Mopidy as another user than ``mopidy``, you must\nupdate ``user=\"mopidy\"`` in the above file accordingly.\n\nOnce the file is in place, you must restart Mopidy for the change to take\neffect.\n\nTo test the setup, you can run the following command as any user on the\nsystem to play/pause the music::\n\n    dbus-send --system --print-reply \\\n      --dest=org.mpris.MediaPlayer2.mopidy \\\n      /org/mpris/MediaPlayer2 \\\n      org.mpris.MediaPlayer2.Player.PlayPause\n\nUPnP/DLNA with Rygel\n--------------------\n\nRygel_ is an application that will translate between Mopidy's MPRIS interface\nand UPnP. Rygel must be run on the same machine as Mopidy, but will make\nMopidy controllable by any device on the local network that can control a\nUPnP/DLNA MediaRenderer.\n\n.. _Rygel: https://wiki.gnome.org/Projects/Rygel\n\nThe setup process is approximately as follows:\n\n1. Install Rygel.\n\n   On Debian/Ubuntu/Raspbian::\n\n       sudo apt install rygel\n\n2. Enable Rygel's MPRIS plugin.\n\n   On Debian/Ubuntu/Raspbian, edit ``/etc/rygel.conf``, find the ``[MPRIS]``\n   section, and change ``enabled=false`` to ``enabled=true``.\n\n3. Start Rygel.\n\n   To start it as the current user::\n\n       systemctl --user start rygel\n\n   To make Rygel start as the current user on boot::\n\n       systemctl --user enable rygel\n\n4. Configure your system's firewall to allow the local network to reach\n   Rygel. Exactly how is out of scope for this document.\n\n5. Start Mopidy with Mopidy-MPRIS enabled.\n\n6. If you view Rygel's log output with::\n\n       journalctl --user -feu rygel\n\n   You should see a log statement similar to::\n\n       New plugin \"org.mpris.MediaPlayer2.mopidy\" available\n\n6. If everything went well, you should now be able to control Mopidy from a\n   device on your local network that can control an UPnP/DLNA MediaRenderer,\n   for example the Android app BubbleUPnP.\n\nAlternatively, `upmpdcli combined with Mopidy-MPD`_ serves the same purpose as\nthis setup.\n\n.. _upmpdcli combined with Mopidy-MPD: https://docs.mopidy.com/en/latest/clients/upnp/\n\n\nDevelopment tips\n================\n\nMopidy-MPRIS has an extensive test suite, so the first step for all changes\nor additions is to add a test exercising the new code. However, making the\ntests pass doesn't ensure that what comes out on the D-Bus bus is correct. To\nintrospect this through the bus, there's a couple of useful tools.\n\n\nBrowsing the MPRIS API with D-Feet\n----------------------------------\n\nD-Feet is a graphical D-Bus browser. On Debian/Ubuntu systems it can be\ninstalled by running::\n\n    sudo apt install d-feet\n\nThen run the ``d-feet`` command. In the D-Feet window, select the tab\ncorresponding to the bus you run Mopidy-MPRIS on, usually the session bus.\nThen search for \"MediaPlayer2\" to find all available MPRIS interfaces.\n\nTo get the current value of a property, double-click it. To execute a method,\ndouble-click it, provide any required arguments, and click \"Execute\".\n\nFor more information on D-Feet, see the `GNOME wiki\n\u003chttps://wiki.gnome.org/Apps/DFeet\u003e`_.\n\n\nTesting the MPRIS API with pydbus\n---------------------------------\n\nTo use the MPRIS API directly, start Mopidy, and then run the following in a\nPython shell to use ``pydbus`` as an MPRIS client::\n\n    \u003e\u003e\u003e import pydbus\n    \u003e\u003e\u003e bus = pydbus.SessionBus()\n    \u003e\u003e\u003e player = bus.get('org.mpris.MediaPlayer2.mopidy', '/org/mpris/MediaPlayer2')\n\nNow you can control Mopidy through the player object. To get properties from\nMopidy, run for example::\n\n    \u003e\u003e\u003e player.PlaybackStatus\n    'Playing'\n    \u003e\u003e\u003e player.Metadata\n    {'mpris:artUrl': 'https://i.scdn.co/image/8eb49b41eeb45c1cf53e1ddfea7973d9ca257777',\n     'mpris:length': 342000000,\n     'mpris:trackid': '/com/mopidy/track/36',\n     'xesam:album': '65/Milo',\n     'xesam:albumArtist': ['Kiasmos'],\n     'xesam:artist': ['Rival Consoles'],\n     'xesam:discNumber': 1,\n     'xesam:title': 'Arp',\n     'xesam:trackNumber': 5,\n     'xesam:url': 'spotify:track:7CoxEEsqo3XdvUsScRV4WD'}\n    \u003e\u003e\u003e\n\nTo pause Mopidy's playback through D-Bus, run::\n\n    \u003e\u003e\u003e player.Pause()\n    \u003e\u003e\u003e\n\nFor details on the API, please refer to the `MPRIS specification\n\u003chttps://specifications.freedesktop.org/mpris-spec/latest/\u003e`__.\n\n\nProject resources\n=================\n\n- `Source code \u003chttps://github.com/mopidy/mopidy-mpris\u003e`_\n- `Issue tracker \u003chttps://github.com/mopidy/mopidy-mpris/issues\u003e`_\n- `Changelog \u003chttps://github.com/mopidy/mopidy-mpris/releases\u003e`_\n\n\nCredits\n=======\n\n- Original author: `Stein Magnus Jodal \u003chttps://github.com/jodal\u003e`__\n- Current maintainer: None. Maintainer wanted, see section above.\n- `Contributors \u003chttps://github.com/mopidy/mopidy-mpris/graphs/contributors\u003e`_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmopidy%2Fmopidy-mpris","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmopidy%2Fmopidy-mpris","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmopidy%2Fmopidy-mpris/lists"}