revert: fix: 修复MP3内嵌歌词读取

This commit is contained in:
helloplhm-qwq 2024-02-06 11:52:38 +08:00
parent d2bedcfd73
commit 46a270f4f4
No known key found for this signature in database
GPG Key ID: 6BE1B64B905567C7

View File

@ -167,7 +167,7 @@ def getAudioMeta(filepath):
if (album):
album = album.text
if (lyric):
lyric = lyric.text
lyric = [lyric.text]
if (not lyric):
if (os.path.isfile(os.path.splitext(filepath)[0] + '.lrc')):
with open(os.path.splitext(filepath)[0] + '.lrc', 'r', encoding='utf-8') as f:
@ -286,7 +286,14 @@ def getAudioCover(filepath):
audio = mutagen.File(filepath)
if not audio:
return None
return convertCover(audio.get('APIC:').data)
if (filepath.lower().endswith('mp3')):
return audio.get('APIC:').data
else:
if (readFileCheckCover(filepath)):
return getAudioCoverFromFFMpeg(filepath)
else:
return None
except:
logger.error(f"get audio cover error: {filepath}")
logger.error(traceback.format_exc())