Skip to content

Commit

Permalink
v3.5.3 and fix #208
Browse files Browse the repository at this point in the history
  • Loading branch information
iikira committed May 29, 2018
1 parent 8492756 commit e7de55b
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 48 deletions.
14 changes: 6 additions & 8 deletions .github/RELEASE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# 更新日志:

1. 修复下载无法断点续传的 bug;
2. 修复程序自动更新失败的 bug;
3. 支持分享/取消分享文件/目录;
4. 支持获取文件下载的直链;
5. 支持以分享文件的方式获取下载链接来下载,和以获取直链的方式来下载;
6. 新增 who 命令, 获取当前帐号;

v3.5.1 的自动更新功能异常, 手动更新吧....
1. 修复下载进度超出100%;
2. 修复修改文件夹名称导致文件夹消失;
3. 修复上传失败不输出错误;
4. 下载支持以流式文件的方式下载;
5. ls列目录,增加详细显示选项;
6. emm...;

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

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.5.2
version=v3.5.3
fi

output="out/"
Expand Down
2 changes: 1 addition & 1 deletion debian/iphoneos-arm/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: BaiduPCS-Go
Version: 3.5.2
Version: 3.5.3
Homepage: https://github.com/iikira/BaiduPCS-Go
Section: 实用工具
Priority: optional
Expand Down
63 changes: 33 additions & 30 deletions internal/pcscommand/cp_mv.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,44 +51,47 @@ func runCpMvOp(op string, paths ...string) {
}

pcs := GetBaiduPCS()
toFileName := path.Base(to)
toInfo, pcsError := pcs.FilesDirectoriesMeta(to)
if pcsError != nil {
if pcsError.ErrorType() == baidupcs.ErrTypeRemoteError {
// 判断路径是否存在
// 如果不存在, 则为重命名或同目录拷贝操作
switch {
case toInfo != nil && toInfo.Filename != toFileName:
fallthrough
case pcsError != nil && pcsError.ErrorType() == baidupcs.ErrTypeRemoteError:
// 判断路径是否存在
// 如果不存在, 则为重命名或同目录拷贝操作

// 如果 froms 数不是1, 则意义不明确.
if len(froms) != 1 {
fmt.Println(err)
return
}

// 如果 froms 数不是1, 则意义不明确.
if len(froms) != 1 {
if op == "copy" { // 拷贝
err = pcs.Copy(&baidupcs.CpMvJSON{
From: froms[0],
To: to,
})
if err != nil {
fmt.Println(err)
fmt.Println("文件/目录拷贝失败: ")
fmt.Printf("%s <-> %s\n", froms[0], to)
return
}

if op == "copy" { // 拷贝
err = pcs.Copy(&baidupcs.CpMvJSON{
From: froms[0],
To: to,
})
if err != nil {
fmt.Println(err)
fmt.Println("文件/目录拷贝失败: ")
fmt.Printf("%s <-> %s\n", froms[0], to)
return
}
fmt.Println("文件/目录拷贝成功: ")
fmt.Printf("%s <-> %s\n", froms[0], to)
} else { // 重命名
err = pcs.Rename(froms[0], to)
if err != nil {
fmt.Println(err)
fmt.Println("重命名失败: ")
fmt.Printf("%s -> %s\n", froms[0], to)
return
}
fmt.Println("重命名成功: ")
fmt.Println("文件/目录拷贝成功: ")
fmt.Printf("%s <-> %s\n", froms[0], to)
} else { // 重命名
err = pcs.Rename(froms[0], to)
if err != nil {
fmt.Println(err)
fmt.Println("重命名失败: ")
fmt.Printf("%s -> %s\n", froms[0], to)
return
}
return
fmt.Println("重命名成功: ")
fmt.Printf("%s -> %s\n", froms[0], to)
}
return
case pcsError != nil && pcsError.ErrorType() != baidupcs.ErrTypeRemoteError:
fmt.Println(pcsError)
return
}
Expand Down
2 changes: 1 addition & 1 deletion internal/pcscommand/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func RunDownload(paths []string, options *DownloadOptions) {
totalSize += task.downloadInfo.Size
}

fmt.Fprintf(options.Out, "任务结束, 时间: %s, 数据总量: %s\n", time.Since(startTime), converter.ConvertFileSize(totalSize))
fmt.Fprintf(options.Out, "任务结束, 时间: %s, 数据总量: %s\n", time.Since(startTime)/1e6*1e6, converter.ConvertFileSize(totalSize))
if len(failedList) != 0 {
fmt.Printf("以下文件下载失败: \n")
tb := pcstable.NewTable(os.Stdout)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

var (
// Version 版本号
Version = "v3.5.2-devel"
Version = "v3.5.3-devel"

historyFilePath = filepath.Join(pcsconfig.GetConfigDir(), "pcs_command_history.txt")
reloadFn = func(c *cli.Context) error {
Expand Down
11 changes: 9 additions & 2 deletions requester/downloader/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ func (wer *Worker) Execute() {
}

// 已完成
if wer.wrange.Len() <= 0 {
if rlen := wer.wrange.Len(); rlen <= 0 {
if rlen < 0 {
pcsverbose.Verbosef("DEBUG: RangeLen is negative at begin: %v, %d\n", wer.wrange, wer.wrange.Len())
}
wer.status.statusCode = StatusCodeSuccessed
return
}
Expand Down Expand Up @@ -394,16 +397,20 @@ func (wer *Worker) Execute() {
}

if readErr != nil {
rlen := wer.wrange.Len()
switch {
case single && readErr == io.ErrUnexpectedEOF:
// 单线程判断下载成功
fallthrough
case readErr == io.EOF:
fallthrough
case wer.wrange.Len() <= 0:
case rlen <= 0:
// 下载完成
// 小于0可能是因为 worker 被 duplicate
wer.status.statusCode = StatusCodeSuccessed
if rlen < 0 {
pcsverbose.Verbosef("DEBUG: RangeLen is negative at end: %v, %d\n", wer.wrange, wer.wrange.Len())
}
return
default:
// 其他错误, 返回
Expand Down
Binary file modified resource_windows.syso
Binary file not shown.
8 changes: 4 additions & 4 deletions versioninfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"FileVersion": {
"Major": 3,
"Minor": 5,
"Patch": 2,
"Patch": 3,
"Build": 0
},
"ProductVersion": {
"Major": 3,
"Minor": 5,
"Patch": 2,
"Patch": 3,
"Build": 0
},
"FileFlagsMask": "3f",
Expand All @@ -22,14 +22,14 @@
"Comments": "",
"CompanyName": "iikira",
"FileDescription": "百度网盘客户端",
"FileVersion": "v3.5.2",
"FileVersion": "v3.5.3",
"InternalName": "",
"LegalCopyright": "© 2016-2018 iikira.",
"LegalTrademarks": "",
"OriginalFilename": "",
"PrivateBuild": "",
"ProductName": "BaiduPCS-Go",
"ProductVersion": "v3.5.2",
"ProductVersion": "v3.5.3",
"SpecialBuild": ""
},
"VarFileInfo": {
Expand Down

0 comments on commit e7de55b

Please sign in to comment.