A lightweight application that implements the media player D-Bus interface MPRIS for the Music Player Daemon (MPD).
Table of Contents:
- D-Bus
- mpd
- libc
- gcc-libs
- (Optional) systemd-libs
- To be able to use the
--serviceflag you need this dependency.
If your system is using systemd it will already be installed for you
- To be able to use the
- cargo
- libc
- gcc-libs
To install this application, you can either...
- Use the AUR package (Arch Linux only)
- Build the application yourself
- Install the application from a release binary
Important
This only works on systems using pacman
The package is available on the AUR or GitHub (see table below)
You can either build the AUR-package yourself, as detailed below, or use your favourite AUR-helper.
Either way, it is strongly encouraged to read the respective PKGBUILD first.
| Type | AUR | GitHub |
|---|---|---|
| Default | GitHub Link | |
| Binary | GitHub Link | |
| Git | GitHub Link |
- Clone the AUR package repository and cd into the directory:
git clone https://aur.archlinux.org/mpdris.git cd mpdris - Run the build & install command:
makepkg --install --syncdeps # or if you want to remove the downloaded dependencies afterwards: makepkg --install --syncdeps --rmdeps - Enable the service to start it with MPD
systemctl --user enable mpdris.service
- Clone this repository
git clone https://github.com/jasger9000/mpdris.git
- Build the project with
cargo build --release
- Move the resulting file from
target/release/mpdristo/usr/local/bin - Copy
resources/mpdris.service.localto/usr/local/lib/systemd/user(You might have to create that directory first) and rename it tompdris.service - Enable the service to start it with MPD
systemctl --user enable mpdris.service
- Go to the release tab
- Download the correct tarball or binary for your architecture
- If you don't know what your architecture is, you can find out by running
lscpu
- If you don't know what your architecture is, you can find out by running
- Move the binary to
/usr/local/binand rename it tompdrisif needed - Add the execute permission to the file with
chmod +x /usr/local/bin/mpdris
- Move
mpdris.service.localto/usr/local/lib/systemd/user(You might have to create that directory first) and rename it tompdris.service- mpdris.service.local can be found in the release tarball or downloaded here
- Enable the service to start it with MPD
systemctl --user enable mpdris.service
You can configure mpdris using the configuration file or using command-line arguments.
The config file should either be located in $XDG_CONFIG_HOME/mpdris/mpdris.conf or ~/.config/mpdris/mpdris.conf
Note
While the paths $XDG_CONFIG_HOME/mpd/mpDris.conf and $HOME/mpd/mpDris.conf still work, they are
deprecated and may be removed in a future update.
The config file has the following options:
- addr: The IP address mpdris uses to connect to MPD (default: 127.0.0.1)
- port: The port mpdris uses to connect to MPD (default: 6600)
- retries: Defines the amount of times mpdris retries to establish a connection to MPD (default: 3)
- music_directory: The directory in which MPD searches for Music (default:
~/Music) - cover_directory: The dedicated directory to where your covers are stored. (default:
~/Music/covers)
mpdris will search the configured cover and music directory for image files that correspond to the currently playing song to display as cover art.
Paths will be searched in the following order, trying every extension before moving to the next one: — $cover_directory/$song_path/$filename.$ext — $cover_directory/$song_path/$parent_name.$ext — $music_directory/$song_path/$filename.$ext — $music_directory/$song_path/cover.$ext
$ext can be one of the following values: jpg, jpeg, png, webp, avif, jxl, bmp, gif, heif and heic.
$song_path is the file path in the music directory leading up to the current song.
$parent_name is the name of the parent directory of the current song. ($parent_name is excluded from $song_path when both are used)
Let's say you have a user who stores their music in ~/Music and sets their cover_directory to be in ~/Pictures/songcovers.
If they now play the song Resurrections.mp3 located in ~/Music/Celeste, mpdris will search in ~/Pictures/songcovers/Celeste/ for a file named Resurrections with one of the above-mentioned file extensions.
If it cannot find it there, it will move to the next path.
If the song is located in a subdirectory of the music directory, you can name a cover file the same name as the directory (denoted as $parent_name above), and it will be used for every song in that directory.
So sticking with the example from above, mpdris will search for a file named Celeste in cover_directory with one of the above-listed extensions.
If the song was one level deeper, so, for example, ~/Music/some/long/path/Celeste/Resurrections.mp3, mpdris would look for the cover with this path: ~/Pictures/songcovers/some/long/path/Celeste.$ext
- implement base interface
- implement player interface
- add control functionality
- add a manpage
- add ffmpeg cover support
- implement tracklist interface
Contributions are always welcome!
If you feel there's something missing/wrong/something that could be improved please open an issue.
Or if you want to add something yourself, just open a pull request and I will have a look at it as soon as I can.
If you want to create a package of this application yourself, you can use the xtask cargo subcommand.
Simply use cargo xtask build [<path>] [--arch <arch>] to build the project.
To create an install from that build, use cargo xtask install <path> [--arch <arch>]. Note that you have to run the build command first though.
You can also just create the manpage structure using cargo xtask man <dir>.
To create release assets (tarballs, binaries, SHA256sums) for x86_64, i686 and aarch64 with cargo xtask make-release-assets.
The Project is Licensed under the MIT Licence