archseer/ruby-mpd

Protocol updates in mpd v.18

Closed this issue · 4 comments

There are a few new commands and features in .18 that aren't implemented:

  • protocol:
    • new command "readcomments" lists arbitrary file tags
    • new command "toggleoutput"
    • "find"/"search" with "any" does not match file name
    • "search" and "find" with base URI (keyword "base")
    • search for album artist falls back to the artist tag
    • re-add the "volume" command

http://git.musicpd.org/cgit/master/mpd.git/plain/NEWS?h=release-0.18

:toggleoutput is pretty straightforward but :readcomments is not. :readcomments returns a hash of additional arbitrary tags on the song file. I'd like to implement it but I wanted to see if you had any comment on how it should be done.

The last 4 items already work.

I'd probably implement :readcomments on MPD::Song, as a Hash. So song.comments[:key] would return the comment. I guess we should also freeze it, as MPD offers no way of persisting it back to the files.

Thumbs up for contributing this and the other patch yesterday! I didn't have enough time to do it myself.

Would you prefer to have MPD::Song instances calling #send_command or is it something that should be retrieved beforehand and then passed to MPD::Song#new?

I think we could do it similarly to how MPD::Playlist is done, though that does mean that MPD::Song then needs an extra parameter, passing in the MPD instance. Then when MPD::Song#comments is first called, I'd cache the thing inside the object?

I definitively wouldn't fetch it all in advance, as it would provide significant overhead when fetching large portions of the MPD database.