Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| dd54e8cc49 |
1 changed files with 29 additions and 13 deletions
42
main.go
42
main.go
|
|
@ -26,7 +26,9 @@ import (
|
||||||
//go:embed res/help.txt
|
//go:embed res/help.txt
|
||||||
var helpText string
|
var helpText string
|
||||||
|
|
||||||
const segmentExtension = "mkv"
|
const SEGMENT_EXTENSION = "mkv"
|
||||||
|
const MAX_TITLE_LEN = 100
|
||||||
|
const MAX_DESCRIPTION_LEN = 5000
|
||||||
|
|
||||||
func showHelp() {
|
func showHelp() {
|
||||||
fmt.Println(helpText)
|
fmt.Println(helpText)
|
||||||
|
|
@ -194,7 +196,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// scan for VOD segments
|
// scan for VOD segments
|
||||||
vodFiles, err := scanner.ScanSegments(metadata.FootageDir, segmentExtension)
|
vodFiles, err := scanner.ScanSegments(metadata.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)
|
||||||
|
|
@ -202,7 +204,7 @@ func main() {
|
||||||
if len(vodFiles) == 0 {
|
if len(vodFiles) == 0 {
|
||||||
log.Fatalf(
|
log.Fatalf(
|
||||||
"Directory contained no VOD files (expecting .%s)",
|
"Directory contained no VOD files (expecting .%s)",
|
||||||
segmentExtension,
|
SEGMENT_EXTENSION,
|
||||||
)
|
)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
@ -221,21 +223,35 @@ func main() {
|
||||||
log.Fatalf("Failed to build video template: %v", err)
|
log.Fatalf("Failed to build video template: %v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
title, err := yt.BuildTemplate(video, templates.Title)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Failed to build video title: %v", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
description, err := yt.BuildTemplate(video, templates.Description)
|
||||||
|
if err != nil {
|
||||||
|
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 {
|
if verbose {
|
||||||
enc := json.NewEncoder(os.Stdout)
|
enc := json.NewEncoder(os.Stdout)
|
||||||
fmt.Printf("\nVideo template: ")
|
fmt.Printf("\nVideo template: ")
|
||||||
enc.Encode(video)
|
enc.Encode(video)
|
||||||
|
|
||||||
title, err := yt.BuildTemplate(video, templates.Title)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Failed to build video title: %v", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
description, err := yt.BuildTemplate(video, templates.Description)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Failed to build video description: %v", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
fmt.Printf(
|
fmt.Printf(
|
||||||
"\n================================\n\n" +
|
"\n================================\n\n" +
|
||||||
"< TITLE >\n%s\n\n" +
|
"< TITLE >\n%s\n\n" +
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue