mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-03 05:34:23 -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) {
|
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)
|
_, err := s.ExtractThumbs(path, sha)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
return sprite_path, vtt_path, nil
|
return getThumbPath(sha), getThumbVttPath(sha), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MetadataService) ExtractThumbs(path string, sha string) (interface{}, error) {
|
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)
|
os.MkdirAll(fmt.Sprintf("%s/%s", Settings.Metadata), 0o755)
|
||||||
|
|
||||||
|
if _, err := os.Stat(getThumbPath(sha)); err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
gen, err := screengen.NewGenerator(path)
|
gen, err := screengen.NewGenerator(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error reading video file: %v", err)
|
log.Printf("Error reading video file: %v", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user