Skip to content

Commit 734397c

Browse files
committed
Update matroska-go to v1.2.2 and improve EOF handling in MKV demuxing logic
Update `.goreleaser.yml` to add platform-specific archive format overrides
1 parent ba4a79e commit 734397c

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

.goreleaser.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ builds:
1111
binary: gst
1212
archives:
1313
- id: "gst"
14+
format: tar.gz
15+
format_overrides:
16+
- goos: windows
17+
format: zip
1418
files:
1519
- LICENSE
1620
- README.md

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/luispater/gemini-srt-translator-go
33
go 1.24.0
44

55
require (
6-
github.com/luispater/matroska-go v1.0.0
6+
github.com/luispater/matroska-go v1.2.2
77
github.com/openai/openai-go v1.12.0
88
github.com/spf13/cobra v1.9.1
99
golang.org/x/term v0.33.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN
3030
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
3131
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
3232
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
33-
github.com/luispater/matroska-go v1.0.0 h1:JBoOtio6VU/EqirOm+7u1oIxIeSdi7QbY0hEtZj+2+I=
34-
github.com/luispater/matroska-go v1.0.0/go.mod h1:giucksajGO4MmrvlxwVci72/l/EdirWUI+ZZHt9ixHo=
33+
github.com/luispater/matroska-go v1.2.2 h1:AhXA5r+L4fSgyU89bIzXb7TorEYYsSt8R7NS2FkD1Ko=
34+
github.com/luispater/matroska-go v1.2.2/go.mod h1:giucksajGO4MmrvlxwVci72/l/EdirWUI+ZZHt9ixHo=
3535
github.com/openai/openai-go v1.12.0 h1:NBQCnXzqOTv5wsgNC36PrFEiskGfO5wccfCWDo9S1U0=
3636
github.com/openai/openai-go v1.12.0/go.mod h1:g461MYGXEXBVdV5SaR/5tNzNbSfwTBBefwc+LlDCK0Y=
3737
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

internal/video/mkv.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package video
33
import (
44
"bufio"
55
"fmt"
6+
"io"
67
"os"
78
"path/filepath"
89
"strings"
@@ -127,7 +128,7 @@ func (p *MKVParser) extractSubtitlePackets(demuxer *matroska.Demuxer) error {
127128
for {
128129
packet, err := demuxer.ReadPacket()
129130
if err != nil {
130-
if strings.Contains(err.Error(), "EOF") {
131+
if err == io.EOF || strings.Contains(err.Error(), "EOF") {
131132
break // End of file reached
132133
}
133134
return fmt.Errorf("failed to read packet: %w", err)
@@ -146,8 +147,10 @@ func (p *MKVParser) extractSubtitlePackets(demuxer *matroska.Demuxer) error {
146147
}
147148

148149
// Calculate timing using the file's timecode scale
149-
startTime := time.Duration(packet.StartTime) * time.Duration(p.timecodescale)
150-
endTime := time.Duration(packet.EndTime) * time.Duration(p.timecodescale)
150+
// startTime := time.Duration(packet.StartTime) * time.Duration(p.timecodescale)
151+
// endTime := time.Duration(packet.EndTime) * time.Duration(p.timecodescale)
152+
startTime := time.Duration(packet.StartTime)
153+
endTime := time.Duration(packet.EndTime)
151154

152155
// Create subtitle entry
153156
entry := SubtitleEntry{

0 commit comments

Comments
 (0)