Display lyrics on UI if synced lyrics present in metadata (#1406)

Signed-off-by: Chirag Lulla <lullachirag239@gmail.com>
This commit is contained in:
Chirag Lulla 2021-10-19 19:51:20 +05:30 committed by GitHub
parent 0d2a8f5338
commit 34b01c2cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -56,6 +56,7 @@ const Player = () => {
clearPriorAudioLists: false,
showDestroy: true,
showDownload: false,
showLyric: true,
showReload: false,
toggleMode: !isDesktop,
glassBg: false,

View File

@ -23,11 +23,15 @@ const initialState = {
const mapToAudioLists = (item) => {
// If item comes from a playlist, trackId is mediaFileId
const trackId = item.mediaFileId || item.id
const { lyrics } = item
const timestampRegex =
/(\[([0-9]{1,2}:)?([0-9]{1,2}:)([0-9]{1,2})(\.[0-9]{1,2})?\])/g
return {
trackId,
uuid: uuidv4(),
song: item,
name: item.title,
lyric: timestampRegex.test(lyrics) ? lyrics : '',
singer: item.artist,
duration: item.duration,
musicSrc: subsonic.streamUrl(trackId),