|
@@ -38,7 +38,8 @@ class LyricService {
|
|
|
*/
|
|
*/
|
|
|
async fetchNavidromeLyric(
|
|
async fetchNavidromeLyric(
|
|
|
currentSong: SongData,
|
|
currentSong: SongData,
|
|
|
- getAccountById: AccountGetter
|
|
|
|
|
|
|
+ getAccountById: AccountGetter,
|
|
|
|
|
+ songId:string
|
|
|
): Promise<string> {
|
|
): Promise<string> {
|
|
|
if (!currentSong || !currentSong.webdav_account_id) {
|
|
if (!currentSong || !currentSong.webdav_account_id) {
|
|
|
return '';
|
|
return '';
|
|
@@ -53,9 +54,10 @@ class LyricService {
|
|
|
|
|
|
|
|
const artist = currentSong.artist || '';
|
|
const artist = currentSong.artist || '';
|
|
|
const title = currentSong.name || '';
|
|
const title = currentSong.name || '';
|
|
|
- const navidromeLyric = await navidromeRestApi.getLyrics(account, artist, title);
|
|
|
|
|
-
|
|
|
|
|
- if (StrUtil.isNotEmpty(navidromeLyric)) {
|
|
|
|
|
|
|
+ // 对于 Navidrome,使用 id 字段而不是 webdav_id
|
|
|
|
|
+ // 使用 getLyricsBySongId 方法,它会自动将JSON格式转换为LRC格式
|
|
|
|
|
+ const navidromeLyric = await navidromeRestApi.getLyricsBySongId(account, songId);
|
|
|
|
|
+ if (navidromeLyric && StrUtil.isNotEmpty(navidromeLyric)) {
|
|
|
ServerLogUtil.info(TAG, '成功从Navidrome服务器获取到歌词');
|
|
ServerLogUtil.info(TAG, '成功从Navidrome服务器获取到歌词');
|
|
|
return navidromeLyric;
|
|
return navidromeLyric;
|
|
|
} else {
|
|
} else {
|