Tuesday, September 16, 2014

mpd console player and ncmpcpp

For long time I've searched for a good music player. I've settled with mpd (music player daemon) and as a graphical frontend I use ncmpcpp. This post shows how to install and configure mpd and ncmpcpp.

With recently pushed beta version into ArchLinux repositories, you need to install:
  • pacman -S ncmpcpp mpd boost
Main configuration file for mpd is stored (in my case) in ~/.mpd/mpd.conf.
music_directory         "/home/krisko/music"
playlist_directory      "/home/krisko/.mpd/playlists"
db_file                 "/home/krisko/.mpd/mpd.db"
log_file                "/home/krisko/.mpd/log"
pid_file                "/home/krisko/.mpd/pid"
state_file              "/home/krisko/.mpd/state"
sticker_file            "/home/krisko/.mpd/sticker.sql"

user                    "krisko"
group                   "krisko"
bind_to_address         "/home/krisko/.mpd/socket"

password                "MYPASSWD@read,add,control,admin"


input {
        plugin "curl"
}

audio_output {
        type            "alsa"
        name            "My ALSA Device"
        format          "44100:16:2"    # optional
        mixer_control   "Master"        # optional
        mixer_index     "0"             # optional
}

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

filesystem_charset              "UTF-8"
NOTE: this is stripped-down configuration, without comments. Full example can be found in /usr/share/doc/mpd/mpdconf.example (ArchLinux).

To start mpd daemon use command: mpd ~/.mpd/mpd.conf
I've written a script, that handles basic operations like play, stop, etc. and can delete currently playing song.
This script can be found in post Controlling mpd with notifications for Gnome 3 and KDE.

ncmpcpp configuration:
Configuration file can be found in ~/.ncmpcpp/config:
##### connection settings #####
mpd_host = "/home/krisko/.mpd/socket"
#mpd_port = "6600"
mpd_music_dir = "/home/krisko/music"
mpd_connection_timeout = "5"
mpd_crossfade_time = "1"
##### delays 
######playlist_disable_highlight_delay = "5"
message_delay_time = "4"
##### song format 
######song_list_format = "{%a - %t}|{$8%f$9}%r{$3(%l)$9}"
song_library_format = "{%n - }{%t}|{%f}"
#media_library_album_format = "{(%y) }%b"
tag_editor_album_format = "{(%y) }%b"
browser_playlist_prefix = "$2playlist$9 "
selected_item_prefix = "$6"
selected_item_suffix = "$9"
song_status_format = "{(%l) }{%a - }{%t}|{%f}"
song_window_title_format = "{%a - }{%t}|{%f}"
song_columns_list_format = "(4)[magenta]{l} (18)[cyan]{a} (20)[blue]{t} (20)[white]{b} (20)[green]{f}"
#song_columns_list_format = "(7)[magenta]{l} (28)[cyan]{a} (30)[blue]{t}"
alternative_header_first_line_format = "{%t}"
alternative_header_second_line_format = "$7{%a} - $5{%b} $8{(%y)}"
##### various settings 
playlist_display_mode = "columns"
incremental_seeking = "yes"
seek_time = "1"
autocenter_mode = "yes"
#repeat_one_mode = "no"
default_place_to_search_in = "database"
#media_library_left_column = "a"
default_find_mode = "wrapped"
default_space_mode = "add"
#default_tag_editor_left_col = "albums"
default_tag_editor_pattern = "%n - %t"
header_visibility = "yes"
header_text_scrolling = "yes"
cyclic_scrolling = "yes"
statusbar_visibility = "yes"
#fancy_scrolling = "yes"
follow_now_playing_lyrics = "yes"
#lyrics_database = "2"
#ncmpc_like_songs_adding = "yes"
#display_screens_numbers_on_start = "yes"
clock_display_seconds = "yes"
enable_window_title = "yes"
user_interface = "alternative"
progressbar_look = "=>-"
##### colors definitions 
colors_enabled = "yes"
empty_tag_color = "cyan"
header_window_color = "default"
volume_color = "default"
state_line_color = "default"
state_flags_color = "default"
main_window_color = "cyan"
color1 = "white"
color2 = "green"
main_window_highlight_color = "blue"
progressbar_color = "blue"
statusbar_color = "default"
active_column_color = "red"
window_border_color = "green"
active_window_border = "red"
alternative_ui_separator_color = "black"
#music visualizer
visualizer_fifo_path = "/tmp/mpd.fifo"
# krisko beta options
jump_to_now_playing_song_at_start = "yes"
To start ncmpcpp you need to either enter a password (as this is setup in mpd.conf) or you can create an alias:
alias ncmpcpp='ncmpcpp -h MYPASSWD@/home/krisko/.mpd/socket'

Screenshot:

No comments:

Post a Comment