-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
歌曲下載不完整 #149
Comments
順便可以再加個校對,檢查下載完的檔案的音樂時長是不是一致,不然要每個檔案檢查。 |
![]() 🤔 用了 windows的機器 一樣 v4.13 還是一樣 |
有時會發生,有時不會。 |
go-musicfox/pkg/constants/constants.go Line 31 in f944442
看來是超過 5秒 |
🤔soga,那这样体验可能确实会差一些,正常情况下发生这种事情的概率比较小,我不太确定针对此类报错直接返回下载失败是不是一个好的解决方案,或者说把超时时间放进配置文件? @anhoder |
畢竟每個人網速不一樣。 |
下载歌曲时可以重新new个http.Client,单独设置一个比较长的超时时间,同时加上这段错误日志记录: _, err = io.Copy(f, resp.Body)
if err != nil {
errHandler(err)
return
} |
可以,30s应该够了吧 |
要不直接60吧 |
可以,我再看看歌名包含分隔符怎么处理比较好 |
|
我先看看能不能保留,不能再替换吧 |
merge #139 後,這個fix消失了 😢 |
Check for existing issues
检查是否已存在相同issue
Describe the bug and provide steps to reproduce it
描述遇到的bug并提供相应的复现方法
調高音質或長度過長,歌曲下載不完整。
測試歌曲: 幻想楼閣 - 橋本みゆき
當
songLevel=higher
時,檔案大概 7MB,歌曲完整 (4:48)。songLevel=exhigh
時,檔案大概 10MB,歌曲不完整 (4:10 左右)。我猜是 server 有 response 大小限制。
我自己有小測試一下,確實 HEAD request 能拿到 size.
可能準確不是 10M,有時大概 9M 就斷了。
問了一下ChatGPT,
in Go, how to download a big file if the server limit client body to 10m?
If you're attempting to download a large file from a server that limits client body size to 10MB, the server needs to support range requests (also known as byte serving). This will allow your Go client to request portions of the file, instead of attempting to download the entire file in a single request.
Below is an example in Go, which makes HTTP GET requests in chunks of 10MB (10 * 1024 * 1024 bytes) until the whole file is downloaded:
This code does the following:
Range
header to each request.Please replace
"http://example.com/bigfile"
and"bigfile"
with your actual URL and destination file path respectively.Environment / 运行环境
go-musicfox master branch
OS: macOS 10.15.7
If applicable, list the error messages you see
如果有错误输出请一并填入
No response
If applicable, attach your
${MUSICFOX_ROOT}/musicfox.log
file to this issue.如果
${MUSICFOX_ROOT}/musicfox.log
里有错误日志,请一并上传No response
The text was updated successfully, but these errors were encountered: