support for parse times

This commit is contained in:
SrGooglo 2025-02-05 20:28:31 +00:00
parent dde659ef01
commit 342cc34d65
2 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,8 @@
import React from "react" import React from "react"
import classnames from "classnames" import classnames from "classnames"
import parseTimeToMs from "@utils/parseTimeToMs"
import useMaxScreen from "@hooks/useMaxScreen" import useMaxScreen from "@hooks/useMaxScreen"
import { usePlayerStateContext } from "@contexts/WithPlayerContext" import { usePlayerStateContext } from "@contexts/WithPlayerContext"
@ -62,7 +64,7 @@ const EnchancedLyricsPage = () => {
// get current track instance // get current track instance
const instance = app.cores.player.track() const instance = app.cores.player.track()
const result = await instance.manifest.serviceOperations let result = await instance.manifest.serviceOperations
.fetchLyrics({ .fetchLyrics({
preferTranslation: translationEnabled, preferTranslation: translationEnabled,
}) })
@ -71,6 +73,10 @@ const EnchancedLyricsPage = () => {
return null return null
}) })
if (result.sync_audio_at && !result.sync_audio_at_ms) {
result.sync_audio_at_ms = parseTimeToMs(result.sync_audio_at)
}
console.log("Fetched Lyrics >", result) console.log("Fetched Lyrics >", result)
if (result) { if (result) {

View File

@ -0,0 +1,9 @@
export default (timeStr) => {
const [minutes, seconds, milliseconds] = timeStr.split(":")
return (
Number(minutes) * 60 * 1000 +
Number(seconds) * 1000 +
Number(milliseconds)
)
}