Skip to content

Commit

Permalink
Version 1.6.9.4.4
Browse files Browse the repository at this point in the history
Various bugfixes
  • Loading branch information
mos9527 committed Aug 10, 2023
1 parent d4695f2 commit c267391
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyncm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# 注意事项
- (PR#11) 海外用户可能经历 460 "Cheating" 问题,可通过添加以下 Header 解决: `X-Real-IP = 118.88.88.88`
"""
__version__ = "1.6.9.4.3"
__version__ = "1.6.9.4.4"

from threading import current_thread
from typing import Text, Union
Expand Down
15 changes: 10 additions & 5 deletions pyncm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def __call__(self, ids):
queued = []
for _id in ids:
logger.info(self.prefix + ": %s" % UserHelper(_id).UserName)
logger.warn('同时下载收藏歌单' if self.args.user_bookmarks else '只下载该用户创建的歌单')
logger.warning('同时下载收藏歌单' if self.args.user_bookmarks else '只下载该用户创建的歌单')
playlist_ids = [
pl['id'] for pl in user.GetUserPlaylists(_id)['playlist'] if self.args.user_bookmarks or pl['creator']['userId'] == UserHelper(_id).ID
]
Expand Down Expand Up @@ -491,11 +491,16 @@ def parse_sharelink(url):
"user" : ["user"]
}
rtype = "song" # Defaults to songs (tracks)
best_index = len(url)
for rtype_, rkeyword in table.items():
for kw in rkeyword:
if kw in url:
rtype = rtype_
break # Match type by keyword
try:
index = url.index(kw)
if index < best_index:
best_index = index
rtype = rtype_
except ValueError:
continue
return rtype, ids


Expand Down Expand Up @@ -757,7 +762,7 @@ def report():
logger.error('你可以将下载失败的 ID 作为参数以再次下载')
logger.error('所有失败的任务 ID: %s' % ' '.join([str(i) for i in failed_ids.keys()]))
report()
logger.info(f'任务完成率 {(executor.finished_tasks * 100 / len(queuedTasks)):.1f}%')
logger.info(f'任务完成率 {(executor.finished_tasks * 100 / max(1,len(queuedTasks))):.1f}%')
# To get actually downloaded tasks, filter by exlcuding failed_ids against task.song.ID
return queuedTasks, failed_ids

Expand Down

0 comments on commit c267391

Please sign in to comment.