Skip to content

Commit

Permalink
Display lyrics on UI if synced lyrics present in metadata (#1406)
Browse files Browse the repository at this point in the history
Signed-off-by: Chirag Lulla <lullachirag239@gmail.com>
  • Loading branch information
chiraglulla committed Oct 19, 2021
1 parent 0d2a8f5 commit 34b01c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions ui/src/audioplayer/Player.js
Expand Up @@ -56,6 +56,7 @@ const Player = () => {
clearPriorAudioLists: false,
showDestroy: true,
showDownload: false,
showLyric: true,
showReload: false,
toggleMode: !isDesktop,
glassBg: false,
Expand Down
4 changes: 4 additions & 0 deletions ui/src/reducers/playerReducer.js
Expand Up @@ -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),
Expand Down

0 comments on commit 34b01c2

Please sign in to comment.