Compare commits

..

No commits in common. "main" and "v1.2.3" have entirely different histories.
main ... v1.2.3

32
main.go
View file

@ -26,9 +26,7 @@ import (
//go:embed res/help.txt
var helpText string
const SEGMENT_EXTENSION = "mkv"
const MAX_TITLE_LEN = 100
const MAX_DESCRIPTION_LEN = 5000
const segmentExtension = "mkv"
func showHelp() {
fmt.Println(helpText)
@ -196,7 +194,7 @@ func main() {
}
// scan for VOD segments
vodFiles, err := scanner.ScanSegments(metadata.FootageDir, SEGMENT_EXTENSION)
vodFiles, err := scanner.ScanSegments(metadata.FootageDir, segmentExtension)
if err != nil {
log.Fatalf("Failed to fetch VOD filenames: %v", err)
os.Exit(1)
@ -204,7 +202,7 @@ func main() {
if len(vodFiles) == 0 {
log.Fatalf(
"Directory contained no VOD files (expecting .%s)",
SEGMENT_EXTENSION,
segmentExtension,
)
os.Exit(1)
}
@ -223,6 +221,11 @@ func main() {
log.Fatalf("Failed to build video template: %v", err)
os.Exit(1)
}
if verbose {
enc := json.NewEncoder(os.Stdout)
fmt.Printf("\nVideo template: ")
enc.Encode(video)
title, err := yt.BuildTemplate(video, templates.Title)
if err != nil {
log.Fatalf("Failed to build video title: %v", err)
@ -233,25 +236,6 @@ func main() {
log.Fatalf("Failed to build video description: %v", err)
os.Exit(1)
}
if len(title) > 100 {
log.Fatalf(
"Video title length exceeds %d characters (%d). YouTube may reject this!",
MAX_TITLE_LEN,
len(video.Title),
)
}
if len(description) > 5000 {
log.Fatalf(
"Video description length exceeds %d characters (%d). YouTube may reject this!",
MAX_DESCRIPTION_LEN,
len(description),
)
}
if verbose {
enc := json.NewEncoder(os.Stdout)
fmt.Printf("\nVideo template: ")
enc.Encode(video)
fmt.Printf(
"\n================================\n\n" +
"< TITLE >\n%s\n\n" +