Escaping double quotes in mpd commands and hidden playlists

Discuss client development (or even MPD development if you feel so inclined), ask questions about the client libs, MPD feature requests from client developers, etc...
Post Reply
phisehu
Posts: 1
Joined: September 13th, 2014, 7:18 pm

Escaping double quotes in mpd commands and hidden playlists

Post by phisehu » September 13th, 2014, 8:43 pm

Hello,

after closing time, I am currently developing an mpd client called "MUSCHSY" (music scheduling system), which should be finished by the end of the year. MUSCHSY will consist of a web interface (PHP/lighttpd) and some administrative and background scripts (written in bash/sed/gawk).

In contrast to all the other media players, MUSCHSY should provide an explicit multiuser interface to a single audio output
(some kind of time-sharing system). Every user can manage his "private" playlist via WLAN using a web interface. MUSCHSY will rotatorily remove songs from the beginning of the private playlists and append them to the current mpd playlist (the "public" playlist), which is not directly accessible by ordinary MUSCHSY users (with adminstrator privileges you may, however, directly manipulate the "public" playlist as with the other mpd web clients). The "private" playlists are stored mpd playlists following a special naming convention (".privpl-USER.m3u").

Having recently started development, I stumbled on two questions regarding the mpd behaviour.

1.) The mpd protocol reference says that:
If arguments contain spaces, they should be surrounded by double quotation marks.
My first question therefore is, how double quotation marks themselves should be escaped if they are contained in an argument? Does mpd follow the standard Unix conventions, i. e. that they should prefixed with a backslash?

2.) It may sometimes be appropriate to temporarily deactivate MUSCHSY and return to standard single-user clients such as Sonata or ncmpc. The MUSCHSY private playlists shall of course not be visible to other clients by default, therefore I made their filenames start with a period (e. g. .privpl-userXX.m3u), following the ordinary Unix convention for "hidden" files. However, I found out that the mpd "listplaylists" command still shows them.

Therefore, I'd like to ask whether it might be possible to add a mpd.conf switch to future mpd releases so that playlists whose names begin with a dot may not be visible (yet accessible by explicit naming) to clients by default.

Best regards,
phisehu

max
Forum team
Posts: 940
Joined: January 15th, 2013, 3:43 pm

Re: Escaping double quotes in mpd commands and hidden playli

Post by max » September 14th, 2014, 4:36 am

phisehu wrote:My first question therefore is, how double quotation marks themselves should be escaped if they are contained in an argument? Does mpd follow the standard Unix conventions, i. e. that they should prefixed with a backslash?
Backslash. I will clarify the protocol documentation. This has been missing forever.
The MUSCHSY private playlists shall of course not be visible to other clients by default, therefore I made their filenames start with a period (e. g. .privpl-userXX.m3u), following the ordinary Unix convention for "hidden" files. However, I found out that the mpd "listplaylists" command still shows them.
There is no such thing as "hidden" or "private" playlists in MPD. All resources belong to all clients. If you want private playlists, manage them on the client side.

Post Reply