Skip to content

Commit

Permalink
Fallback to year field for ogg files when date not present (#105)
Browse files Browse the repository at this point in the history
* Recognise year field for ogg files when present

* prioritize 'date' over 'year' tag on ogg files
  • Loading branch information
yabobay authored Apr 13, 2024
1 parent 713ab0e commit dc579f5
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit dc579f5

Please sign in to comment.