Skip to content

Commit ebe1e3e

Browse files
committed
Revert previous commit - Not following Baidu PCS's fuck ups
1 parent 2a5771a commit ebe1e3e

9 files changed

+42
-12
lines changed

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Version History:
22

3+
- 1.6.11: Revert the previous change - Baidu PCS's behavior is wrong and makes no sense
34
- 1.6.10: Fix MD5 comparision (thanks to @shenchucheng)
45
- 1.6.9: Make auth server list dynamic
56
- 1.6.8: Fix 1000 items limit for downloading

HISTORY.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Version History:
22
~~~~~~~~~~~~~~~~
33

4+
- 1.6.11: Revert the previous change - Baidu PCS’s behavior is wrong
5+
and makes no sense
6+
47
- 1.6.10: Fix MD5 comparision (thanks to @shenchucheng)
58

69
- 1.6.9: Make auth server list dynamic

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ bypy compare
128128
- 运行时添加`-d`,会显示一些调试信息。
129129
- 运行时添加`-ddd`,还会会显示HTTP通讯信息(**警告:非常多**
130130

131-
整合测试(15 - 30分钟)
131+
整合测试(15 - 30分钟)
132132
-------------------
133133

134134
- 在主目录下跑:`python -m bypy.test`
1.07 MB
Binary file not shown.
318 KB
Binary file not shown.

bypy/bypy.py

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,17 +2597,18 @@ def __proceed_remote_gather(self, walkresult, remotepath, dirjs, filejs, args =
25972597
self.__remote_dir_contents.get(remotepath[rootlen:]).add(
25982598
d['path'][dlen:], PathDictTree('D', size = d['size'], md5 = d['md5'] if 'md5' in d else ''))
25992599

2600+
# Baidu made another fuck up here:
2601+
# f['md5'] doesn't have the correct MD5 value, but f['block_list'][0] has
2602+
# This makes no sense, and I'm not going to change the correct code to adapt its wrong behaviors
2603+
# --- Code below for reference ---
2604+
# fmd5 = f['md5']
2605+
# bl = 'block_list'
2606+
# if bl in f and f[bl]:
2607+
# fmd5 = f[bl][0]
2608+
# f['path'][dlen:], PathDictTree('F', size = f['size'], md5 = fmd5))
26002609
for f in filejs:
2601-
fmd5 = f['md5']
2602-
bl = 'block_list'
2603-
if bl in f and f[bl]:
2604-
fmd5 = f[bl][0]
26052610
self.__remote_dir_contents.get(remotepath[rootlen:]).add(
2606-
f['path'][dlen:], PathDictTree('F', size = f['size'], md5 = fmd5))
2607-
# 网盘和本地文件相同,但本地文件md5与网盘获取到的md5值却不一致
2608-
# 与之对应的是在block_list列表中的值
2609-
# 此处修改后可实现增量上传,compare函数运行结果才是正确的
2610-
# f['path'][dlen:], PathDictTree('F', size = f['size'], md5 = f['md5']))
2611+
f['path'][dlen:], PathDictTree('F', size = f['size'], md5 = f['md5']))
26112612

26122613
return walkresult
26132614

@@ -3608,8 +3609,29 @@ def clean_prog_files(cleanlevel, verbose, configdir = const.ConfigDir):
36083609

36093610
return result
36103611

3612+
def printBaiduBanner():
3613+
banner ='''
3614+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3615+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3616+
Baidu PCS currently gives totally WRONG MD5 hash for remote files, and I AM NOT GOING TO ADAPT TO IT!
3617+
So it if doesn't work, install version '1.6.10' using the following command:
3618+
pip install bypy==1.6.10
3619+
Version 1.6.10 has a workaround for this.
3620+
### Seeking maintainer fo this `bypy` project, if you are interested, please create an issue at github, thanks. ###
3621+
----------------------------------------------------------------
3622+
百度云盘返回的MD5全错了,鬼知道他们什么时候会改回来!现在代码是按照MD5值是正确的前提来写的,不会改。
3623+
所以你发现比较功能等不能正确工作时,请安装 1.6.10 版本:
3624+
pip install bypy==1.6.10
3625+
1.6.10版有个临时解决方案。
3626+
### 寻求这个`bypy`项目维护者,有意的话请去github上建issue,谢谢。###
3627+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3628+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3629+
'''
3630+
print(banner)
3631+
36113632
def main(argv=None): # IGNORE:C0111
36123633
''' Main Entry '''
3634+
printBaiduBanner()
36133635

36143636
by = None
36153637
reqres = check_requirements()

bypy/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# https://packaging.python.org/single_source_version/
1414
__title__ = 'bypy'
15-
__version__ = '1.6.10'
15+
__version__ = '1.6.11'
1616
__author__ = 'Hou Tianze'
1717
__license__ = 'MIT'
1818
__desc__ = 'Python client for Baidu Yun (Personal Cloud Storage) 百度云/百度网盘 Python 客户端'

release.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
# brew install pandoc
88
# pip3 install pandoc pypandoc twine pyflakes
99

10+
### Usage ###
11+
# - Testing: ./release.sh -buti
12+
# - Actual: ./release.sh -abigtu
13+
1014
#set -o errexit
1115
#set -x
1216

update/update.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"comment": "Update info",
3-
"recommendedVersion": "1.6.10",
3+
"recommendedVersion": "1.6.11",
44
"minimumRequiredVersion": "1.6.0"
55
}

0 commit comments

Comments
 (0)