MusicPlayerDaemon / mpc

Command-line client for MPD
GNU General Public License v2.0
191 stars 36 forks source link

Feature request: json format output option #48

Closed rdica closed 5 years ago

rdica commented 5 years ago

I am able to template a format for json use, but if a field contains ' or ", that breaks json.

Here's an example of the template I used, result includes data with unescaped ":

mpc -f '{"artist": "%artist%",["album": "%album%",]"title": "%title%",["track_number": "%track%",]"duration": "%time%"}' search album streets

{"artist": "Savatage","album": ""Streets" A Rock Opera","title": "Believe","track_number": "16","duration": "5:42"}

A json option could be provided a list of fields to operate or just be an option that escapes quotes in its output regardless which fields are used in a template.

MaxKellermann commented 5 years ago

I believe that is out of mpc's scope. You did not explain a use case, and all use cases I can imagine should better not use mpc.