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

Recognise year field for ogg files when present #105

Merged
merged 2 commits into from
Apr 13, 2024
Merged
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
7 changes: 7 additions & 0 deletions vorbis.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ func (m *metadataVorbis) Year() int {
// and obviously the VorbisComment standard https://wiki.xiph.org/VorbisComment#Date_and_time
switch len(m.c["date"]) {
case 0:
// Fallback on year tag as some files use that.
if len(m.c["year"]) != 0 {
year, err := strconv.Atoi(m.c["year"])
if err == nil {
return year
}
}
return 0
case 4:
dateFormat = "2006"
Expand Down
Loading