Friday, May 27, 2016

Grab MPD status

Grab MPD status


install MPC
set bind address on mpd.conf to "0.0.0.0"

run command

echo "currentsong" | nc localhost 6600 | grep - e "^Title: " -e "^Name: "

echo "currentsong" | nc localhost 6600 | grep -e "^Name: "|cut -d: -f2
echo "currentsong" | nc localhost 6600 |grep -e "Name"|cut -d: -f2


example

root@OpenWrt:/mnt/data/mp3/slow# echo "currentsong" | nc localhost 6600 | grep -
e "^Title: " -e "^Name: "


Result
Title: Mark Blee - MOVIN' ON! 23.05.16 - Mark Blee - MOVIN' ON! 23.05.16
Name: SOULPOWER-RADIO.COM
root@OpenWrt:/mnt/data/mp3/slow#



MPD on OpenWRT

MPD on OpenWRT

Step :

1. exroot
2. install soundcard driver

# Opkg install kmod-sound-core kmod-usb-audio alsa-utils
3. Install MPC and MPD

# Opkg install mpd mpc alsa-utils

4. Edit mpd.conf file

music_directory         "/mnt/data/mp3"
playlist_directory              "/mnt/data/mpd/playlists"
db_file                 "/mnt/data/mpd/database"
log_file                        "/mnt/data/mpd/log"
pid_file                        "/mnt/data/mpd/mpd.pid"
state_file                      "/mnt/data/mpd/state"
bind_to_address         "0.0.0.0"
port                            "6600"
log_level                       "default"
gapless_mp3_playback           "yes"
save_absolute_paths_in_playlists        "yes"
metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,dis
auto_update     "yes"
auto_update_depth "0"
follow_outside_symlinks "yes"
follow_inside_symlinks          "yes"
password                        "password@read,add,control,admin"
default_permissions             "read,add,control,admin"
input {
        plugin "curl"
}
# An example of an ALSA output:
#
audio_output {
        type            "alsa"
        name            "My ALSA Device"
        format          "44100:16:2"
        device          "hw:0,0"        # optional
        mixer_type      "software"      # optional
        mixer_device    "default"       # optional
        mixer_control   "software"              # optional
        mixer_index     "0"             # optional

}


goto  file /etc/init.d/mpd
change
 [ -x /usr/bin/amixer ] && /usr/bin/amixer set PCM 40
 to
[ -x /usr/bin/amixer ] && /usr/bin/amixer set Speaker 150