v/GTT
1
0
mirror of https://github.com/eeeXun/GTT.git synced 2025-05-16 07:40:44 -07:00

fix: player should close after stop tts

This commit is contained in:
eeeXun 2024-08-08 20:57:39 +08:00
parent 97d1708251
commit 06dafb5bf8
5 changed files with 9 additions and 21 deletions

2
go.mod
View File

@ -6,7 +6,7 @@ require (
github.com/gdamore/tcell/v2 v2.7.1
github.com/hajimehoshi/go-mp3 v0.3.3
github.com/hajimehoshi/oto/v2 v2.3.1
github.com/rivo/tview v0.0.0-20240519080116-fc5680eecb61
github.com/rivo/tview v0.0.0-20240807205129-e4c497cc59ed
github.com/spf13/viper v1.13.0
)

4
go.sum
View File

@ -157,8 +157,8 @@ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qR
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rivo/tview v0.0.0-20240519080116-fc5680eecb61 h1:NCTByuzO45ybiCTTHlmTQx1JpsUuM62YWSP/Hg44Rdg=
github.com/rivo/tview v0.0.0-20240519080116-fc5680eecb61/go.mod h1:02iFIz7K/A9jGCvrizLPvoqr4cEIx7q54RH5Qudkrss=
github.com/rivo/tview v0.0.0-20240807205129-e4c497cc59ed h1:bd91xrd1ECzkEJ4XttUJEiyyGBHQdaOmXVEffJbAm6M=
github.com/rivo/tview v0.0.0-20240807205129-e4c497cc59ed/go.mod h1:02iFIz7K/A9jGCvrizLPvoqr4cEIx7q54RH5Qudkrss=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=

View File

@ -205,13 +205,9 @@ func (t *Translator) PlayTTS(lang, message string) error {
player.Play()
for player.IsPlaying() {
if t.IsStopped() {
return nil
return player.Close()
}
time.Sleep(time.Millisecond)
}
if err = player.Close(); err != nil {
return err
}
return nil
return player.Close()
}

View File

@ -148,13 +148,9 @@ func (t *Translator) PlayTTS(lang, message string) error {
player.Play()
for player.IsPlaying() {
if t.IsStopped() {
return nil
return player.Close()
}
time.Sleep(time.Millisecond)
}
if err = player.Close(); err != nil {
return err
}
return nil
return player.Close()
}

View File

@ -144,13 +144,9 @@ func (t *Translator) PlayTTS(lang, message string) error {
player.Play()
for player.IsPlaying() {
if t.IsStopped() {
return nil
return player.Close()
}
time.Sleep(time.Millisecond)
}
if err = player.Close(); err != nil {
return err
}
return nil
return player.Close()
}