Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage plugins documentation lists non-existing mpc commands. #289

Closed
carnager opened this issue Jun 6, 2018 · 2 comments
Closed

storage plugins documentation lists non-existing mpc commands. #289

carnager opened this issue Jun 6, 2018 · 2 comments

Comments

@carnager
Copy link
Contributor

@carnager carnager commented Jun 6, 2018

https://www.musicpd.org/doc/user/music_directory_and_database.html#mount

has the section about storage mounts, which reads:

 MPD has various storage plugins of which multiple instances can be "mounted" into the music directory. This way, you can use local music, file servers and USB sticks at the same time. Example:

mpc mount foo nfs://192.168.1.4/export/mp3
mpc mount usbstick udisks://by-uuid-2F2B-D136
mpc unmount usbstick

MPD's neighbor plugins can be helpful with finding mountable storages:

mpc listneighbors

Neither mount nor listneighbors exists in mpc.

Version used: mpc version: 0.31 (built from git master yesterday)

@MaxKellermann

This comment has been minimized.

Copy link
Member

@MaxKellermann MaxKellermann commented Jun 6, 2018

I know I've documented commands that do not exist just yet. Please write feature request for mpc to keep track of this.

@ronalde

This comment has been minimized.

Copy link

@ronalde ronalde commented Nov 12, 2018

@carnager You can always use something like this:

#!/usr/bin/env bash
function query_mpd() {
    ## query mpd using bash sockets (so we don't need mpc)
    mpd_command="$1"
    mpd_host="${MPD_HOST:-localhost}"
    mpd_port="${MPD_PORT:-6600}"
    # open a input/output socket to the mpd host
    exec 3<>/dev/tcp/${mpd_host}/${mpd_port}
    # send a command list to the socket
    printf "command_list_begin\n%s\nclose\ncommand_list_end\n" \
	   "${mpd_command}" >&3
    # read out the result
    while read -r line; do
	echo "${line}"
    done<&3
    # close the sockets
    exec 3<&-
    exec 3>&-
}

query_mpd "$1" &

When you store this bash script in the file ~/query-mpd you can use the following command to send an arbitrary command to mpd:

bash ~/query-mpd listneighbors

Because the bash script uses printf you can multiple commands by separating them with a newline character (\n) for example:

bash ~/query-mpd "listneighbors\nsomethingelse"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.