neteasedown fix bug

This commit is contained in:
xtaodada 2021-06-27 17:16:30 +08:00
parent 5e4203ffe8
commit 8246481305
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 68 additions and 69 deletions

View File

@ -292,7 +292,7 @@
},
{
"name": "neteasedown",
"version": "1.0",
"version": "1.1",
"section": "daily",
"maintainer": "xtaodada",
"size": "15.6 kb",

View File

@ -232,6 +232,24 @@ async def ned(context):
await context.edit("**使用方法:** `-ned` `<关键词/id>`")
return
else:
if not eyed3_imported and not cc_imported:
try:
await context.edit("支持库 `eyed3` `PyCryptodome` 未安装...\n正在尝试自动安装...")
await execute(f'{executable} -m pip install eyed3')
await execute(f'{executable} -m pip install pycryptodome')
await sleep(10)
result = await execute(f'{executable} -m pip show eyed3')
result_1 = await execute(f'{executable} -m pip show pycryptodome')
if len(result) > 0 and len(result_1) > 0:
await context.edit('支持库 `eyed3` `pycryptodome` 安装成功...\n正在尝试自动重启...')
await context.client.disconnect()
else:
await context.edit(
f"自动安装失败..\n请尝试手动安装 `-sh {executable} -m pip install eyed3` 和 "
f"`-sh {executable} -m pip install pycryptodome` 随后,请重启 PagerMaid-Modify 。")
return
except:
return
type = 'keyword'
id = context.parameter[0]
# 测试是否为 id
@ -293,7 +311,6 @@ async def ned(context):
else:
await context.edit("出错了呜呜呜 ~ 无效的参数。")
return
if eyed3_imported and cc_imported:
await context.edit("获取中 . . .")
try:
data = netease_single(id)
@ -344,21 +361,3 @@ async def ned(context):
)
await context.delete()
return
else:
try:
await context.edit("支持库 `eyed3` `PyCryptodome` 未安装...\n正在尝试自动安装...")
await execute(f'{executable} -m pip install eyed3')
await execute(f'{executable} -m pip install pycryptodome')
await sleep(10)
result = await execute(f'{executable} -m pip show eyed3')
result_1 = await execute(f'{executable} -m pip show pycryptodome')
if len(result) > 0 and len(result_1) > 0:
await context.edit('支持库 `eyed3` `pycryptodome` 安装成功...\n正在尝试自动重启...')
await context.client.disconnect()
else:
await context.edit(
f"自动安装失败..\n请尝试手动安装 `-sh {executable} -m pip install eyed3` 和 "
f"`-sh {executable} -m pip install pycryptodome` 随后,请重启 PagerMaid-Modify 。")
return
except:
return