Huge Rewrite!
This commit is contained in:
14
HelperMusicDB.py
Normal file
14
HelperMusicDB.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from MusicDB import musicDB
|
||||
from loguru import logger
|
||||
|
||||
|
||||
def getMusicTitle(musicId: int) -> str:
|
||||
'''从数据库获取音乐的标题'''
|
||||
#logger.debug(f"查询歌名: {musicId}")
|
||||
musicInfo = musicDB.get(musicId)
|
||||
if not musicInfo:
|
||||
logger.warning(f"数据库里未找到此歌曲: {musicId}")
|
||||
return "R_ERR_MUSIC_ID_NOT_IN_DATABASE"
|
||||
musicName = musicInfo.get("name")
|
||||
#logger.debug(f"成功查询到歌名: {musicName}")
|
||||
return musicName
|
||||
Reference in New Issue
Block a user