okdownload
okdownload copied to clipboard
关于totalLength为0的问题
OkDownload Version:1.0.4
Problem Describe
Task设置DownloadListener1,监听器中的progress方法中回调的totalLength一直为0
Log
我的也是出现这种情况,请问你解决了吗?
我的也是出现这种情况,请问你解决了吗?
没解决,用另外的库去了。
能告诉我用哪个下载库吗?
能告诉我用哪个下载库吗?
https://github.com/AriaLyy/Aria 目前用的这个,wiki挺详细的。
好的 谢谢咯!大神
好的 谢谢咯!大神
嘿嘿,我不是大神,一起学习。
同遇到此问题!留言关注一下!
我也没搞定~~发自我的华为手机-------- 原始邮件 --------主题:Re: [lingochamp/okdownload] 关于totalLength为0的问题 (#135)发件人:ShuXin 收件人:lingochamp/okdownload 抄送:xinhjsjd [email protected],Comment 同遇到此问题!留言关注一下!
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/lingochamp/okdownload","title":"lingochamp/okdownload","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/lingochamp/okdownload"}},"updates":{"snippets":[{"icon":"PERSON","message":"@aowoWolf in #135: 同遇到此问题!留言关注一下!"}],"action":{"name":"View Issue","url":"https://github.com/lingochamp/okdownload/issues/135#issuecomment-436917502"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/lingochamp/okdownload/issues/135#issuecomment-436917502", "url": "https://github.com/lingochamp/okdownload/issues/135#issuecomment-436917502", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } }, { "@type": "MessageCard", "@context": "http://schema.org/extensions", "hideOriginalBody": "false", "originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB", "title": "Re: [lingochamp/okdownload] 关于totalLength为0的问题 (#135)", "sections": [ { "text": "", "activityTitle": "ShuXin", "activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png", "activitySubtitle": "@aowoWolf", "facts": [
] } ], "potentialAction": [ { "name": "Add a comment", "@type": "ActionCard", "inputs": [ { "isMultiLine": true, "@type": "TextInput", "id": "IssueComment", "isRequired": false } ], "actions": [ { "name": "Comment", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n"commandName": "IssueComment",\n"repositoryFullName": "lingochamp/okdownload",\n"issueId": 135,\n"IssueComment": "{{IssueComment.value}}"\n}" } ] }, { "name": "Close issue", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n"commandName": "IssueClose",\n"repositoryFullName": "lingochamp/okdownload",\n"issueId": 135\n}" }, { "targets": [ { "os": "default", "uri": "https://github.com/lingochamp/okdownload/issues/135#issuecomment-436917502" } ], "@type": "OpenUri", "name": "View on GitHub" }, { "name": "Unsubscribe", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n"commandName": "MuteNotification",\n"threadId": 368905322\n}" } ], "themeColor": "26292E" } ]
同样遇到这个问题,具体情况是:
task.enqueue(listener) // 第一次开启下载任务 -> task.cancel() -> listener.canceled(DownloadTask task) -> listener.progress(DownloadTask task, long currentOffset, long totalLength) // 此时totalLength是正常的 -> task.enqueue(listener) // 第二次开启同一个下载任务 -> task.cancel() -> listener.canceled(DownloadTask task) -> listener.progress(DownloadTask task, long currentOffset, long totalLength) // 此时totalLength=0
各位谁能提供一个完整的日志吗?有这个的话可以很快定位到问题。
我用这个库下载我们渣渣后台写的服务器文件,就总是返回0,但是,下载网上一般文件,就不会返回0,所以我推测是我们辣鸡后台的锅。现在是辣鸡后台在header里加了个字段返回文件长度,所以我需要访问返回的header,看半天源文件也还没搞掂