Skip to content
Discussion options

You must be logged in to vote

Hello!

year() comes from Accessor which only has methods for a few items, since it's meant to only support items that every tag format supports.

What you're looking for is ItemKey, specifically ItemKey::OriginalReleaseDate.

You can use it like so:

use lofty::tag::items::Timestamp;
use lofty::prelude::*;

fn main() -> lofty::error::Result<()> {
    let file = lofty::read_from_path("foo.mp3")?;
    let tag = file.primary_tag().expect("No tag!");

    if let Some(original_release_date_str) = tag.get_string(&ItemKey::OriginalReleaseDate) {
        let original_release_date: Timestamp = original_release_date_str.parse()?;
        let original_release_year = original_release_date.year;
        p…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@loxoron218
Comment options

Answer selected by loxoron218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants