Skip to content

A MPD client implementing the dbus MPRIS standard written in rust

License

Notifications You must be signed in to change notification settings

jasger9000/mpdris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

157 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT License build GitHub release Issues

mpdris

A lightweight application that implements the media player D-Bus interface MPRIS for the Music Player Daemon (MPD).

Table of Contents:

Dependencies

Runtime

  • D-Bus
  • mpd
  • libc
  • gcc-libs
  • (Optional) systemd-libs
    • To be able to use the --service flag you need this dependency.
      If your system is using systemd it will already be installed for you

Compile time

  • cargo
  • libc
  • gcc-libs

Installation

To install this application, you can either...

Use the AUR package

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 AUR Version GitHub Link
Binary AUR Version GitHub Link
Git AUR Version GitHub Link

Build the AUR-package manually

  1. Clone the AUR package repository and cd into the directory:
    git clone https://aur.archlinux.org/mpdris.git
    cd mpdris
  2. Run the build & install command:
    makepkg --install --syncdeps
    # or if you want to remove the downloaded dependencies afterwards:
    makepkg --install --syncdeps --rmdeps
  3. Enable the service to start it with MPD
    systemctl --user enable mpdris.service

Build the application yourself

  1. Clone this repository
    git clone https://github.com/jasger9000/mpdris.git
  2. Build the project with
    cargo build --release
  3. Move the resulting file from target/release/mpdris to /usr/local/bin
  4. Copy resources/mpdris.service.local to /usr/local/lib/systemd/user (You might have to create that directory first) and rename it to mpdris.service
  5. Enable the service to start it with MPD
    systemctl --user enable mpdris.service

Install using release binary/tarball

  1. Go to the release tab
  2. 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
  3. Move the binary to /usr/local/bin and rename it to mpdris if needed
  4. Add the execute permission to the file with
    chmod +x /usr/local/bin/mpdris
  5. Move mpdris.service.local to /usr/local/lib/systemd/user (You might have to create that directory first) and rename it to mpdris.service
    • mpdris.service.local can be found in the release tarball or downloaded here
  6. Enable the service to start it with MPD
    systemctl --user enable mpdris.service

Configuration

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)

Covers - cover_directory & music_directory

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)

Example

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

Roadmap

  • implement base interface
  • implement player interface
  • add control functionality
  • add a manpage
  • add ffmpeg cover support
  • implement tracklist interface

Contributing

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.

Packaging

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.

Licence

The Project is Licensed under the MIT Licence

Authors

About

A MPD client implementing the dbus MPRIS standard written in rust

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published