Parse more date formats

This commit is contained in:
Deluan 2020-09-06 00:27:00 -04:00 committed by Deluan Quintão
parent 78ecda5239
commit 2d0031f709
2 changed files with 3 additions and 2 deletions

View file

@ -105,7 +105,7 @@ func (m *baseMetadata) parseInt(tagName string) int {
return 0 return 0
} }
var dateRegex = regexp.MustCompile(`^([12]\d\d\d)`) var dateRegex = regexp.MustCompile(`([12]\d\d\d)`)
func (m *baseMetadata) parseYear(tagName string) int { func (m *baseMetadata) parseYear(tagName string) int {
if v, ok := m.tags[tagName]; ok { if v, ok := m.tags[tagName]; ok {

View file

@ -15,7 +15,8 @@ var _ = Describe("ffmpegMetadata", func() {
"1980.07.25": 1980, "1980.07.25": 1980,
"2004-00-00": 2004, "2004-00-00": 2004,
"2013-May-12": 2013, "2013-May-12": 2013,
"May 12, 2016": 0, "May 12, 2016": 2016,
"01/10/1990": 1990,
} }
for tag, expected := range examples { for tag, expected := range examples {
md := &baseMetadata{} md := &baseMetadata{}