mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-10 06:34:18 +00:00
VorbisComments: Check for "TRACKNUM" when using Accessor::*track
methods
This commit is contained in:
parent
8f15c0bb41
commit
4741a0c770
2 changed files with 7 additions and 1 deletions
|
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- **VorbisComments**:
|
||||
- Keys will now be verified according to spec before insertion
|
||||
- Getters will now case-insensitively search for keys
|
||||
- `TRACKNUM` will now be considered in the `Accessor::*track` methods
|
||||
|
||||
### Fixed
|
||||
- **ID3v2**:
|
||||
|
|
|
@ -206,7 +206,10 @@ impl Accessor for VorbisComments {
|
|||
);
|
||||
|
||||
fn track(&self) -> Option<u32> {
|
||||
if let Some(item) = self.get("TRACKNUMBER") {
|
||||
if let Some(item) = self
|
||||
.get("TRACKNUMBER")
|
||||
.map_or_else(|| self.get("TRACKNUM"), Some)
|
||||
{
|
||||
return item.parse::<u32>().ok();
|
||||
}
|
||||
|
||||
|
@ -214,11 +217,13 @@ impl Accessor for VorbisComments {
|
|||
}
|
||||
|
||||
fn set_track(&mut self, value: u32) {
|
||||
self.remove_track();
|
||||
self.insert(String::from("TRACKNUMBER"), value.to_string());
|
||||
}
|
||||
|
||||
fn remove_track(&mut self) {
|
||||
let _ = self.remove("TRACKNUMBER");
|
||||
let _ = self.remove("TRACKNUM");
|
||||
}
|
||||
|
||||
fn track_total(&self) -> Option<u32> {
|
||||
|
|
Loading…
Reference in a new issue