Skip to content

Parse ID3v2 timestamps #233

@Serial-ATA

Description

@Serial-ATA

Summary

We could parse timestamps in the following frames: TDEN, TDOR, TDRC, TDRL, TDTG.

Instead of FrameValue::Text, they would now use FrameValue::Timestamp.

The structure is described in the ID3v2.4 frame overview:

The timestamp fields are based on a subset of ISO 8601. When being as precise as possible the format of a time string is yyyy-MM-ddTHH:mm:ss (year, “-”, month, “-”, day, “T”, hour (out of 24), ”:”, minutes, ”:”, seconds), but the precision may be reduced by removing as many time indicators as wanted. Hence valid timestamps are yyyy, yyyy-MM, yyyy-MM-dd, yyyy-MM-ddTHH, yyyy-MM-ddTHH:mm and yyyy-MM-ddTHH:mm:ss. All time stamps are UTC.

API design

pub struct TimestampFrame { // Year is required, and ID3v2 does not allow negative years pub year: u16, pub month: Option<u8>, pub day: Option<u8>, pub hour: Option<u8>, pub minute: Option<u8>, pub second: Option<u8>, }
pub enum FrameValue { Timestamp(TimestampFrame), /// ... }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions