rust-mpd icon indicating copy to clipboard operation
rust-mpd copied to clipboard

Allow tags with multiple values

Open SimonTeixidor opened this issue 3 years ago • 4 comments

Tags in MPD are not a key-value mapping, but an array of key-value pairs. Some tags commonly have multiple values, such as PERFORMER, and by storing this data in a map we only get one of the performers.

SimonTeixidor avatar Mar 17 '21 16:03 SimonTeixidor

@SimonPersson I don't think this is enough to solve the problem, as most commands are parsed using read_structs which uses an iterator over Maps built from the pairs, which uses BTreeMap as items.
See:
https://github.com/kstep/rust-mpd/blob/17a4394ddd64e0e8b43d3fbbbe624d2bd04cccb0/src/client.rs#L205-L207 https://github.com/kstep/rust-mpd/blob/17a4394ddd64e0e8b43d3fbbbe624d2bd04cccb0/src/proto.rs#L108 and https://github.com/kstep/rust-mpd/blob/17a4394ddd64e0e8b43d3fbbbe624d2bd04cccb0/src/proto.rs#L43-L47

anddon avatar Apr 01 '21 12:04 anddon

@anddon - you are right! I only tested with currentsong, which doesn't use read_structs. I'll work on a fix.

SimonTeixidor avatar Apr 01 '21 14:04 SimonTeixidor

@anddon - I think I fixed it!

SimonTeixidor avatar Apr 01 '21 15:04 SimonTeixidor

Yes, it's working properly now, even for read_structs

anddon avatar Apr 01 '21 16:04 anddon