From 564371a19409514dd9a020b266011b8427e2a297 Mon Sep 17 00:00:00 2001 From: SuperScript-PRC <2528622340@qq.com> Date: Wed, 14 Feb 2024 11:04:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=97=AE=E9=A2=98=20&=20=E4=B8=8B=E8=BD=BD=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=BC=82=E5=B8=B8=E5=8F=91=E5=87=BA=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_market/SuperSoundMixer/__init__.py | 14 +++++++------- tooldelta/urlmethod.py | 9 ++++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/plugin_market/SuperSoundMixer/__init__.py b/plugin_market/SuperSoundMixer/__init__.py index 53c041a7..4d6cc5c7 100644 --- a/plugin_market/SuperSoundMixer/__init__.py +++ b/plugin_market/SuperSoundMixer/__init__.py @@ -88,7 +88,7 @@ def __mixer__( self.SuperSoundMixer_threadings_num += 1 self.SuperSoundMixer_ThreadMusic.append(sound_name) with open( - "插件配置文件\\SuperSoundMixer\\SoundCmds\\%s.txt" % sound_name, + "插件配置文件/SuperSoundMixer/SoundCmds/%s.txt" % sound_name, "r", encoding="utf-8", ) as music_txt: @@ -130,9 +130,9 @@ def __mixer__( def updateMidifile(): - for i in os.listdir("插件配置文件\\SuperSoundMixer"): + for i in os.listdir("插件配置文件/SuperSoundMixer"): if i.endswith(".mid"): - midi_input = "插件配置文件\\SuperSoundMixer\\" + i + midi_input = "插件配置文件/SuperSoundMixer/" + i canvas = Canvas() p = canvas artist = MidiDo(canvas=canvas, y=p.y + 10) @@ -143,7 +143,7 @@ def updateMidifile(): ), ) with open( - "插件配置文件\\SuperSoundMixer\\SoundCmds\\%s.txt" + "插件配置文件/SuperSoundMixer/SoundCmds/%s.txt" % i.replace(".mid", ""), "w", encoding="utf-8", @@ -153,7 +153,7 @@ def updateMidifile(): """({}, "{}", {}, {})""".format(tip, _ins, note, vol) + "\n" ) musicfile.close() - os.remove("插件配置文件\\SuperSoundMixer\\" + i) + os.remove("插件配置文件/SuperSoundMixer/" + i) updateMidifile() @@ -184,7 +184,7 @@ async def _(playername, msg): del exception try: if os.path.exists( - "插件配置文件\\SuperSoundMixer\\SoundCmds\\%s.txt" + "插件配置文件/SuperSoundMixer/SoundCmds/%s.txt" % get_sound_data["name"] ): try: @@ -210,7 +210,7 @@ async def _(playername, msg): # 音乐文件名(无mid后缀) 播放的对象 乐器 忽略高音 速度 else: if os.path.exists( - "插件配置文件\\SuperSoundMixer\\%s.mid" % get_sound_data[2] + "插件配置文件/SuperSoundMixer/%s.mid" % get_sound_data[2] ): updateMidifile() tellrawText("@a", "§cSuperSoundMixer§f>> §6文件正在初始化") diff --git a/tooldelta/urlmethod.py b/tooldelta/urlmethod.py index 64546bac..2d6ad5be 100644 --- a/tooldelta/urlmethod.py +++ b/tooldelta/urlmethod.py @@ -19,7 +19,7 @@ def download_file(f_url: str, f_dir: str, ignore_warnings=False): if filesize < 256 and "404" in res.text: raise requests.RequestException("下载失败: 返回 404") elif filesize < 256 and not ignore_warnings: - Print.print_war(f"下载 {f_url} 的文件警告: 文件大小异常, 不到 0.256KB") + Print.print_war(f"下载 {f_url} 的文件警告: 文件大小异常, 不到 0.25KB") nowsize = 0 succ = False @@ -27,7 +27,7 @@ def download_file(f_url: str, f_dir: str, ignore_warnings=False): useSpeed = 0 with open(f_dir + ".tmp", "wb") as dwnf: - for chk in res.iter_content(chunk_size=8192): + for chk in res.iter_content(chunk_size = 8192): nowtime = time.time() if nowtime != lastime: @@ -44,12 +44,15 @@ def download_file(f_url: str, f_dir: str, ignore_warnings=False): "§f" + " " * _tmp + "§b" + " " * (20 - _tmp) + "§r ", 7 ) Print.print_with_info( - f"{bar} {round(nowsize / 1024, 2)}KB / {round(filesize / 1024, 2)}KB ({_pretty_kb(useSpeed)}B/s) ", + f"{bar} {_pretty_kb(nowsize)}B / {_pretty_kb(filesize)}B ({_pretty_kb(useSpeed)}B/s) ", "§a 下载 §r", end="\r", need_log=False, ) + if nowsize / filesize > 1: + Print.print_war(f"下载: 实际大小已超出文件大小 {round(nowsize / filesize, 2)} 倍") + succ = True if succ: