Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add full date capabilities #34

Merged

Conversation

BSteffaniak
Copy link
Contributor

Hi! Thank you for making this crate!

I noticed that there didn't seem to be a way to get the full date from a tag, only a year i32. The tags across flac/id3/mp4 all seem to support a full date in some sort of way, but it doesn't seem to be standard across them. The id3 library seems to be the most specific with how it handles the dates, so for this PR I initially went with specifying the dates with the most specificity across the formats, rather than attempting to keep it at the lowest common denominator (like it seems you might be trying to do). I also just reused the id3::Timestamp, which you might not find desirable, but I could change that to something more standard, if you have something in mind.

Also, forgive my ignorance on the audio specs. I'm not very familiar with them, so if this all seems like an anti-pattern, please let me know.

Thanks!

Comment on lines 178 to 180
fn remove_year(&mut self) {
self.remove("YEAR");
self.remove("DATE");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually correct, as you cannot have a date without a year. It would be surprising behavior to have the DATE retained if you delete the year.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added back

src/anytag.rs Outdated
Comment on lines 9 to 11
pub date_released: Option<Timestamp>,
pub original_date_released: Option<Timestamp>,
pub date_recorded: Option<Timestamp>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub date_released: Option<Timestamp>,
pub original_date_released: Option<Timestamp>,
pub date_recorded: Option<Timestamp>,
pub date: Option<Timestamp>,

ID3v2 is the only tag with a concept of original dates and release times. When going generic, there should only be recording date, as that is the only date supported by all formats.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and generified it to date in AnyTag here, as well as AudioTagEdit here

src/traits.rs Outdated
Comment on lines 35 to 41
fn original_date_released(&self) -> Option<Timestamp>;
fn set_original_date_released(&mut self, date: Timestamp);
fn remove_original_date_released(&mut self);

fn date_released(&self) -> Option<Timestamp>;
fn set_date_released(&mut self, date: Timestamp);
fn remove_date_released(&mut self);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn original_date_released(&self) -> Option<Timestamp>;
fn set_original_date_released(&mut self, date: Timestamp);
fn remove_original_date_released(&mut self);
fn date_released(&self) -> Option<Timestamp>;
fn set_date_released(&mut self, date: Timestamp);
fn remove_date_released(&mut self);

With the removal of the fields from AnyTag, these methods should be taken out as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, you beat me to it. Just removed them. Thanks!

}
fn remove_year(&mut self) {
self.inner.remove_date_recorded();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be good once this is added back. I missed this in the review. :)

Copy link
Contributor Author

@BSteffaniak BSteffaniak Sep 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added back

@Serial-ATA
Copy link
Contributor

@pinkforest Pinging so this is on your radar. Should be good to merge after the last comment is addressed.

@Serial-ATA Serial-ATA mentioned this pull request Nov 15, 2023
@pinkforest
Copy link
Collaborator

Just checking quick - Is this PR kosher - there seems to be open conversations ? Thx you both

@Serial-ATA
Copy link
Contributor

Yep, this is good. All comments were addressed.

@pinkforest pinkforest merged commit e4ee5c9 into TianyiShi2001:main Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants