tangled
alpha
login
or
join now
arimelody.space
/
vodular
0
fork
atom
Helper tool for stitching together livestream VOD segments and uploading them to YouTube!
0
fork
atom
overview
issues
pulls
pipelines
add warnings for exceeding metadata character length
arimelody.space
1 month ago
dd54e8cc
9f32aedc
+29
-13
1 changed file
expand all
collapse all
unified
split
main.go
+29
-13
main.go
···
26
26
//go:embed res/help.txt
27
27
var helpText string
28
28
29
29
-
const segmentExtension = "mkv"
29
29
+
const SEGMENT_EXTENSION = "mkv"
30
30
+
const MAX_TITLE_LEN = 100
31
31
+
const MAX_DESCRIPTION_LEN = 5000
30
32
31
33
func showHelp() {
32
34
fmt.Println(helpText)
···
194
196
}
195
197
196
198
// scan for VOD segments
197
197
-
vodFiles, err := scanner.ScanSegments(metadata.FootageDir, segmentExtension)
199
199
+
vodFiles, err := scanner.ScanSegments(metadata.FootageDir, SEGMENT_EXTENSION)
198
200
if err != nil {
199
201
log.Fatalf("Failed to fetch VOD filenames: %v", err)
200
202
os.Exit(1)
···
202
204
if len(vodFiles) == 0 {
203
205
log.Fatalf(
204
206
"Directory contained no VOD files (expecting .%s)",
205
205
-
segmentExtension,
207
207
+
SEGMENT_EXTENSION,
206
208
)
207
209
os.Exit(1)
208
210
}
···
221
223
log.Fatalf("Failed to build video template: %v", err)
222
224
os.Exit(1)
223
225
}
226
226
+
title, err := yt.BuildTemplate(video, templates.Title)
227
227
+
if err != nil {
228
228
+
log.Fatalf("Failed to build video title: %v", err)
229
229
+
os.Exit(1)
230
230
+
}
231
231
+
description, err := yt.BuildTemplate(video, templates.Description)
232
232
+
if err != nil {
233
233
+
log.Fatalf("Failed to build video description: %v", err)
234
234
+
os.Exit(1)
235
235
+
}
236
236
+
if len(title) > 100 {
237
237
+
log.Fatalf(
238
238
+
"Video title length exceeds %d characters (%d). YouTube may reject this!",
239
239
+
MAX_TITLE_LEN,
240
240
+
len(video.Title),
241
241
+
)
242
242
+
}
243
243
+
if len(description) > 5000 {
244
244
+
log.Fatalf(
245
245
+
"Video description length exceeds %d characters (%d). YouTube may reject this!",
246
246
+
MAX_DESCRIPTION_LEN,
247
247
+
len(description),
248
248
+
)
249
249
+
}
224
250
if verbose {
225
251
enc := json.NewEncoder(os.Stdout)
226
252
fmt.Printf("\nVideo template: ")
227
253
enc.Encode(video)
228
254
229
229
-
title, err := yt.BuildTemplate(video, templates.Title)
230
230
-
if err != nil {
231
231
-
log.Fatalf("Failed to build video title: %v", err)
232
232
-
os.Exit(1)
233
233
-
}
234
234
-
description, err := yt.BuildTemplate(video, templates.Description)
235
235
-
if err != nil {
236
236
-
log.Fatalf("Failed to build video description: %v", err)
237
237
-
os.Exit(1)
238
238
-
}
239
255
fmt.Printf(
240
256
"\n================================\n\n" +
241
257
"< TITLE >\n%s\n\n" +