-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathqdes.py
32 lines (28 loc) · 921 Bytes
/
qdes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# ----------------------------------------
# - mode: python -
# - author: helloplhm-qwq -
# - name: qdes.py -
# - project: lx-music-api-server -
# - license: MIT -
# ----------------------------------------
# This file is part of the "lx-music-api-server" project.
from .log import log
from . import variable
import binascii
import zlib
logger = log('qdes')
try:
from .natives import qdes
variable.qdes_lib_loaded = True
except:
try:
import qdes
variable.qdes_lib_loaded = True
except:
logger.warning('QRC解密库qdes加载失败, 可能为不支持当前系统, QRC相关的逐字歌词获取将无法使用')
def qdes_decrypt(qrc):
if variable.qdes_lib_loaded:
decoded = zlib.decompress(qdes.LyricDecode(binascii.unhexlify(qrc.encode('utf-8')))).decode('utf-8')
return decoded
else:
raise ModuleNotFoundError('qdes解密库未被加载')