Skip to content

Commit

Permalink
fix: kuwo服务歌曲歌词不存在退出进程
Browse files Browse the repository at this point in the history
  • Loading branch information
zonemeen committed Jun 8, 2023
1 parent 0c85621 commit 2a6f24d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/services/lyric/kuwo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ export default async (lrcPath: string | null, lyricDownloadUrl: string) => {
data: { lrclist },
} = await got(lyricDownloadUrl).json()
let lyric = ''
for (const lrc of lrclist) {
lyric += `[${convertToStandardTime(lrc.time)}]${lrc.lineLyric}\n`
if (lrclist && lrclist.length) {
for (const lrc of lrclist) {
lyric += `[${convertToStandardTime(lrc.time)}]${lrc.lineLyric}\n`
}
} else {
lyric = '[00:00.00]无歌词'
}
if (lrcPath) {
const lrcFileWriteStream = createWriteStream(lrcPath)
Expand Down

0 comments on commit 2a6f24d

Please sign in to comment.