Skip to content

Commit

Permalink
Use song duration instead of Time
Browse files Browse the repository at this point in the history
The `Time` song metadata tag is deprecated in MPD[1] and has lower
precision.

[1]: https://mpd.readthedocs.io/en/latest/protocol.html#other-metadata
  • Loading branch information
naglis committed Dec 26, 2023
1 parent 34c16fa commit 9862108
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/song.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ impl FromIter for Song {
"Last-Modified" => result.last_mod = Some(line.1.to_owned()),
"Artist" => result.artist = Some(line.1.to_owned()),
"Name" => result.name = Some(line.1.to_owned()),
"Time" => result.duration = Some(Duration::from_secs(line.1.parse()?)),
// Deprecated in MPD.
"Time" => (),
"duration" => result.duration = Some(Duration::from_secs_f64(line.1.parse()?)),
"Range" => result.range = Some(line.1.parse()?),
"Id" => match result.place {
None => result.place = Some(QueuePlace { id: Id(line.1.parse()?), pos: 0, prio: 0 }),
Expand Down

0 comments on commit 9862108

Please sign in to comment.