verifying thumbs now

pull/12/head
Stephen Searles 7 years ago
parent 450923be2f
commit df18b29087
  1. 25
      media/media.go

@ -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 {

Loading…
Cancel
Save