verifying thumbs now

This commit is contained in:
2017-09-07 19:33:42 -05:00
parent 450923be2f
commit df18b29087
+14 -11
View File
@@ -28,6 +28,15 @@ type MediaSource struct {
set Set
}
type Media struct {
Type string
Name string
Size image.Rectangle
FullName string
metadata *metadata.Metadata
}
func (ms *MediaSource) LocationOrig(m Media) string {
return path.Join(ms.StorageDir, m.Name)
}
@@ -70,15 +79,6 @@ func (ms *MediaSource) ReceiveNewMedia(name string, r io.Reader) error {
return f.Close()
}
type Media struct {
Type string
Name string
Size image.Rectangle
FullName string
metadata *metadata.Metadata
}
func (m *Media) Date() time.Time {
m.getMetadata()
@@ -178,8 +178,11 @@ func (ms *MediaSource) ThumbMax(m Media, maxDim int) (string, image.Rectangle, e
}
func (ms *MediaSource) HasThumb(m Media, size image.Rectangle) bool {
_, err := os.Stat(ms.ThumbFilename(m, size))
return err == nil
fi, err := os.Stat(ms.ThumbFilename(m, size))
if err != nil {
return false
}
return m.Date().Before(fi.ModTime())
}
func (ms *MediaSource) ByName(name string) *Media {