mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Cleanup thumbs existence check
This commit is contained in:
parent
8c038b42df
commit
c0f8f22e6a
@ -44,18 +44,11 @@ func getThumbVttPath(sha string) string {
|
||||
}
|
||||
|
||||
func (s *MetadataService) GetThumb(path string, sha string) (string, string, error) {
|
||||
sprite_path := getThumbPath(sha)
|
||||
vtt_path := getThumbVttPath(sha)
|
||||
|
||||
if _, err := os.Stat(sprite_path); err == nil {
|
||||
return sprite_path, vtt_path, nil
|
||||
}
|
||||
|
||||
_, err := s.ExtractThumbs(path, sha)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
return sprite_path, vtt_path, nil
|
||||
return getThumbPath(sha), getThumbVttPath(sha), nil
|
||||
}
|
||||
|
||||
func (s *MetadataService) ExtractThumbs(path string, sha string) (interface{}, error) {
|
||||
@ -77,6 +70,10 @@ func extractThumbnail(path string, sha string) error {
|
||||
|
||||
os.MkdirAll(fmt.Sprintf("%s/%s", Settings.Metadata), 0o755)
|
||||
|
||||
if _, err := os.Stat(getThumbPath(sha)); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
gen, err := screengen.NewGenerator(path)
|
||||
if err != nil {
|
||||
log.Printf("Error reading video file: %v", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user