Add plt build command to download and cut playlist media#887
Conversation
statik
left a comment
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci
🚫 [golangci] reported by reviewdog 🐶
string sjj has 6 occurrences, make it a constant (goconst)
Line 68 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
string 720p has 7 occurrences, make it a constant (goconst)
Line 106 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
string meeting Dec 2nd has 3 occurrences, make it a constant (goconst)
Line 27 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
string meeting-dec-2nd has 3 occurrences, make it a constant (goconst)
Line 28 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
string ASL has 7 occurrences, make it a constant (goconst)
Line 29 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
string grapes.jpg has 3 occurrences, make it a constant (goconst)
Line 50 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
string nwt has 4 occurrences, make it a constant (goconst)
Line 234 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
string sjj has 6 occurrences, make it a constant (goconst)
Line 33 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
string booknum has 3 occurrences, make it a constant (goconst)
Line 35 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
string nwt has 4 occurrences, make it a constant (goconst)
Line 39 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
exitAfterDefer: log.Fatal will exit, and defer func(){...}(...) will not run (gocritic)
Line 85 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
unnamedResult: consider giving a name to these results (gocritic)
vbs/cmd/plt_build_integration_test.go
Line 29 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
rangeValCopy: each iteration copies 136 bytes (consider pointers or indexing) (gocritic)
vbs/cmd/plt_build_integration_test.go
Line 120 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
unnamedResult: consider giving a name to these results (gocritic)
Line 33 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
rangeValCopy: each iteration copies 136 bytes (consider pointers or indexing) (gocritic)
Line 98 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
rangeValCopy: each iteration copies 136 bytes (consider pointers or indexing) (gocritic)
Line 114 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
importShadow: shadow of imported package 'url' (gocritic)
Line 164 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
G204: Subprocess launched with a potential tainted input or cmd arguments (gosec)
Line 129 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
G204: Subprocess launched with a potential tainted input or cmd arguments (gosec)
vbs/cmd/plt_clips_integration_test.go
Line 42 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
G110: Potential DoS vulnerability via decompression bomb (gosec)
Line 157 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o755, in detected (mnd)
Line 159 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Magic number: 5, in detected (mnd)
Line 90 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0.1, in detected (mnd)
Line 94 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Magic number: 2, in detected (mnd)
Line 106 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o600, in detected (mnd)
Line 77 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Magic number: 60, in detected (mnd)
Line 88 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Magic number: 60, in detected (mnd)
Line 89 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o600, in detected (mnd)
Line 146 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o755, in detected (mnd)
Line 120 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o600, in detected (mnd)
Line 214 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
continue with no blank line before (nlreturn)
Line 64 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestDownloadAndVerify missing the call to method parallel (paralleltest)
Line 45 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestDownloadAndVerify missing the call to method parallel in the test run (paralleltest)
Line 50 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestDownloadAndVerify missing the call to method parallel in the test run (paralleltest)
Line 57 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestDownloadAndVerify missing the call to method parallel in the test run (paralleltest)
Line 64 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestFetchToCache_ReusesCache missing the call to method parallel (paralleltest)
Line 72 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestFetchMedia_ParsesRenditions missing the call to method parallel (paralleltest)
Line 65 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel (paralleltest)
Line 78 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
Line 85 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
Line 98 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
Line 111 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestProbeKeyframeBefore_Integration missing the call to method parallel (paralleltest)
vbs/cmd/plt_clips_integration_test.go
Line 65 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestCutVerseClip_Integration missing the call to method parallel (paralleltest)
vbs/cmd/plt_clips_integration_test.go
Line 81 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestArchiveExtractEntry missing the call to method parallel (paralleltest)
vbs/cmd/plt_clips_integration_test.go
Line 109 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestMergeMarkers missing the call to method parallel (paralleltest)
Line 30 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestMergeMarkers missing the call to method parallel in test Run (paralleltest)
Line 79 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestFormatTimecode missing the call to method parallel (paralleltest)
Line 57 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestWritePlaylistJSON_RoundTrips missing the call to method parallel (paralleltest)
Line 72 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestRenderCueSheet missing the call to method parallel (paralleltest)
Line 100 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestBuildMediaURL missing the call to method parallel (paralleltest)
Line 22 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestBuildMediaURL missing the call to method parallel in test Run (paralleltest)
Line 54 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
Function TestBuildMediaURL_UnsupportedShape missing the call to method parallel (paralleltest)
Line 79 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
test helper function should start from t.Helper() (thelper)
Line 41 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
test helper function should start from t.Helper() (thelper)
Line 51 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
test helper function should start from t.Helper() (thelper)
Line 71 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
variable name 'rm' is too short for the scope of its usage (varnamelen)
Line 201 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
parameter name 'rm' is too short for the scope of its usage (varnamelen)
Line 240 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
variable name 'r' is too short for the scope of its usage (varnamelen)
Line 270 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
parameter name 'rm' is too short for the scope of its usage (varnamelen)
Line 334 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
parameter name 'w' is too short for the scope of its usage (varnamelen)
vbs/cmd/plt_build_integration_test.go
Line 41 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
variable name 'in' is too short for the scope of its usage (varnamelen)
Line 148 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
variable name 'b' is too short for the scope of its usage (varnamelen)
Line 95 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
variable name 'q' is too short for the scope of its usage (varnamelen)
Line 64 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
variable name 'zr' is too short for the scope of its usage (varnamelen)
Line 134 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
variable name 'rc' is too short for the scope of its usage (varnamelen)
Line 145 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 81 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 114 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 119 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with declarations or returns (wsl)
Line 404 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
vbs/cmd/plt_build_integration_test.go
Line 73 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
vbs/cmd/plt_build_integration_test.go
Line 79 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 63 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 104 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 152 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
vbs/cmd/plt_clips_integration_test.go
Line 30 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
vbs/cmd/plt_clips_integration_test.go
Line 87 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 124 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
Line 156 in 934af7f
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 65 in 934af7f
| defer func() { _ = resp.Body.Close() }() | ||
|
|
||
| if resp.StatusCode != http.StatusOK { | ||
| return out, fmt.Errorf("media API returned status %d for %+v", resp.StatusCode, *loc) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("media API returned status %d for %+v", resp.StatusCode, *loc)" (err113)
| func selectRendition(resp mediaResponse, langCode, resolution string) (mediaItem, bool, error) { | ||
| lang, ok := resp.Files[langCode] | ||
| if !ok || len(lang.MP4) == 0 { | ||
| return mediaItem{}, false, fmt.Errorf("no MP4 renditions for language %q", langCode) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("no MP4 renditions for language %q", langCode)" (err113)
| defer func() { _ = resp.Body.Close() }() | ||
|
|
||
| if resp.StatusCode != http.StatusOK { | ||
| return fmt.Errorf("download for %s returned status %d", url, resp.StatusCode) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("download for %s returned status %d", url, resp.StatusCode)" (err113)
| } | ||
|
|
||
| if wantSize > 0 && size != wantSize { | ||
| return fmt.Errorf("size mismatch for %s: got %d, want %d", url, size, wantSize) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("size mismatch for %s: got %d, want %d", url, size, wantSize)" (err113)
| if wantChecksum != "" { | ||
| got := hex.EncodeToString(hash.Sum(nil)) | ||
| if got != wantChecksum { | ||
| return fmt.Errorf("checksum mismatch for %s: got %s, want %s", url, got, wantChecksum) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("checksum mismatch for %s: got %s, want %s", url, got, wantChecksum)" (err113)
| } | ||
| }, | ||
| }, | ||
| { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd. is missing field check (exhaustruct)
| markers: []Marker{mk("v1", 2.0, 10.0, 0), mk("v2", 15.0, 10.0, 0)}, | ||
| wantRanges: 2, | ||
| }, | ||
| { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd. is missing field check (exhaustruct)
| }, | ||
| { | ||
| name: "docid", | ||
| loc: Location{DocumentID: 1112024040, Track: 1, Type: 3}, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd.Location is missing fields MajorMultimediaType, BaseDurationTicks, BookNumber, ChapterNumber, KeySymbol, MepsLanguage (exhaustruct)
| } | ||
|
|
||
| func TestBuildMediaURL_UnsupportedShape(t *testing.T) { | ||
| _, err := buildMediaURL("https://example.invalid/api", "ASL", &Location{Type: 9}) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd.Location is missing fields MajorMultimediaType, BaseDurationTicks, BookNumber, ChapterNumber, DocumentID, Track, KeySymbol, MepsLanguage (exhaustruct)
| }) | ||
| mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { | ||
| resp := mediaResponse{Files: map[string]mediaLang{ | ||
| "ASL": {MP4: []mediaItem{{ |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string ASL has 7 occurrences, make it a constant (goconst)
statik
left a comment
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci
🚫 [golangci] reported by reviewdog 🐶
Magic number: 5, in detected (mnd)
Line 90 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0.1, in detected (mnd)
Line 94 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Magic number: 2, in detected (mnd)
Line 106 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o600, in detected (mnd)
Line 77 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Magic number: 60, in detected (mnd)
Line 88 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Magic number: 60, in detected (mnd)
Line 89 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o600, in detected (mnd)
Line 146 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o755, in detected (mnd)
Line 120 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o600, in detected (mnd)
Line 214 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
continue with no blank line before (nlreturn)
Line 64 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestDownloadAndVerify missing the call to method parallel (paralleltest)
Line 45 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestDownloadAndVerify missing the call to method parallel in the test run (paralleltest)
Line 50 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestDownloadAndVerify missing the call to method parallel in the test run (paralleltest)
Line 57 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestDownloadAndVerify missing the call to method parallel in the test run (paralleltest)
Line 64 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestFetchToCache_ReusesCache missing the call to method parallel (paralleltest)
Line 72 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestFetchMedia_ParsesRenditions missing the call to method parallel (paralleltest)
Line 65 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel (paralleltest)
Line 78 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
Line 85 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
Line 98 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
Line 111 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestProbeKeyframeBefore_Integration missing the call to method parallel (paralleltest)
vbs/cmd/plt_clips_integration_test.go
Line 65 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestCutVerseClip_Integration missing the call to method parallel (paralleltest)
vbs/cmd/plt_clips_integration_test.go
Line 81 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestArchiveExtractEntry missing the call to method parallel (paralleltest)
vbs/cmd/plt_clips_integration_test.go
Line 109 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestMergeMarkers missing the call to method parallel (paralleltest)
Line 30 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestMergeMarkers missing the call to method parallel in test Run (paralleltest)
Line 79 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestFormatTimecode missing the call to method parallel (paralleltest)
Line 57 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestWritePlaylistJSON_RoundTrips missing the call to method parallel (paralleltest)
Line 72 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestRenderCueSheet missing the call to method parallel (paralleltest)
Line 100 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestBuildMediaURL missing the call to method parallel (paralleltest)
Line 22 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestBuildMediaURL missing the call to method parallel in test Run (paralleltest)
Line 54 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
Function TestBuildMediaURL_UnsupportedShape missing the call to method parallel (paralleltest)
Line 79 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
test helper function should start from t.Helper() (thelper)
Line 41 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
test helper function should start from t.Helper() (thelper)
Line 51 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
test helper function should start from t.Helper() (thelper)
Line 71 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
variable name 'rm' is too short for the scope of its usage (varnamelen)
Line 204 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
parameter name 'rm' is too short for the scope of its usage (varnamelen)
Line 243 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
variable name 'r' is too short for the scope of its usage (varnamelen)
Line 273 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
parameter name 'rm' is too short for the scope of its usage (varnamelen)
Line 337 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
parameter name 'w' is too short for the scope of its usage (varnamelen)
vbs/cmd/plt_build_integration_test.go
Line 41 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
variable name 'm' is too short for the scope of its usage (varnamelen)
Line 55 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
variable name 'in' is too short for the scope of its usage (varnamelen)
Line 148 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
variable name 'b' is too short for the scope of its usage (varnamelen)
Line 95 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
variable name 'q' is too short for the scope of its usage (varnamelen)
Line 64 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
variable name 'zr' is too short for the scope of its usage (varnamelen)
Line 134 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
variable name 'rc' is too short for the scope of its usage (varnamelen)
Line 145 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 84 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 117 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 122 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with declarations or returns (wsl)
Line 407 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
vbs/cmd/plt_build_integration_test.go
Line 73 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
vbs/cmd/plt_build_integration_test.go
Line 79 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 63 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 104 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 158 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
vbs/cmd/plt_clips_integration_test.go
Line 30 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
vbs/cmd/plt_clips_integration_test.go
Line 87 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 124 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
Line 156 in 9806b02
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 65 in 9806b02
| pltBuildResolution string | ||
| ) | ||
|
|
||
| var pltBuildCmd = &coral.Command{ |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
coral.Command is missing fields Aliases, SuggestFor, ValidArgs, ValidArgsFunction, ArgAliases, BashCompletionFunction, Deprecated, Annotations, Version, PersistentPreRun, PersistentPreRunE, PreRun, PreRunE, RunE, PostRun, PostRunE, PersistentPostRun, PersistentPostRunE, FParseErrWhitelist, CompletionOptions, TraverseChildren, Hidden, SilenceErrors, SilenceUsage, DisableFlagParsing, DisableAutoGenTag, DisableFlagsInUseLine, DisableSuggestions, SuggestionsMinimumDistance (exhaustruct)
| func TestFetchMedia_ParsesRenditions(t *testing.T) { | ||
| srv := mediaTestServer(t, sanitizedMediaJSON) | ||
|
|
||
| resp, err := fetchMedia(srv.Client(), srv.URL, "ASL", &Location{KeySymbol: "sjj", Track: 135}) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string sjj has 6 occurrences, make it a constant (goconst)
| // then a document id. Anything else is an error naming the row. | ||
| func classifyLocation(loc *Location) (shapeKind, error) { | ||
| switch { | ||
| case loc.KeySymbol == "nwt" && loc.BookNumber > 0: |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string nwt has 4 occurrences, make it a constant (goconst)
| }{ | ||
| { | ||
| name: "pub track", | ||
| loc: Location{KeySymbol: "sjj", Track: 135, Type: 0}, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string sjj has 6 occurrences, make it a constant (goconst)
| name: "pub track", | ||
| loc: Location{KeySymbol: "sjj", Track: 135, Type: 0}, | ||
| wantParams: map[string]string{"output": "json", "fileformat": "mp4", "langwritten": "ASL", "pub": "sjj", "track": "135"}, | ||
| forbidden: []string{"booknum", "docid"}, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string booknum has 3 occurrences, make it a constant (goconst)
| } | ||
|
|
||
| // mediaFileServer serves fixed bytes at any path and counts requests. | ||
| func mediaFileServer(t *testing.T, body []byte) (*httptest.Server, *int32) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
unnamedResult: consider giving a name to these results (gocritic)
| } | ||
|
|
||
| // downloadAndVerify downloads url to dest and checks size and MD5 (when known). | ||
| func downloadAndVerify(client *http.Client, url, dest string, wantSize int64, wantChecksum string) error { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
importShadow: shadow of imported package 'url' (gocritic)
| } | ||
|
|
||
| duration := endSec - keyframe | ||
| cmd := exec.Command("ffmpeg", "-loglevel", "error", |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
G204: Subprocess launched with a potential tainted input or cmd arguments (gosec)
| func makeTestVideo(t *testing.T, path string, durationSec int) { | ||
| t.Helper() | ||
|
|
||
| cmd := exec.Command("ffmpeg", "-loglevel", "error", "-f", "lavfi", |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
G204: Subprocess launched with a potential tainted input or cmd arguments (gosec)
| } | ||
| defer func() { _ = out.Close() }() | ||
|
|
||
| if _, err := io.Copy(out, rc); err != nil { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
G110: Potential DoS vulnerability via decompression bomb (gosec)
statik
left a comment
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
Line 98 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
Line 111 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Function TestProbeKeyframeBefore_Integration missing the call to method parallel (paralleltest)
vbs/cmd/plt_clips_integration_test.go
Line 65 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Function TestCutVerseClip_Integration missing the call to method parallel (paralleltest)
vbs/cmd/plt_clips_integration_test.go
Line 81 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Function TestArchiveExtractEntry missing the call to method parallel (paralleltest)
vbs/cmd/plt_clips_integration_test.go
Line 109 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Function TestMergeMarkers missing the call to method parallel (paralleltest)
Line 30 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestMergeMarkers missing the call to method parallel in test Run (paralleltest)
Line 79 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Function TestFormatTimecode missing the call to method parallel (paralleltest)
Line 57 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Function TestWritePlaylistJSON_RoundTrips missing the call to method parallel (paralleltest)
Line 72 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Function TestRenderCueSheet missing the call to method parallel (paralleltest)
Line 100 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Function TestBuildMediaURL missing the call to method parallel (paralleltest)
Line 22 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestBuildMediaURL missing the call to method parallel in test Run (paralleltest)
Line 54 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
Function TestBuildMediaURL_UnsupportedShape missing the call to method parallel (paralleltest)
Line 79 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
test helper function should start from t.Helper() (thelper)
Line 41 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
test helper function should start from t.Helper() (thelper)
Line 51 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
test helper function should start from t.Helper() (thelper)
Line 71 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'rm' is too short for the scope of its usage (varnamelen)
Line 200 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
parameter name 'rm' is too short for the scope of its usage (varnamelen)
Line 239 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'r' is too short for the scope of its usage (varnamelen)
Line 269 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
parameter name 'rm' is too short for the scope of its usage (varnamelen)
Line 333 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
parameter name 'w' is too short for the scope of its usage (varnamelen)
vbs/cmd/plt_build_integration_test.go
Line 41 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'm' is too short for the scope of its usage (varnamelen)
Line 55 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'in' is too short for the scope of its usage (varnamelen)
Line 148 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'b' is too short for the scope of its usage (varnamelen)
Line 95 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'q' is too short for the scope of its usage (varnamelen)
Line 64 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'zr' is too short for the scope of its usage (varnamelen)
Line 134 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'rc' is too short for the scope of its usage (varnamelen)
Line 145 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 113 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 118 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with declarations or returns (wsl)
Line 403 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
vbs/cmd/plt_build_integration_test.go
Line 73 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
vbs/cmd/plt_build_integration_test.go
Line 79 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 63 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 104 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 152 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 158 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
vbs/cmd/plt_clips_integration_test.go
Line 30 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
vbs/cmd/plt_clips_integration_test.go
Line 87 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 124 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 68 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
Line 156 in c8c75f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 65 in c8c75f6
|
|
||
| playlist, err := parsePlaylist(arc) | ||
| if err != nil { | ||
| log.Fatal().Err(err).Msg("Could not parse playlist") |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
exitAfterDefer: log.Fatal will exit, and defer func(){...}(...) will not run (gocritic)
|
|
||
| outDir := filepath.Join(resolveInputPath(pltBuildOut), slugify(playlist.Name)) | ||
| for _, sub := range []string{"clips", "media", "thumbs"} { | ||
| if err := os.MkdirAll(filepath.Join(outDir, sub), 0o755); err != nil { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o755, in detected (mnd)
| // probeKeyframeBefore returns the presentation time of the last keyframe at or | ||
| // before startSec. Published files use a uniform GOP, but this handles any. | ||
| func probeKeyframeBefore(file string, startSec float64) (float64, error) { | ||
| from := startSec - 5 |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Magic number: 5, in detected (mnd)
| if from < 0 { | ||
| from = 0 | ||
| } | ||
| interval := fmt.Sprintf("%.3f%%%.3f", from, startSec+0.1) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0.1, in detected (mnd)
| best := 0.0 | ||
| for _, line := range strings.Split(strings.TrimSpace(string(out)), "\n") { | ||
| fields := strings.Split(line, ",") | ||
| if len(fields) < 2 { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Magic number: 2, in detected (mnd)
| } | ||
| }) | ||
|
|
||
| t.Run("size mismatch is an error", func(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestDownloadAndVerify missing the call to method parallel in the test run (paralleltest)
| }) | ||
| } | ||
|
|
||
| func TestFetchToCache_ReusesCache(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestFetchToCache_ReusesCache missing the call to method parallel (paralleltest)
| return srv | ||
| } | ||
|
|
||
| func TestFetchMedia_ParsesRenditions(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestFetchMedia_ParsesRenditions missing the call to method parallel (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestSelectRendition(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel (paralleltest)
| t.Fatalf("fetchMedia: %v", err) | ||
| } | ||
|
|
||
| t.Run("exact 720p", func(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
statik
left a comment
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
vbs/cmd/plt_build_integration_test.go
Line 73 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
vbs/cmd/plt_build_integration_test.go
Line 79 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 63 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 104 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 152 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 158 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
vbs/cmd/plt_clips_integration_test.go
Line 30 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
vbs/cmd/plt_clips_integration_test.go
Line 87 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 124 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 68 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
Line 156 in 97b7967
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 65 in 97b7967
| } | ||
| }) | ||
|
|
||
| t.Run("absent resolution falls back to highest", func(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
| } | ||
| }) | ||
|
|
||
| t.Run("missing language is an error", func(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestSelectRendition missing the call to method parallel in the test run (paralleltest)
| return d | ||
| } | ||
|
|
||
| func TestProbeKeyframeBefore_Integration(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestProbeKeyframeBefore_Integration missing the call to method parallel (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestCutSegment_Integration(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestCutSegment_Integration missing the call to method parallel (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestArchiveExtractEntry(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestArchiveExtractEntry missing the call to method parallel (paralleltest)
| if err != nil { | ||
| t.Fatalf("result is not a URL: %v", err) | ||
| } | ||
| q := parsed.Query() |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
variable name 'q' is too short for the scope of its usage (varnamelen)
| // the caller (derived from item order and slug), never from the entry name, so | ||
| // there is no zip-slip exposure; the entry name only locates the source bytes. | ||
| func (a *archive) extractEntry(entryName, destPath string) error { | ||
| zr, err := zip.OpenReader(a.path) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
variable name 'zr' is too short for the scope of its usage (varnamelen)
| return fmt.Errorf("zip entry %q not found in archive", entryName) | ||
| } | ||
|
|
||
| rc, err := entry.Open() |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
variable name 'rc' is too short for the scope of its usage (varnamelen)
|
|
||
| var cues []cue | ||
| seen := map[string]int{} | ||
| for i, item := range playlist.Items { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
| if err != nil { | ||
| return buildManifest{}, fmt.Errorf("item %d (%q): %w", i+1, item.Label, err) | ||
| } | ||
| cues = append(cues, itemCues...) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
statik
left a comment
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci
🚫 [golangci] reported by reviewdog 🐶
Function TestBuildCueSheetOnly_NoMedia missing the call to method parallel (paralleltest)
Line 25 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
Function TestEndActionLabel missing the call to method parallel (paralleltest)
Line 133 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
Function TestFormatTimecode missing the call to method parallel (paralleltest)
Line 142 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
Function TestWritePlaylistJSON_RoundTrips missing the call to method parallel (paralleltest)
Line 157 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
Function TestRenderCueSheet missing the call to method parallel (paralleltest)
Line 185 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
parameter name 'it' is too short for the scope of its usage (varnamelen)
Line 179 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
variable name 'b' is too short for the scope of its usage (varnamelen)
Line 254 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
parameter name 'b' is too short for the scope of its usage (varnamelen)
Line 292 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
parameter name 'c' is too short for the scope of its usage (varnamelen)
Line 329 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 294 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments (wsl)
Line 299 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 306 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with declarations or returns (wsl)
Line 409 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
vbs/cmd/plt_build_integration_test.go
Line 73 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
vbs/cmd/plt_build_integration_test.go
Line 79 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 63 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 104 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 152 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 158 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
vbs/cmd/plt_clips_integration_test.go
Line 87 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 66 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 85 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments used in the if statement itself (wsl)
Line 259 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
Line 40 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 69 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
Line 82 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 68 in 2eb803b
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
Line 156 in 2eb803b
|
|
||
| "github.com/muesli/coral" | ||
| "github.com/rs/zerolog/log" | ||
| "github.com/spf13/viper" |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
import 'github.com/spf13/viper' is not allowed from list 'Main' (depguard)
| pltCuesheetResolution string | ||
| ) | ||
|
|
||
| var pltCuesheetCmd = &coral.Command{ |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
coral.Command is missing fields Aliases, SuggestFor, ValidArgs, ValidArgsFunction, ArgAliases, BashCompletionFunction, Deprecated, Annotations, Version, PersistentPreRun, PersistentPreRunE, PreRun, PreRunE, RunE, PostRun, PostRunE, PersistentPostRun, PersistentPostRunE, FParseErrWhitelist, CompletionOptions, TraverseChildren, Hidden, SilenceErrors, SilenceUsage, DisableFlagParsing, DisableAutoGenTag, DisableFlagsInUseLine, DisableSuggestions, SuggestionsMinimumDistance (exhaustruct)
| ) | ||
|
|
||
| func TestBuildCueSheetOnly_NoMedia(t *testing.T) { | ||
| arc, err := sniffPlaylist(writePlaylistFixture(t, fixtureOptions{})) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd.fixtureOptions is missing fields schemaVersion, omitTables, omitManifest, notZip, corruptDB, databaseName (exhaustruct)
| mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { | ||
| resp := mediaResponse{Files: map[string]mediaLang{ | ||
| "ASL": {MP4: []mediaItem{{ | ||
| Title: "synthetic", Label: "720p", |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string 720p has 9 occurrences, make it a constant (goconst)
| cacheDir := t.TempDir() | ||
|
|
||
| item := mediaItem{ | ||
| Label: "720p", |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string 720p has 9 occurrences, make it a constant (goconst)
| if !fellBack { | ||
| t.Error("1080p is absent; should fall back") | ||
| } | ||
| if item.Label != "720p" || item.FrameHeight != 720 { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string 720p has 9 occurrences, make it a constant (goconst)
|
|
||
| playlist, err := parsePlaylist(arc) | ||
| if err != nil { | ||
| log.Fatal().Err(err).Msg("Could not parse playlist") |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
exitAfterDefer: log.Fatal will exit, and defer func(){...}(...) will not run (gocritic)
|
|
||
| // buildCueSheetOnly assembles cue metadata from the playlist alone — no media | ||
| // downloads, no clip cutting — and writes playlist.json plus the cue sheet. | ||
| func buildCueSheetOnly(arc *archive, playlist *Playlist) (string, bool, error) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
unnamedResult: consider giving a name to these results (gocritic)
| } | ||
|
|
||
| outDir := filepath.Join(resolveInputPath(pltCuesheetOut), slugify(playlist.Name)) | ||
| if err := os.MkdirAll(filepath.Join(outDir, "thumbs"), 0o755); err != nil { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o755, in detected (mnd)
| "testing" | ||
| ) | ||
|
|
||
| func TestBuildCueSheetOnly_NoMedia(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestBuildCueSheetOnly_NoMedia missing the call to method parallel (paralleltest)
| // itemMediaURL builds the media API query URL an item resolves to, derived from | ||
| // its catalog keys. Image cues and unsupported shapes have no URL. When base is | ||
| // empty the placeholder "<plt.mediaapi>" stands in for the configured endpoint. | ||
| func itemMediaURL(it Item, base string) string { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
parameter name 'it' is too short for the scope of its usage (varnamelen)
|
|
||
| // renderMediaURLs prints the media API query URL each item resolves to, derived | ||
| // from the playlist's catalog keys. | ||
| func renderMediaURLs(w io.Writer, view printView) error { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
parameter name 'w' is too short for the scope of its usage (varnamelen)
| // from the playlist's catalog keys. | ||
| func renderMediaURLs(w io.Writer, view printView) error { | ||
| var withURL []printItem | ||
| for _, it := range view.Items { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
| if _, err := fmt.Fprint(w, "\nMedia URLs:\n"); err != nil { | ||
| return fmt.Errorf("could not write media URL header: %w", err) | ||
| } | ||
| for _, it := range withURL { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
| if err != nil { | ||
| return fmt.Errorf("could not create %s: %w", dst, err) | ||
| } | ||
| defer func() { _ = out.Close() }() |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
| dir := t.TempDir() | ||
| src := filepath.Join(dir, "src.mp4") | ||
| out := filepath.Join(dir, "clip.mp4") | ||
| makeTestVideo(t, src, 10) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
| if !pdf { | ||
| log.Info().Msg("typst not found on PATH; wrote cuesheet.typ only (install typst to render cuesheet.pdf)") | ||
| } | ||
| log.Info().Msgf("Wrote cue sheet into %s", outDir) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
| pltCuesheetOut = out | ||
| pltCuesheetResolution = "720p" | ||
| pltCuesheetLang = "" | ||
| t.Cleanup(func() { pltCuesheetOut = "."; pltCuesheetResolution = "720p"; pltCuesheetLang = "" }) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
| if err != nil { | ||
| return false | ||
| } | ||
| var side mediaSidecar |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
statik
left a comment
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci
🚫 [golangci] reported by reviewdog 🐶
variable name 'rm' is too short for the scope of its usage (varnamelen)
Line 214 in 19bb0d1
🚫 [golangci] reported by reviewdog 🐶
parameter name 'rm' is too short for the scope of its usage (varnamelen)
Line 253 in 19bb0d1
🚫 [golangci] reported by reviewdog 🐶
variable name 'r' is too short for the scope of its usage (varnamelen)
Line 283 in 19bb0d1
🚫 [golangci] reported by reviewdog 🐶
variable name 'b' is too short for the scope of its usage (varnamelen)
Line 257 in 19bb0d1
🚫 [golangci] reported by reviewdog 🐶
parameter name 'b' is too short for the scope of its usage (varnamelen)
Line 295 in 19bb0d1
🚫 [golangci] reported by reviewdog 🐶
parameter name 'c' is too short for the scope of its usage (varnamelen)
Line 332 in 19bb0d1
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with declarations or returns (wsl)
Line 423 in 19bb0d1
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 88 in 19bb0d1
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments used in the if statement itself (wsl)
Line 262 in 19bb0d1
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 73 in 19bb0d1
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
Line 86 in 19bb0d1
| return ctx.imageCue(item, index, slug, thumb) | ||
| } | ||
| if item.Location == nil { | ||
| return nil, fmt.Errorf("video item has no catalog location") |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("video item has no catalog location")" (err113)
| if err := ctx.arc.extractEntry(item.Image.FilePath, filepath.Join(ctx.outDir, clipRel)); err != nil { | ||
| return nil, err | ||
| } | ||
| return []cue{{ |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd.cue is missing fields SourceMedia, Markers, Cut (exhaustruct)
| if duration == 0 { | ||
| duration = ticksToSeconds(item.Location.BaseDurationTicks) | ||
| } | ||
| return []cue{{ |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd.cue is missing fields Markers, Cut (exhaustruct)
| // trimRange turns an item's trim offsets into a single clip range, when set. | ||
| func trimRange(item Item) (clipRange, bool) { | ||
| if item.StartTrimTicks == 0 && item.EndTrimTicks == 0 { | ||
| return clipRange{}, false |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd.clipRange is missing fields startTicks, endTicks, markers (exhaustruct)
| return clipRange{}, false | ||
| } | ||
| if item.Location == nil { | ||
| return clipRange{}, false |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd.clipRange is missing fields startTicks, endTicks, markers (exhaustruct)
| // cuesheet.pdf. It returns whether a PDF was produced. | ||
| func writeCueSheet(dir string, manifest buildManifest) (bool, error) { | ||
| typPath := filepath.Join(dir, "cuesheet.typ") | ||
| if err := os.WriteFile(typPath, []byte(renderCueSheet(manifest)), 0o600); err != nil { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o600, in detected (mnd)
| } | ||
| } | ||
|
|
||
| func TestEndActionLabel(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestEndActionLabel missing the call to method parallel (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestFormatTimecode(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestFormatTimecode missing the call to method parallel (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestWritePlaylistJSON_RoundTrips(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestWritePlaylistJSON_RoundTrips missing the call to method parallel (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestRenderCueSheet(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestRenderCueSheet missing the call to method parallel (paralleltest)
Build a self-contained working directory from a purple playlist: resolve each catalog location to a media-API query, download renditions (default 720p) to a shared cache with MD5 + size verification, pre-cut verse clips with a keyframe-snapped stream copy (no re-encode), extract image cues and thumbnails, and emit playlist.json plus a Typst cue sheet (compiled to PDF when typst is present). Distinct locations are fetched once and downloads are cached, so re-running is fast and deterministic. The media endpoint is config-only (plt.mediaapi) and fails fast with an actionable message when unset. Verified against the example export: 15 cues, media deduped to 10 files, every verse clip starts within one GOP of its marker, re-run hits the cache.
Apply the same help example and BUILD_WORKING_DIRECTORY path resolution to plt build: the playlist argument and --out are now resolved against the invoking directory under 'bazel run'.
Derive and print the media-API query URL per item from its catalog keys (pub/track, book/chapter, docid) plus the configured plt.mediaapi base. Stays offline: image cues have no URL, and when the endpoint is unset a <plt.mediaapi> placeholder shows the playlist-derived query. Added to both the text output (a Media URLs section) and the JSON view.
Generate playlist.json, cuesheet.typ, extracted thumbnails, and (when typst is installed) cuesheet.pdf straight from the playlist — no media downloads, no clip cutting, no ffmpeg or media API. Durations come from the catalog ticks and markers; the lead-in column is left blank since keyframe snapping needs the real video files. Thumbnail extraction is now shared with build.
The lead-in is a build-time keyframe-snapping detail with no action for the technical director, and was blank in offline cue sheets anyway. The value is still recorded in playlist.json for the Phase 3 .mitti transform.
Give the cue sheet an editorial, workbook-style layout: clean sans-serif, a header band, near-borderless rows with single-color cue numbers, and a footer rule. Interpret the after-cue action codes (0 continue, 1 stop, 2 freeze) in both the cue sheet and the plt print table, now that their meanings are confirmed.
Bring back a small proportional duration sparkline per cue, and move the running elapsed time under the duration as quiet gray text so it no longer needs its own column.
Linear bars were dominated by the single longest cue, leaving the short cues indistinguishable. A square-root scale spreads them out while the longest cue still reads as the longest.
Write a .gitignore ("*") into every build/cuesheet working directory so the
generated output (clips, media, thumbnails, cue sheet, playlist.json) can never
be accidentally committed, regardless of the playlist slug or where the command
is run.
| return nil, fmt.Errorf("video item has no catalog location") | ||
| } | ||
|
|
||
| rm, err := ctx.resolveMedia(item.Location) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
variable name 'rm' is too short for the scope of its usage (varnamelen)
|
|
||
| // wholeVideoCue copies an untrimmed, marker-free video to its ordered clip. | ||
| func (ctx *buildContext) wholeVideoCue( | ||
| item Item, index int, slug string, rm resolvedMedia, sourceRel, thumb string, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
parameter name 'rm' is too short for the scope of its usage (varnamelen)
| srcPath := filepath.Join(ctx.outDir, sourceRel) | ||
|
|
||
| cues := make([]cue, 0, len(ranges)) | ||
| for i, r := range ranges { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
variable name 'r' is too short for the scope of its usage (varnamelen)
| // a clean sans-serif, near-borderless layout with color-coded cue numbers, a | ||
| // header band, and a footer rule — echoing the meeting-workbook style. | ||
| func renderCueSheet(manifest buildManifest) string { | ||
| var b strings.Builder |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
variable name 'b' is too short for the scope of its usage (varnamelen)
|
|
||
| // writeCueSheetPreamble emits the page setup (with a footer rule), the title | ||
| // band, and the muted metadata line. | ||
| func writeCueSheetPreamble(b *strings.Builder, manifest buildManifest, total float64) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
parameter name 'b' is too short for the scope of its usage (varnamelen)
|
|
||
| var cues []cue | ||
| seen := map[string]int{} | ||
| for i, item := range playlist.Items { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
| total, maxDur := 0.0, 0.0 | ||
| for _, c := range manifest.Cues { | ||
| total += c.DurationSec | ||
| if c.DurationSec > maxDur { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments used in the if statement itself (wsl)
| if entries, _ := os.ReadDir(filepath.Join(workDir, "thumbs")); len(entries) == 0 { | ||
| t.Error("expected extracted thumbnails") | ||
| } | ||
| for _, dir := range []string{"media", "clips"} { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
| if err != nil { | ||
| t.Fatalf("read %s: %v", path, err) | ||
| } | ||
| var manifest buildManifest |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
| if err != nil { | ||
| return fmt.Errorf("download failed for %s: %w", url, err) | ||
| } | ||
| defer func() { _ = resp.Body.Close() }() |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Plan covers the port of vbs plt cuesheet generation (kindlyops/vbs#887) to a hexagonal Rust core with Typst linked as a library, a Tufte-styled Tauri 2 GUI using the Fantastic Mr Fox palette, license attribution via cargo-about, and a tag-driven release pipeline with gated code signing and the Tauri updater. https://claude.ai/code/session_01Sn1jjXDRydhdL4AGnkWNGQ
* Add detailed build plan for Cuesheet Tauri app Plan covers the port of vbs plt cuesheet generation (kindlyops/vbs#887) to a hexagonal Rust core with Typst linked as a library, a Tufte-styled Tauri 2 GUI using the Fantastic Mr Fox palette, license attribution via cargo-about, and a tag-driven release pipeline with gated code signing and the Tauri updater. https://claude.ai/code/session_01Sn1jjXDRydhdL4AGnkWNGQ * Add GitHub Pages site (three.js red panda diorama) to plan https://claude.ai/code/session_01Sn1jjXDRydhdL4AGnkWNGQ --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Second phase of the
pltcommand group. Addsvbs plt build <playlist>,which turns a purple playlist into a self-contained, play-ready working
directory.
The pipeline:
docid shapes) and pick a rendition (default
720p,--resolution; fallsback to the highest available with a warning).
UserCacheDir/vbs/media/) with MD5 + sizeverification and a JSON sidecar; one re-download on mismatch, then a hard
error. Distinct locations are fetched once.
snapping the start back to the nearest keyframe, and stream-copying (no
re-encode). Non-contiguous markers become lettered sub-clips. Untrimmed,
marker-free videos are copied whole; image cues are extracted from the zip.
playlist.json(the Phase 3 contract: per-cue markers,cut metadata, lead-in, raw end action) and a Typst
cuesheet.typ, compiledto
cuesheet.pdfwhentypstis on PATH.The media endpoint is config-only (
plt.mediaapi, overridable with--media-api) and the build fails fast with an actionable message when unset.ffmpeg/ffprobeare required and checked up front. New code is standardlibrary only (no new vendored dependencies).
Test Plan
go test ./cmd/green: URL builder (3 shapes + unsupported), httptestclient + rendition fallback, cache reuse + checksum/size mismatch,
marker merge (mutation-verified), keyframe probe + ffmpeg cut, image
extraction, cue-sheet render + playlist.json round-trip
download→verify→cache, whole-video copy, lettered segment sub-clips, image
extract, playlist.json + cuesheet.typ, cache-hit re-run
bazel build //cmd:go_default_libraryandbazel test //cmd:go_default_testgreengofmt,go vet,go build ./...,go mod verify, vendor guard cleanfiles, every segment clip snaps to a keyframe within one GOP (lead-ins
0.07–1.75 s), checksum confirmed MD5, re-run completes in ~1.7 s (cache)