Temp Upload
This commit is contained in:
parent
bee7f106c5
commit
18de4e1cea
@ -78,6 +78,9 @@ def get_song_lyric(id: str | int | dict, path: str, allinfo: bool = False):
|
||||
artists = artists[:-1]
|
||||
|
||||
name = sinfo["name"]
|
||||
if not name:
|
||||
print("歌曲错误!这是网易云的问题,请不要找作者")
|
||||
return "song_err"
|
||||
replaces = { # 处理非法字符所用的替换字典(根据网易云下载的文件分析得到)
|
||||
"|": "|",
|
||||
":": ":",
|
||||
|
@ -250,7 +250,9 @@ def get_lyric_from_folder(self):
|
||||
q_err,
|
||||
q_info)).start()
|
||||
allocated += 1
|
||||
current_process += 1
|
||||
bar.suffix = f"已分配: {ncm_files[allocated-1]}"
|
||||
print(len(bar.fill))
|
||||
bar.update()
|
||||
while True: # 错误队列检测
|
||||
try:
|
||||
|
33
modules/utils/bar.py
Normal file
33
modules/utils/bar.py
Normal file
@ -0,0 +1,33 @@
|
||||
"""一些有关调整进度条的设置"""
|
||||
from os import get_terminal_size
|
||||
|
||||
from progress.bar import Bar
|
||||
|
||||
|
||||
def suit_length(bar: Bar, original: Bar):
|
||||
"""尽量调整进度条大小去匹配终端宽度"""
|
||||
length = get_terminal_size().columns
|
||||
original_length = original.width + len((original.message +
|
||||
original.bar_suffix +
|
||||
original.bar_prefix +
|
||||
original.suffix) % bar)
|
||||
if length >= original_length:
|
||||
return
|
||||
if length < len(str(bar.max) + "/" + str(bar.index)):
|
||||
bar.bar_suffix = bar.suffix = bar.bar_prefix = ""
|
||||
bar.width = 0
|
||||
bar.suffix = Bar.suffix
|
||||
elif length >= original_length - bar.width:
|
||||
bar.width = length - len((bar.message + bar.bar_suffix + bar.bar_prefix + bar.suffix) % bar)
|
||||
elif length >= original_length - (bar.width + len(bar.suffix % bar)) and "(index)" in bar.message:
|
||||
bar.suffix = ""
|
||||
bar.width = length - len((bar.message + bar.bar_suffix + bar.bar_prefix + bar.suffix) % bar)
|
||||
elif length >= original_length - (bar.width + len(bar.message % bar)) and "(index)" in bar.suffix:
|
||||
bar.message = ""
|
||||
bar.width = length - len((bar.message + bar.bar_suffix + bar.bar_prefix + bar.suffix) % bar)
|
||||
elif length >= original_length - (bar.width + len((bar.message + bar.suffix) % bar)) + Bar.suffix % bar:
|
||||
bar.message = ""
|
||||
bar.suffix = Bar.suffix
|
||||
bar.width = length - len((bar.message + bar.bar_suffix + bar.bar_prefix + bar.suffix) % bar)
|
||||
bar.update()
|
||||
return
|
7
modules/utils/length.py
Normal file
7
modules/utils/length.py
Normal file
@ -0,0 +1,7 @@
|
||||
"""一些有关计算长度的工具"""
|
||||
|
||||
|
||||
def len_abs(content):
|
||||
"""针对中文:将一个汉字识别为2个长度,而不是1个"""
|
||||
|
||||
return len(content) + (len(content.encode("utf-8")) - len(content)) // 2
|
Loading…
Reference in New Issue
Block a user