automatically upload nearby thumbnail.png
This commit is contained in:
parent
fc1d6b20c1
commit
2fcbc31f77
4 changed files with 75 additions and 19 deletions
|
|
@ -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 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue