diff options
Diffstat (limited to 'pkg/media')
| -rw-r--r-- | pkg/media/playlist.go | 2 | ||||
| -rw-r--r-- | pkg/media/video.go | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/pkg/media/playlist.go b/pkg/media/playlist.go index ed22f27..86dcb76 100644 --- a/pkg/media/playlist.go +++ b/pkg/media/playlist.go @@ -11,5 +11,5 @@ func (p Playlist) Swap(i, j int) { } func (p Playlist) Less(i, j int) bool { - return p[i].ID < p[j].ID + return p[i].Timestamp.After(p[j].Timestamp) } diff --git a/pkg/media/video.go b/pkg/media/video.go index f79ab44..7fddbee 100644 --- a/pkg/media/video.go +++ b/pkg/media/video.go @@ -3,6 +3,7 @@ package media import ( "os" "strings" + "time" "github.com/dhowden/tag" ) @@ -15,6 +16,7 @@ type Video struct { Thumb []byte ThumbType string Modified string + Timestamp time.Time } func ParseVideo(path string) (*Video, error) { @@ -26,7 +28,8 @@ func ParseVideo(path string) (*Video, error) { if err != nil { return nil, err } - modified := info.ModTime().Format("2006-01-02") + timestamp := info.ModTime() + modified := timestamp.Format("2006-01-02 03:04 PM") name := info.Name() // ID is name without extension idx := strings.LastIndex(name, ".") @@ -49,6 +52,7 @@ func ParseVideo(path string) (*Video, error) { Album: m.Album(), Description: m.Comment(), Modified: modified, + Timestamp: timestamp, } // Add thumbnail (if exists) p := m.Picture() |
