stop overwriting footage_dir after processing

This commit is contained in:
ari melody 2026-06-20 21:23:38 +01:00
parent a3b9ec2cb6
commit b4a244a456
Signed by: ari
GPG key ID: 60B5F0386E3DDB7E

11
main.go
View file

@ -189,14 +189,13 @@ func main() {
} }
// default footage directory // default footage directory
if len(metadata.FootageDir) == 0 { footageDir := directory
metadata.FootageDir = directory if len(metadata.FootageDir) >= 0 && !strings.HasPrefix(metadata.FootageDir, "/") {
} else if !strings.HasPrefix(metadata.FootageDir, "/") { footageDir = path.Join(directory, metadata.FootageDir)
metadata.FootageDir = path.Join(directory, metadata.FootageDir)
} }
// scan for VOD segments // scan for VOD segments
vodFiles, err := scanner.ScanSegments(metadata.FootageDir, SEGMENT_EXTENSION) vodFiles, err := scanner.ScanSegments(footageDir, SEGMENT_EXTENSION)
if err != nil { if err != nil {
log.Fatalf("Failed to fetch VOD filenames: %v", err) log.Fatalf("Failed to fetch VOD filenames: %v", err)
os.Exit(1) os.Exit(1)
@ -270,7 +269,7 @@ func main() {
var totalLength float64 = 0 var totalLength float64 = 0
for _, filename := range vodFiles { for _, filename := range vodFiles {
probe, err := scanner.ProbeSegment(path.Join(metadata.FootageDir, filename)) probe, err := scanner.ProbeSegment(path.Join(footageDir, filename))
if err != nil { continue } if err != nil { continue }
totalLength += probe.Format.Duration totalLength += probe.Format.Duration
} }