automatically upload nearby thumbnail.png

This commit is contained in:
ari melody 2026-06-23 18:28:50 +01:00
parent fc1d6b20c1
commit 2fcbc31f77
Signed by: ari
GPG key ID: 60B5F0386E3DDB7E
4 changed files with 75 additions and 19 deletions

View file

@ -2,6 +2,7 @@ package scanner
import (
"encoding/json"
"fmt"
"os"
"path"
"strconv"
@ -60,6 +61,18 @@ func ScanSegments(directory string, extension string) ([]string, error) {
return files, nil
}
func ScanThumbnail(directory string) (string, int64, error) {
thumbnailPath := path.Join(directory, "thumbnail.png")
stat, err := os.Stat(thumbnailPath)
if err != nil {
return "", 0, err
}
if stat.IsDir() {
return "", 0, fmt.Errorf("thumbnail.png is a directory")
}
return thumbnailPath, stat.Size(), nil
}
func ProbeSegment(filename string) (*FFprobeOutput, error) {
out, err := ffmpeg_go.Probe(filename)
if err != nil { return nil, err }