Skip to content

Commit 66d8915

Browse files
authored
Merge pull request #50 from mutablelogic/v1
Updated go-media and fixed segment office
2 parents c130862 + f60b7b5 commit 66d8915

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/djthorpe/go-tablewriter v0.0.8
99
github.com/go-audio/wav v1.1.0
1010
github.com/mutablelogic/go-client v1.0.9
11-
github.com/mutablelogic/go-media v1.6.10
11+
github.com/mutablelogic/go-media v1.6.11
1212
github.com/mutablelogic/go-server v1.4.15
1313
github.com/stretchr/testify v1.9.0
1414
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T
2626
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
2727
github.com/mutablelogic/go-client v1.0.9 h1:Eh4sjQOFDldP/L3IizqkcOD3WigZR+u1VaHTUM4ujYw=
2828
github.com/mutablelogic/go-client v1.0.9/go.mod h1:VLyB8j8IBJSK/FXvvqhmq93PRWDKkyLu8R7V2Vudb6A=
29-
github.com/mutablelogic/go-media v1.6.10 h1:LJCNGiAJHFETtATbktTpe38lquUDiLjgeaWXsi1fzI8=
30-
github.com/mutablelogic/go-media v1.6.10/go.mod h1:HulNT0yyH63a3FRlbuzNDakhOypYrmtFVkHEXZjDgAY=
29+
github.com/mutablelogic/go-media v1.6.11 h1:czwRvuWIaqDArZrHv0e7nEIjXJkCbnNWkrQzkTOs96w=
30+
github.com/mutablelogic/go-media v1.6.11/go.mod h1:HulNT0yyH63a3FRlbuzNDakhOypYrmtFVkHEXZjDgAY=
3131
github.com/mutablelogic/go-server v1.4.15 h1:jOvVdDmVK+PGCMBAk5atKHVonnccwy/b4dWwWFAOTso=
3232
github.com/mutablelogic/go-server v1.4.15/go.mod h1:9nenPAohKu8bFoRgwHJh+3s8h0kLFjUAb8KZvT1TQNU=
3333
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

pkg/whisper/task/context.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ func (ctx *Context) Result() *schema.Transcription {
231231
// PRIVATE METHODS
232232

233233
func (ctx *Context) appendResult(ts time.Duration, segments bool) {
234+
offset := len(ctx.result.Segments)
235+
234236
// Append text
235237
for i := 0; i < ctx.whisper.NumSegments(); i++ {
236238
seg := ctx.whisper.Segment(i)
@@ -239,7 +241,7 @@ func (ctx *Context) appendResult(ts time.Duration, segments bool) {
239241
if segments {
240242
// Append segments
241243
for i := 0; i < ctx.whisper.NumSegments(); i++ {
242-
ctx.result.Segments = append(ctx.result.Segments, newSegment(ts, ctx.whisper.Segment(i)))
244+
ctx.result.Segments = append(ctx.result.Segments, newSegment(ts, int32(offset), ctx.whisper.Segment(i)))
243245
}
244246
}
245247
}

pkg/whisper/task/transcription.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import (
1111
//////////////////////////////////////////////////////////////////////////////
1212
// LIFECYCLE
1313

14-
func newSegment(ts time.Duration, seg *whisper.Segment) *schema.Segment {
14+
func newSegment(ts time.Duration, offset int32, seg *whisper.Segment) *schema.Segment {
1515
// Dumb copy function
1616
return &schema.Segment{
17-
Id: seg.Id,
17+
Id: offset + seg.Id,
1818
Text: seg.Text,
1919
Start: schema.Timestamp(seg.T0 + ts),
2020
End: schema.Timestamp(seg.T1 + ts),

0 commit comments

Comments
 (0)