Skip to content

Commit

Permalink
v3.6.2
Browse files Browse the repository at this point in the history
fix #858, 更改默认的下载模式
fix #872, 优化上传的重试判断
fix #845, 修复md5显示不正确
fix #513, 已增加上传限速
  • Loading branch information
iikira committed Apr 6, 2020
1 parent 9837f8e commit f0cc6d8
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 16 deletions.
11 changes: 7 additions & 4 deletions .github/RELEASE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# 更新日志:

1. 新增上传、下载设置限速
2. 优化Windows下载大文件时的处理性能, [点此查看详情和设置方法](https://github.com/iikira/BaiduPCS-Go/wiki/Windows%E5%A6%82%E4%BD%95%E5%BC%80%E5%90%AF%E4%BC%98%E5%8C%96%E4%B8%8B%E8%BD%BD%E5%A4%A7%E6%96%87%E4%BB%B6%E6%97%B6%E7%9A%84%E5%A4%84%E7%90%86%E6%80%A7%E8%83%BD)
3. 更新下载器
4. 多处bug修复
1. 修复文件md5显示错误
2. 修复无法上传
3. 修复分享列表获取不到密码
4. 更新上传、下载处理流程,优化重试的判断条件
5. 更新download命令, 移除之前的-stream -share -locate等参数,新增-mode参数, 设置下载模式
6. 更新默认的下载模式mode为locate, 参见 [#858](https://github.com/iikira/BaiduPCS-Go/issues/858)
7. 移除后台下载(bg)功能

个人项目bug在所难免! 欢迎提 issue 和 pull request!!.

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ This project was largely inspired by [GangZhuo/BaiduPCS](https://github.com/Gang

Go语言程序, 可直接在[发布页](https://github.com/iikira/BaiduPCS-Go/releases)下载使用.

可在这里下载最新commit对应的**测试版**: https://ci.appveyor.com/project/iikira/baidupcs-go/build/artifacts

如果程序运行时输出乱码, 请检查下终端的编码方式是否为 `UTF-8`.

使用本程序之前, 建议学习一些 linux 基础知识 和 基础命令.
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name="BaiduPCS-Go"
version=$1

if [ "$1" = "" ]; then
version=v3.6.1
version=v3.6.2
fi

output="out/"
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const (

var (
// Version 版本号
Version = "v3.6.1-devel"
Version = "v3.6.2-devel"

historyFilePath = filepath.Join(pcsconfig.GetConfigDir(), "pcs_command_history.txt")
reloadFn = func(c *cli.Context) error {
Expand Down Expand Up @@ -96,7 +96,7 @@ func main() {
app.Name = "BaiduPCS-Go"
app.Version = Version
app.Author = "iikira/BaiduPCS-Go: https://github.com/iikira/BaiduPCS-Go"
app.Copyright = "(c) 2016-2019 iikira."
app.Copyright = "(c) 2016-2020 iikira."
app.Usage = "百度网盘客户端 for " + runtime.GOOS + "/" + runtime.GOARCH
app.Description = `BaiduPCS-Go 使用Go语言编写的百度网盘命令行客户端, 为操作百度网盘, 提供实用功能.
具体功能, 参见 COMMANDS 列表
Expand Down
4 changes: 2 additions & 2 deletions requester/multipartreader/multipartreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func NewMultipartReader() (mr *MultipartReader) {

// AddFormFeild 增加 form 表单
func (mr *MultipartReader) AddFormFeild(fieldname string, readerlen rio.ReaderLen) {
if (readerlen == nil) {
if readerlen == nil {
return
}

Expand All @@ -71,7 +71,7 @@ func (mr *MultipartReader) AddFormFeild(fieldname string, readerlen rio.ReaderLe

// AddFormFile 增加 form 文件表单
func (mr *MultipartReader) AddFormFile(fieldname, filename string, readerlen64 rio.ReaderLen64) {
if (readerlen64 == nil) {
if readerlen64 == nil {
return
}

Expand Down
7 changes: 7 additions & 0 deletions requester/rio/buf.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ func NewBuffer(buf []byte) *Buffer {
}
}

// ReadAt 实现 io.ReadAt 接口
// 不进行越界检查
func (b *Buffer) ReadAt(p []byte, off int64) (n int, err error) {
n = copy(p, b.Buf[off:])
return n, nil
}

// WriteAt 实现 io.WriterAt 接口
// 不进行越界检查
func (b *Buffer) WriteAt(p []byte, off int64) (n int, err error) {
Expand Down
4 changes: 2 additions & 2 deletions requester/uploader/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ func (fb *fileBlock) Read(b []byte) (n int, err error) {
fb.mu.Lock()
defer fb.mu.Unlock()

if fb.readed+fb.readRange.Begin >= fb.readRange.End {
left := int(fb.Left())
if left <= 0 {
return 0, io.EOF
}

left := int(fb.Left())
if len(b) > left {
n, err = fb.readerAt.ReadAt(b[:left], fb.readed+fb.readRange.Begin)
} else {
Expand Down
39 changes: 39 additions & 0 deletions requester/uploader/block_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package uploader_test

import (
"fmt"
"github.com/iikira/BaiduPCS-Go/pcsutil/cachepool"
"github.com/iikira/BaiduPCS-Go/requester/rio"
"github.com/iikira/BaiduPCS-Go/requester/transfer"
"github.com/iikira/BaiduPCS-Go/requester/uploader"
"io"
"testing"
)

var (
blockList = uploader.SplitBlock(10000, 999)
)

func TestSplitBlock(t *testing.T) {
for k, e := range blockList {
fmt.Printf("%d %#v\n", k, e)
}
}

func TestSplitUnitRead(t *testing.T) {
var size int64 = 65536*2+3432
buffer := rio.NewBuffer(cachepool.RawMallocByteSlice(int(size)))
unit := uploader.NewBufioSplitUnit(buffer, transfer.Range{Begin: 2, End: size}, nil, nil)

buf := cachepool.RawMallocByteSlice(1022)
for {
n, err := unit.Read(buf)
if err != nil {
if err == io.EOF {
break
}
t.Fatalf("read error: %s\n", err)
}
fmt.Printf("n: %d, left: %d\n", n, unit.Left())
}
}
Binary file modified resource_windows_386.syso
Binary file not shown.
Binary file modified resource_windows_amd64.syso
Binary file not shown.
10 changes: 5 additions & 5 deletions versioninfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"FileVersion": {
"Major": 3,
"Minor": 6,
"Patch": 1,
"Patch": 2,
"Build": 0
},
"ProductVersion": {
"Major": 3,
"Minor": 6,
"Patch": 1,
"Patch": 2,
"Build": 0
},
"FileFlagsMask": "3f",
Expand All @@ -22,14 +22,14 @@
"Comments": "",
"CompanyName": "iikira",
"FileDescription": "百度网盘客户端",
"FileVersion": "v3.6.1",
"FileVersion": "v3.6.2",
"InternalName": "",
"LegalCopyright": "© 2016-2019 iikira.",
"LegalCopyright": "© 2016-2020 iikira.",
"LegalTrademarks": "",
"OriginalFilename": "",
"PrivateBuild": "",
"ProductName": "BaiduPCS-Go",
"ProductVersion": "v3.6.1",
"ProductVersion": "v3.6.2",
"SpecialBuild": ""
},
"VarFileInfo": {
Expand Down

0 comments on commit f0cc6d8

Please sign in to comment.