Use file creation date for Date Added/CreatedAt (#2553)

* Update mapping.go

CreatedAt = BirthTime

* Update metadata.go

Add BirthTime() function

* Update spread_fs.go

Replacing djherbis/atime package with djherbis/times, as times includes the functionality of atime

* Update go.mod

remove djherbis/atime, add djherbis/times

* Update mapping.go

time package not used anymore

* Update go.sum

removed djherbis/atime, added djherbis/times

* Update spread_fs.go

revert to previous, cannot get rid of /atime after all since it's a dependency of /fscache

* Update go.mod

djherbis/times 1.6.0 now released

* Update go.sum

new sums

* Update metadata.go

Inverted if statement, more readable

* Update go.mod

format fix

* Update go.sum

format fix

* Update go.sum

format fix

* Update go.sum

format fix

* Update metadata.go

variable name times -> fileProperties
check for errors

* Update metadata.go

reverse order of error check

* Update metadata.go

typo

* Update metadata.go

https://github.com/navidrome/navidrome/pull/2553#issuecomment-1787967615
This commit is contained in:
certuna
2023-11-01 21:41:07 +01:00
committed by GitHub
parent 26472f46fe
commit 03175e1a9d
4 changed files with 12 additions and 2 deletions
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"os"
"path/filepath"
"strings"
"time"
"github.com/deluan/sanitize"
"github.com/navidrome/navidrome/conf"
@@ -76,7 +75,7 @@ func (s mediaFileMapper) toMediaFile(md metadata.Tags) model.MediaFile {
mf.Comment = utils.SanitizeText(md.Comment())
mf.Lyrics = utils.SanitizeText(md.Lyrics())
mf.Bpm = md.Bpm()
mf.CreatedAt = time.Now()
mf.CreatedAt = md.BirthTime()
mf.UpdatedAt = md.ModificationTime()
return *mf