diff --git a/package.json b/package.json index 3216e6c..f809552 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "aquavox", - "version": "0.0.1", - "private": true, + "version": "1.8.0", + "private": false, "scripts": { "dev": "vite dev", "build": "vite build", diff --git a/src/app.html b/src/app.html index 3b52a7f..e230ef2 100644 --- a/src/app.html +++ b/src/app.html @@ -2,7 +2,7 @@ - + import type { Writable } from 'svelte/store'; export let coverPath: Writable; + export let hasLyrics: boolean; let path: string = ''; coverPath.subscribe((p) => { @@ -8,6 +9,18 @@ }); -封面 +{#if hasLyrics} +封面 +{:else} +封面 +{/if} \ No newline at end of file diff --git a/src/lib/components/import/fileSelector.svelte b/src/lib/components/import/fileSelector.svelte index b28af34..0739632 100644 --- a/src/lib/components/import/fileSelector.svelte +++ b/src/lib/components/import/fileSelector.svelte @@ -6,7 +6,7 @@ import { fileListState } from '$lib/state/fileList.state'; import AddIcon from './addIcon.svelte'; const fileItems = useAtom(fileListState); - export let accept: string = "audio/*"; + export let accept: string = ".aac, .mp3, .wav, .ogg, .flac"; onMount(() => { audioFiles.addEventListener('change', function (e: any) { diff --git a/src/lib/components/import/sourceCard.svelte b/src/lib/components/import/sourceCard.svelte index 8aa3129..35c3ee3 100644 --- a/src/lib/components/import/sourceCard.svelte +++ b/src/lib/components/import/sourceCard.svelte @@ -8,7 +8,7 @@
diff --git a/src/lib/components/interactiveBox.svelte b/src/lib/components/interactiveBox.svelte index 07bedc7..e2f37dd 100644 --- a/src/lib/components/interactiveBox.svelte +++ b/src/lib/components/interactiveBox.svelte @@ -1,5 +1,6 @@ -
-
+{#if showInfoTop} +
{name}
{singer}
+{/if} + +
+ {#if !showInfoTop} +
+ {name}
+ {singer} +
+ {/if} +
{formatDuration(progress)}
{#each lyrics as lyric, i}

@@ -69,6 +69,9 @@ {/if} diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index b414144..e2d88e4 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -37,22 +37,33 @@ musicList[id].coverUrl = URL.createObjectURL(v); } idList = Object.keys(musicList); - console.log(musicList); }); + + function clear() { + localforage.clear(); + window.location.reload(); + } -

+ + Aquavox - 音乐库 + + + + + diff --git a/src/routes/import/+page.svelte b/src/routes/import/+page.svelte index 0ec5a65..68a6616 100644 --- a/src/routes/import/+page.svelte +++ b/src/routes/import/+page.svelte @@ -3,6 +3,7 @@ +

AquaVox

导入

希望从哪里导入你的歌曲?

+

AquaVox

歌词导入

当前为 {audioId} 导入歌词

diff --git a/src/routes/import/local/+page.svelte b/src/routes/import/local/+page.svelte index 1f53b2a..e672d26 100644 --- a/src/routes/import/local/+page.svelte +++ b/src/routes/import/local/+page.svelte @@ -12,6 +12,7 @@ const success = useAtom(localImportSuccess); +

AquaVox

本地导入向导

欢迎使用本地导入向导!

diff --git a/src/routes/play/[id]/+page.svelte b/src/routes/play/[id]/+page.svelte index 1b47b20..df97e3a 100644 --- a/src/routes/play/[id]/+page.svelte +++ b/src/routes/play/[id]/+page.svelte @@ -10,6 +10,7 @@ import { writable } from 'svelte/store'; import srtParser2 from 'srt-parser-2'; import type { Line } from 'srt-parser-2'; + import type { IAudioMetadata } from 'music-metadata-browser'; const audioId = $page.params.id; let audioPlayer: HTMLAudioElement; @@ -25,6 +26,7 @@ let originalLyrics: Line[]; let lyricsText: string[] = []; let onAdjustingProgress = false; + let hasLyrics: boolean; const coverPath = writable(''); let mainInterval: ReturnType; @@ -64,8 +66,11 @@ } function readDB() { - getAudioIDMetadata(audioId, (metadata: any) => { + getAudioIDMetadata(audioId, (metadata: IAudioMetadata | null) => { + if (!metadata) return; duration = metadata.format.duration ? metadata.format.duration : 0; + console.log(metadata); + singer = metadata.common.artist ? metadata.common.artist : '未知歌手'; prepared.push('duration'); }); localforage.getItem(`${audioId}-cover`, function (err, file) { @@ -168,6 +173,14 @@ } } + $: { + if (originalLyrics) { + hasLyrics = true; + } else { + hasLyrics = false; + } + } + readDB(); @@ -176,7 +189,7 @@ - + diff --git a/static/favicon.png b/static/favicon.png deleted file mode 100644 index 825b9e6..0000000 Binary files a/static/favicon.png and /dev/null differ