feat: wyy音质检查

This commit is contained in:
helloplhm-qwq 2023-12-02 12:46:23 +08:00
parent 3d2d241a36
commit 225753a7a2
No known key found for this signature in database
GPG Key ID: 6BE1B64B905567C7
2 changed files with 9 additions and 4 deletions

View File

@ -19,9 +19,9 @@ tools = {
'320k': 'exhigh',
'flac': 'lossless',
'flac24bit': 'hires',
"jyeffect": "jyeffect",
"jysky": "jysky",
"jymaster": "jymaster",
"dolby": "jyeffect",
"sky": "jysky",
"master": "jymaster",
},
'cookie': config.read_config('module.wy.user.cookie'),
}
@ -43,4 +43,7 @@ async def url(songId, quality):
body = json.loads(req.text)
if (not body.get("data") or (not body.get("data")) or (not body.get("data")[0].get("url"))):
raise FailedException("failed")
if (config.read_config('module.wy.reject_unmatched_quality')):
if (body['data'][0]['level'] != tools['qualityMap'][quality]):
raise FailedException("reject unmatched quality")
return body["data"][0]["url"].split("?")[0]

View File

@ -165,7 +165,9 @@ default = {
"user": {
"desc": "账号cookie数据可以通过浏览器获取需要vip账号来获取会员歌曲如果没有请留为空值",
"cookie": ""
}
},
"reject_unmatcher_quality": True,
"_reject_unmatcher_quality-desc": "是否拒绝不匹配的音质默认拒绝网易云API在当前环境无法获取该音质时会自动将低音质开启此功能将拒绝被降级的音质返回",
},
"mg": {
"desc": "咪咕音乐相关配置",