Skip to content

Commit

Permalink
Fix #273 : downdir() downloads to a wrong directory structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
houtianze committed Jan 10, 2017
1 parent 2dc460e commit 5bb3abd
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ nosetests.xml
#.idea/
#.idea/workspace.xml
#*.rst
bypy/test/testdir/
bypy/test/**/*.bin
bypy/test/downdir/
bypy/test/sharedir/
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Version History:

- 1.3.6: Fix downdir downloads to a wrong directory structure
- 1.3.5: Fix aria2 unable to resume download
- 1.3.4: Add --select-fastest-mirror, --config-dir command line arguments; Swith to wheel dist format
- 1.3.3: Fix the upload failure when slices expired
Expand Down
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Version History:
~~~~~~~~~~~~~~~~

- 1.3.6: Fix downdir downloads to a wrong directory structure
- 1.3.5: Fix aria2 unable to resume download
- 1.3.4: Add --select-fastest-mirror, --config-dir command line
arguments; Swith to wheel dist format
Expand Down
7 changes: 4 additions & 3 deletions bypy/bypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1927,16 +1927,17 @@ def __prepare_local_dir(self, localdir):
def __proceed_downdir(self, remotepath, dirjs, filejs, args):
result = const.ENoError
rootrpath, localpath = args
rlen = len(remotepath) + 1 # '+ 1' for the trailing '/', it bites.
rootlen = len(rootrpath) + 1 # ditto
#rlen = len(remotepath) + 1
rootlen = len(rootrpath) + 1 # '+ 1' for the trailing '/', it bites.

result = self.__prepare_local_dir(localpath)
if result != const.ENoError:
perr("Fail to create prepare local directory '{}' for downloading, ABORT".format(localpath))
return result

for dirj in dirjs:
reldir = dirj['path'][rlen:]
rdir = dirj['path']
reldir = rdir[rootlen:]
#ldir = os.path.join(localpath, reldir)
ldir = joinpath(localpath, reldir)
result = self.__prepare_local_dir(ldir)
Expand Down
2 changes: 1 addition & 1 deletion bypy/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# https://packaging.python.org/single_source_version/
__title__ = 'bypy'
__version__ = '1.3.5'
__version__ = '1.3.6'
__author__ = 'Hou Tianze'
__license__ = 'MIT'
__desc__ ='Python client for Baidu Yun (Personal Cloud Storage) 百度云/百度网盘 Python 客户端'
Expand Down
2 changes: 1 addition & 1 deletion bypy/printer_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def pprgr(finish, total, start_time = None, existing = 0,
segth = seg
percent = 100
current_batch_percent = 0
else:

eta = ''
now = time.time()
if start_time is not None and current_batch_percent > 5 and finish > 0:
Expand Down
1 change: 1 addition & 0 deletions bypy/test/testdir/subdir/subsubdir/aaa.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
File in a sub sub directory

0 comments on commit 5bb3abd

Please sign in to comment.