diff --git a/app/components/Player/Fullscreen.vue b/app/components/Player/Fullscreen.vue new file mode 100644 index 0000000..83bc7de --- /dev/null +++ b/app/components/Player/Fullscreen.vue @@ -0,0 +1,138 @@ + + + + + diff --git a/app/components/Player/Fullscreen/LyricsDisplay.vue b/app/components/Player/Fullscreen/LyricsDisplay.vue new file mode 100644 index 0000000..f541cb4 --- /dev/null +++ b/app/components/Player/Fullscreen/LyricsDisplay.vue @@ -0,0 +1,226 @@ + + + + + diff --git a/app/components/Player/Fullscreen/TrackDisplay.vue b/app/components/Player/Fullscreen/TrackDisplay.vue new file mode 100644 index 0000000..9fc3180 --- /dev/null +++ b/app/components/Player/Fullscreen/TrackDisplay.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/app/components/Player/index.vue b/app/components/Player/index.vue index 2e7501f..ec78d9d 100644 --- a/app/components/Player/index.vue +++ b/app/components/Player/index.vue @@ -39,6 +39,7 @@ const durationFormatted = computed(() => ) const toast = useToast() +const fullscreen = useFullscreen() + diff --git a/app/utils/parseLyrics.ts b/app/utils/parseLyrics.ts new file mode 100644 index 0000000..0da10f6 --- /dev/null +++ b/app/utils/parseLyrics.ts @@ -0,0 +1,27 @@ +export const parseLyrics = (lrc: string) => { + const regex = /^\[(\d{2}:\d{2}(.\d{2,3})?)\](.*)/ + const lines = lrc.split("\n") + const output: { time: number; text: any }[] = [] + + const parseTime = (time: any) => { + const minsec = time.split(":") + const min = parseInt(minsec[0]) * 60 + const sec = parseFloat(minsec[1]) + return min + sec + } + + lines.forEach((line: any) => { + const match = line.match(regex) + if (match == null) return + + const time = match[1] + const text = match[3] + + output.push({ + time: parseTime(time), + text: text.trim(), + }) + }) + + return output +}