Skip to content
This repository has been archived by the owner on Dec 15, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
anhoder committed May 16, 2024
1 parent b3ffec2 commit 6668fdb
Show file tree
Hide file tree
Showing 184 changed files with 5,950 additions and 2,445 deletions.
19 changes: 10 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ require (
github.com/zmb3/spotify/v2 v2.3.1
go.etcd.io/bbolt v1.3.7
golang.org/x/mod v0.8.0
golang.org/x/oauth2 v0.7.0
golang.org/x/text v0.13.0
golang.org/x/oauth2 v0.10.0
golang.org/x/text v0.14.0
)

require (
Expand Down Expand Up @@ -59,21 +59,22 @@ require (
github.com/sahilm/fuzzy v0.1.0 // indirect
github.com/vcaesar/keycode v0.10.1 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/grpc v1.58.3 // indirect
google.golang.org/protobuf v1.33.0 // indirect
zenhack.net/go/util v0.0.0-20230607025951-8b02fee814ae // indirect
)

replace (
capnproto.org/go/capnp/v3 v3.0.0-alpha-29 => capnproto.org/go/capnp/v3 v3.0.0-alpha.29
github.com/arcspace/go-librespot v0.0.0-20230811173922-2e901b172fbe => github.com/go-musicfox/go-librespot v0.1.0
// github.com/arcspace/go-librespot v0.0.0-20230811173922-2e901b172fbe => github.com/go-musicfox/go-librespot v0.1.0
github.com/arcspace/go-librespot v0.0.0-20230811173922-2e901b172fbe => ../go-librespot
github.com/charmbracelet/bubbletea v0.25.0 => github.com/go-musicfox/bubbletea v0.25.0-foxful
github.com/gookit/gcli/v2 v2.3.4 => github.com/anhoder/gcli/v2 v2.3.5
github.com/gopxl/beep v1.4.0 => github.com/go-musicfox/beep v1.4.1
Expand Down
34 changes: 16 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ github.com/go-musicfox/beep v1.4.1 h1:1U7nnypAez/OgEBy+Kf9pnxL4ZYBk4OFASGKIi5nhu
github.com/go-musicfox/beep v1.4.1/go.mod h1:FLIgNbvzfm53Fe9yu6PEeEGbdFiA6ubejExj5dp2ctI=
github.com/go-musicfox/bubbletea v0.25.0-foxful h1:HRvsptwgdgK7ltKFfddIcgRQezMA9Gagi0QD8hlMkFo=
github.com/go-musicfox/bubbletea v0.25.0-foxful/go.mod h1:0d493G5q9s3TvUgvzfo1h8S4aGTyfyqQwyCSB088uwU=
github.com/go-musicfox/go-librespot v0.1.0 h1:7BCcmyBrTkRXjHkMB9DRE3td9LmWmlg483t5IJIv1Pw=
github.com/go-musicfox/go-librespot v0.1.0/go.mod h1:XQ3of3y1Pq5c6iRT+SqrWjD42FlGuBvMDWx5iePKwhc=
github.com/go-musicfox/go-mp3 v0.3.3 h1:xBfUaYhbG6LipvPLDSlawLSO1A5z3InSJz8vB3+3bHc=
github.com/go-musicfox/go-mp3 v0.3.3/go.mod h1:fRtZraRFcWb0pu7ok0LqyFhCUrPeMsGRSVop0eemFmo=
github.com/go-musicfox/lastfm-go v0.0.2 h1:S/jXVK/bSi9JGZGm7ynQWY3nQ8gvMzbpHf2yKZ9ge+g=
Expand Down Expand Up @@ -258,8 +256,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -328,16 +326,16 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g=
golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4=
golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8=
golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -389,14 +387,14 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -407,8 +405,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -527,8 +525,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ=
google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand All @@ -542,8 +540,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
Expand Down
30 changes: 18 additions & 12 deletions internal/configs/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ func NewRegistryWithDefault() *Registry {
},
Progress: ProgressOptions{
ProgressOptions: model.ProgressOptions{
FirstEmptyChar: []rune(types.ProgressEmptyChar)[0],
EmptyChar: []rune(types.ProgressEmptyChar)[0],
LastEmptyChar: []rune(types.ProgressEmptyChar)[0],
FirstFullChar: []rune(types.ProgressFullChar)[0],
FullChar: []rune(types.ProgressFullChar)[0],
LastFullChar: []rune(types.ProgressFullChar)[0],
EmptyChar: []rune(types.ProgressEmptyChar)[0],
EmptyCharWhenFirst: []rune(types.ProgressEmptyChar)[0],
EmptyCharWhenLast: []rune(types.ProgressEmptyChar)[0],
FirstEmptyChar: []rune(types.ProgressEmptyChar)[0],
FullChar: []rune(types.ProgressFullChar)[0],
FullCharWhenFirst: []rune(types.ProgressFullChar)[0],
FullCharWhenLast: []rune(types.ProgressFullChar)[0],
LastFullChar: []rune(types.ProgressFullChar)[0],
},
},
Main: MainOptions{
Expand Down Expand Up @@ -100,17 +102,21 @@ func NewRegistryFromIniFile(filepath string) *Registry {

emptyChar := ini.String("progress.emptyChar", types.ProgressEmptyChar)
registry.Progress.EmptyChar = firstCharOrDefault(emptyChar, types.ProgressEmptyChar)
emptyCharWhenFirst := ini.String("progress.emptyCharWhenFirst", types.ProgressEmptyChar)
registry.Progress.EmptyCharWhenFirst = firstCharOrDefault(emptyCharWhenFirst, types.ProgressEmptyChar)
emptyCharWhenLast := ini.String("progress.emptyCharWhenLast", types.ProgressEmptyChar)
registry.Progress.EmptyCharWhenLast = firstCharOrDefault(emptyCharWhenLast, types.ProgressEmptyChar)
firstEmptyChar := ini.String("progress.firstEmptyChar", types.ProgressEmptyChar)
registry.Progress.FirstEmptyChar = firstCharOrDefault(firstEmptyChar, types.ProgressEmptyChar)
lastEmptyChar := ini.String("progress.lastEmptyChar", types.ProgressEmptyChar)
registry.Progress.LastEmptyChar = firstCharOrDefault(lastEmptyChar, types.ProgressEmptyChar)

fullChar := ini.String("progress.fullChar", types.ProgressFullChar)
registry.Progress.FullChar = firstCharOrDefault(fullChar, types.ProgressFullChar)
firstFullChar := ini.String("progress.firstFullChar", types.ProgressFullChar)
registry.Progress.FirstFullChar = firstCharOrDefault(firstFullChar, types.ProgressFullChar)
lastFullChar := ini.String("progress.lastFullChar", types.ProgressFullChar)
registry.Progress.LastFullChar = firstCharOrDefault(lastFullChar, types.ProgressFullChar)
fullCharWhenFirst := ini.String("progress.fullCharWhenFirst", types.ProgressFullChar)
registry.Progress.FullCharWhenFirst = firstCharOrDefault(fullCharWhenFirst, types.ProgressFullChar)
fullCharWhenLast := ini.String("progress.fullCharWhenLast", types.ProgressFullChar)
registry.Progress.FullCharWhenLast = firstCharOrDefault(fullCharWhenLast, types.ProgressFullChar)
lastFullChar := ini.String("progress.lastFullChar", types.ProgressEmptyChar)
registry.Progress.LastFullChar = firstCharOrDefault(lastFullChar, types.ProgressEmptyChar)

registry.Spotify.ClientId = types.SpotifyClientId
if clientId := ini.Get("spotify.clientId"); clientId != "" {
Expand Down
18 changes: 12 additions & 6 deletions internal/player/beep_player.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import (
"sync"
"time"

"github.com/go-musicfox/spotifox/utils"
"github.com/arcspace/go-arc-sdk/stdlib/task"
"github.com/gopxl/beep"
"github.com/gopxl/beep/effects"
"github.com/gopxl/beep/speaker"
"github.com/zmb3/spotify/v2"

"github.com/go-musicfox/spotifox/utils"
)

const (
Expand Down Expand Up @@ -72,11 +74,11 @@ func NewBeepPlayer() *beepPlayer {
func (p *beepPlayer) listen() {
var (
done = make(chan struct{})
resp *http.Response
reader io.ReadCloser
err error
ctx context.Context
cancel context.CancelFunc
taskCtx task.Context
prevSongId spotify.ID
doneHandle = func() {
select {
Expand Down Expand Up @@ -110,9 +112,15 @@ func (p *beepPlayer) listen() {
if cancel != nil {
cancel()
}
if taskCtx != nil {
_ = taskCtx.Close()
}
p.reset()
if prevSongId != p.curMusic.SongInfo.ID || !utils.FileOrDirExists(cacheFile) {
ctx, cancel = context.WithCancel(context.Background())
taskCtx, _ = task.Start(nil)

p.curMusic.OnStart(taskCtx)

// FIXME No other optimization methods found
if p.cacheReader, err = os.OpenFile(cacheFile, os.O_CREATE|os.O_TRUNC|os.O_RDONLY, 0666); err != nil {
Expand All @@ -126,8 +134,6 @@ func (p *beepPlayer) listen() {
utils.Logger().Printf("new asset reader err: %+v", err)
p.stopNoLock()
goto nextLoop
} else {
reader = resp.Body
}

// 边下载边播放
Expand Down Expand Up @@ -168,7 +174,7 @@ func (p *beepPlayer) listen() {
}
}(ctx, p.cacheWriter, reader)

var N = 512
N := 512
if err = utils.WaitForNBytes(p.cacheReader, N, time.Millisecond*100, 50); err != nil {
utils.Logger().Printf("WaitForNBytes err: %+v", err)
p.stopNoLock()
Expand Down Expand Up @@ -442,7 +448,7 @@ func (p *beepPlayer) streamer(samples [][2]float64) (n int, ok bool) {
}
p.pausedNoLock()

var retry = 4
retry := 4
for !ok && retry > 0 {
utils.ResetError(p.curStreamer)

Expand Down
Loading

0 comments on commit 6668fdb

Please sign in to comment.