Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 17 additions & 16 deletions crates/onetagger-autotag/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,20 @@ impl TrackImpl for Track {
tag.set_field(Field::Style, self.styles.clone(), config.overwrite_tag(SupportedTag::Style));
}
}

// Release dates
if config.tag_enabled(SupportedTag::ReleaseDate) {
if let Some(date) = self.release_date {
// Force Month and Day to None so standard ID3 YEAR is only YYYY
tag.set_date(&TagDate {
year: date.year() as i32,
month: match config.only_year {
true => None,
false => Some(date.month() as u8)
},
day: match config.only_year {
true => None,
false => Some(date.day() as u8)
}
month: None,
day: None
}, config.overwrite_tag(SupportedTag::ReleaseDate));

// Write the full YYYY-MM-DD date to a custom RELEASETIME tag
let date_str = date.format("%Y-%m-%d").to_string();
tag.set_raw("RELEASETIME", vec![date_str], config.overwrite_tag(SupportedTag::ReleaseDate));
} else if let Some(year) = self.release_year {
tag.set_date(&TagDate {
year: year as i32,
Expand All @@ -191,20 +191,20 @@ impl TrackImpl for Track {
}, config.overwrite_tag(SupportedTag::ReleaseDate));
}
}

// Publish date
if config.tag_enabled(SupportedTag::PublishDate) {
if let Some(date) = self.publish_date {
// Force Month and Day to None so standard ID3 PUBLISH YEAR is only YYYY
tag.set_publish_date(&TagDate {
year: date.year() as i32,
month: match config.only_year {
true => None,
false => Some(date.month() as u8)
},
day: match config.only_year {
true => None,
false => Some(date.day() as u8)
}
month: None,
day: None
}, config.overwrite_tag(SupportedTag::PublishDate));

// Write the full YYYY-MM-DD date to a custom PUBLISHTIME tag
let date_str = date.format("%Y-%m-%d").to_string();
tag.set_raw("PUBLISHTIME", vec![date_str], config.overwrite_tag(SupportedTag::PublishDate));
} else if let Some(year) = self.publish_year {
tag.set_publish_date(&TagDate {
year: year as i32,
Expand All @@ -213,6 +213,7 @@ impl TrackImpl for Track {
}, config.overwrite_tag(SupportedTag::PublishDate));
}
}

// URL
if config.tag_enabled(SupportedTag::URL) {
tag.set_raw("WWWAUDIOFILE", vec![self.url.to_string()], config.overwrite_tag(SupportedTag::URL));
Expand Down
1 change: 1 addition & 0 deletions crates/onetagger-platforms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ rspotify = { version = "0.15", features = [
onetagger-tag = { path = "../onetagger-tag" }
onetagger-shared = { path = "../onetagger-shared" }
onetagger-tagger = { path = "../onetagger-tagger" }
strsim = "0.11.1"
Loading
Loading