Skip to content

Commit

Permalink
feat: show progress (eg. 2/4 downloaded)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsHenry35 committed Nov 5, 2023
1 parent d9ec038 commit 890dfbd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 4 additions & 2 deletions gui/download2.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ def get_cram_class(course, user_id, access_token):
}


def download2(course_list, user_id, access_token, aria2_path, custom_down_path, final):
def download2(course_list, user_id, access_token, aria2_path, custom_down_path, now, all):
global aria2process
if custom_down_path == '':
custom_down_path = "乐读-下载"
gid_group = {}

final = True if now == all else False

def aria2_download(link, path, filename):
options = {"dir": path, "out": filename}
download_ = jsonrpc.addUri([link], options=options)
Expand Down Expand Up @@ -217,7 +219,7 @@ def update_download_status():
count += 1
count = 2
tkinterlist = {}
text = ttk.Label(text='当前正在下载课程:' + course_name)
text = ttk.Label(text=f"当前正在下载课程: {course_name} {now} / {all}")
text.grid(row=1, column=0)
for filename in download_urls:
text = ttk.Label(text=filename)
Expand Down
6 changes: 1 addition & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ def download():
result, custom_down_path = download1(uid, token)
aria2_path = get_platform_info()
for count, course in enumerate(result):
if count == len(result) - 1:
final = True
else:
final = False
download2(course, uid, token, aria2_path, custom_down_path, final)
download2(course, uid, token, aria2_path, custom_down_path, count + 1, len(result))


def get_platform_info():
Expand Down

0 comments on commit 890dfbd

Please sign in to comment.