Lyrics Improvements

- Make the settings text actually consistent with behavior
- Add metadata (artist/track name) for fetched tracks
- Add ability to remove incorrectly fetched lyric
- Add lyric fetch cache; save the last 10 fetches
- Add ability to change offset in full screen, add more comments
This commit is contained in:
Kendall Garner 2023-06-04 23:15:36 -07:00 committed by Jeff
parent 9622cd346c
commit 007a099951
11 changed files with 314 additions and 61 deletions

View file

@ -1,9 +1,13 @@
import { useMemo } from 'react';
import styled from 'styled-components';
import { LyricLine } from '/@/renderer/features/lyrics/lyric-line';
import { LyricOverride } from '/@/renderer/api/types';
import { LyricSkip } from '/@/renderer/features/lyrics/lyric-skip';
interface UnsynchronizedLyricsProps {
lyrics: string;
onRemoveLyric: () => void;
override: LyricOverride | null;
source: string | null;
}
@ -11,7 +15,12 @@ const UnsynchronizedLyricsContainer = styled.div`
padding: 5rem 0;
`;
export const UnsynchronizedLyrics = ({ lyrics, source }: UnsynchronizedLyricsProps) => {
export const UnsynchronizedLyrics = ({
onRemoveLyric,
lyrics,
override,
source,
}: UnsynchronizedLyricsProps) => {
const lines = useMemo(() => {
return lyrics.split('\n');
}, [lyrics]);
@ -24,6 +33,15 @@ export const UnsynchronizedLyrics = ({ lyrics, source }: UnsynchronizedLyricsPro
text={`Lyrics provided by ${source}`}
/>
)}
{override && (
<>
<LyricLine
className="lyric-credit"
text={`(Matched as ${override.title} by ${override.artist})`}
/>
<LyricSkip onClick={onRemoveLyric} />
</>
)}
{lines.map((text, idx) => (
<LyricLine
key={idx}