The officially official Devuan Forum!

You are not logged in.

#1 2020-01-12 18:47:48

Ogis1975
Member
Registered: 2017-04-21
Posts: 118  
Website

Install music player daemon and set up it as a user service in Devuan

This short guide  describes how to install mpd as a user service in Devuan 2.1 (ascii).
Install mpd and mpc

#apt install mpd mpc

Mpc is a command line user interface for MPD server.

By default Devuan installs mpd as a system service. We don't want this, so let's remove it from startup.
If mpd is running stop it first.

#/etc/init.d/mpd stop

We don't want MPD to be started as a system service. We want to run it from a regular user account. So we must disable it. Use this command:

#update-rc.d mpd disable

To build the user configuration, extract and copy the default config with command

gunzip -c /usr/share/doc/mpd/examples/mpd.conf.gz

to directory

~/.config/mpd

(make this dir first).

Edit the config file according to your needs. For example, my config looks like this:

music_directory     "~/Music"
playlist_directory  "~/Playlists"
db_file             "~/.local/share/mpd/mpd.db"
log_file            "~/.local/share/mpd/mpd.log"
pid_file            "~/.local/share/mpd/mpd.pid"
state_file          "~/.local/share/mpd/mpd.state"
sticker_file        "~/.local/share/mpd/sticker.sql"

bind_to_address     "127.0.0.1"
log_level           "default"
restore_paused      "yes"
metadata_to_use     "artist,album,title,track,date"
auto_update         "yes"

input {
        plugin "curl"
}

audio_output {
        type            "alsa"
        name            "Headset"
        mixer_type      "software"      
}

audio_output {
    type        "fifo"
    name        "mpd_fifo"
    path        "/tmp/mpd.fifo"
    format      "44100:16:2"
}

Don't forget to create the needed directories (~/Playlists and ~/.local/share/mpd)

Run mpd.

$ mpd

If everything is ok, it directly detaches itself. (so it looks like it exits). It might complain that the db_file cannot be found, you can safely ignore this.

In order to build the database file, MPD must scan into the music_directory. A MPD client is required to request this task, for example with mpc the command is

$ mpc update

.

You most likely want to have mpd started automatically when logging into tty. To start MPD on login add the following to

~/.profile
# MPD daemon start (if no other user instance exists)
[ ! -s ~/.config/mpd/pid ] && mpd

That's it. Now you can enjoy your favorite music.

P.S.

In this simple set up i use command line user interface for MPD server. Here you can see the commands used in mpc. But there are more clients in the official Devuan repository (TUI and GUI).

2020-01-12-204649-1920x1080-scrot.png

Last edited by Ogis1975 (2020-01-12 18:55:55)

Offline

#2 2020-01-15 14:49:40

Nili
Member
From: $HOME/♫♪
Registered: 2016-12-01
Posts: 96  
Website

Re: Install music player daemon and set up it as a user service in Devuan

Thanks for sharing the guide Ogis1975, When it comes to cli audio player mpd (Daemon) is irreplaceable.

Last edited by Nili (2020-01-15 14:50:17)


OS0: FreeBSD - WM: CWM
OS1: Devuan - WM: Fluxbox (lean & mean)
I only play 96kHz Hi-Res audio WAV / FLAC via DAC player or DeaDBeeF on Linux
Chuck Norris doesn't approve systemd

Offline

Board footer