Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src-tauri/src/commands/lyrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,21 @@ async fn run_prefetch(
let mut misses = 0u32;
let mut failed = 0u32;

// Emit an initial frame so the UI can show the total — and explicitly
// surface the "nothing to do" case (total == 0) which otherwise looks
// like the button does nothing.
let _ = app.emit(
"lyrics:prefetch-progress",
LyricsPrefetchProgress {
processed: 0,
total,
hits: 0,
misses: 0,
failed: 0,
current_title: None,
},
);

let client = LrclibClient::new();
let mut cancelled = false;

Expand Down
2 changes: 1 addition & 1 deletion src/components/views/AboutView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export function AboutView({ onNavigate }: AboutViewProps) {
<div className="grid grid-cols-2 gap-x-8">
<TechItem name="React" version="19.x" />
<TechItem name="Vite" version="8.x" />
<TechItem name="TypeScript" version="5.x" />
<TechItem name="TypeScript" version="6.x" />
<TechItem name="Tailwind CSS" version="4.x" />
</div>
</section>
Expand Down
7 changes: 1 addition & 6 deletions src/components/views/LibraryView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { useTranslation } from "react-i18next";
import type { LibraryTab } from "../../types";
import { Tab } from "../common/Tab";
import { EmptyState } from "../common/EmptyState";
import { UploadIcon } from "../common/Icons";
import { Artwork } from "../common/Artwork";
import { AlbumLink } from "../common/AlbumLink";
import { ArtistLink } from "../common/ArtistLink";
Expand Down Expand Up @@ -717,15 +716,11 @@ export function LibraryView({
className="py-20"
>
<div className="mt-8 flex items-center flex-wrap justify-center gap-4">
<button className="bg-emerald-500 hover:bg-emerald-600 text-white px-6 py-3 rounded-xl text-sm font-semibold flex items-center space-x-2 transition-colors shadow-sm">
<UploadIcon size={18} />
<span>{t("library.actions.importFiles")}</span>
</button>
<button
type="button"
onClick={handleImport}
disabled={isImporting}
className="px-6 py-3 rounded-xl text-sm font-semibold flex items-center space-x-2 transition-colors border border-zinc-200 bg-white hover:bg-zinc-50 text-zinc-700 dark:border-zinc-700 dark:bg-zinc-800 dark:hover:bg-zinc-700 dark:text-zinc-300 disabled:opacity-60 disabled:cursor-not-allowed"
className="bg-emerald-500 hover:bg-emerald-600 text-white px-6 py-3 rounded-xl text-sm font-semibold flex items-center space-x-2 transition-colors shadow-sm disabled:opacity-60 disabled:cursor-not-allowed"
>
<Folder size={18} />
<span>{t("library.actions.importFolder")}</span>
Expand Down
28 changes: 26 additions & 2 deletions src/components/views/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ export function SettingsView({ onNavigate }: SettingsViewProps) {
failed: number;
currentTitle: string | null;
} | null>(null);
const [lyricsResultMsg, setLyricsResultMsg] = useState<string | null>(null);

useEffect(() => {
let unlisten: (() => void) | null = null;
Expand Down Expand Up @@ -741,14 +742,33 @@ export function SettingsView({ onNavigate }: SettingsViewProps) {
if (isPrefetchingLyrics) return;
setIsPrefetchingLyrics(true);
setLyricsPrefetchProgress(null);
setLyricsResultMsg(null);
try {
const { prefetchLibraryLyrics } = await import("../../lib/tauri/lyrics");
await prefetchLibraryLyrics();
const summary = await prefetchLibraryLyrics();
setLyricsResultMsg(
t("settings.lyricsPrefetch.result", {
hits: summary.hits,
misses: summary.misses,
failed: summary.failed,
}),
);
} catch (err) {
console.error("[SettingsView] prefetch lyrics failed", err);
// Distinguish offline mode (the user can act on it) from a real
// failure so the message is not just a generic "something broke".
const msg = String(err);
setLyricsResultMsg(
msg.includes("offline")
? t("settings.lyricsPrefetch.offline")
: t("settings.lyricsPrefetch.failed"),
);
} finally {
setIsPrefetchingLyrics(false);
window.setTimeout(() => setLyricsPrefetchProgress(null), 3000);
window.setTimeout(() => {
setLyricsPrefetchProgress(null);
setLyricsResultMsg(null);
}, 5000);
}
};

Expand Down Expand Up @@ -2464,6 +2484,10 @@ export function SettingsView({ onNavigate }: SettingsViewProps) {
? ` — ${lyricsPrefetchProgress.currentTitle}`
: ""}
</div>
) : lyricsResultMsg ? (
<div className="text-xs text-emerald-600 dark:text-emerald-400 mt-1 truncate">
{lyricsResultMsg}
</div>
) : (
<div className="text-xs text-zinc-400">
{t("settings.lyricsPrefetch.subtitle")}
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,9 @@
"lyricsPrefetch": {
"title": "تحميل كلمات الأغاني مسبقًا",
"subtitle": "تنزيل كلمات الأغاني للمكتبة بأكملها للاستخدام دون اتصال",
"result": "تم تزامن {{hits}}، لم يتم العثور على {{misses}}، فشل {{failed}}",
"offline": "وضع عدم الاتصال مفعّل",
"failed": "فشل التحميل المسبق",
"action": "تحميل مسبق",
"progress": "تم معالجة {{current}}/{{total}} · {{hits}} عُثر عليها"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,9 @@
"lyricsPrefetch": {
"title": "Songtexte vorab laden",
"subtitle": "Songtexte der gesamten Bibliothek für Offline-Nutzung herunterladen",
"result": "{{hits}} synchronisiert, {{misses}} nicht gefunden, {{failed}} fehlgeschlagen",
"offline": "Offlinemodus aktiviert",
"failed": "Vorabladen fehlgeschlagen",
"action": "Vorab laden",
"progress": "{{current}}/{{total}} verarbeitet · {{hits}} gefunden"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,9 @@
"lyricsPrefetch": {
"title": "Prefetch lyrics",
"subtitle": "Download lyrics for the entire library for offline use",
"result": "{{hits}} synced, {{misses}} not found, {{failed}} failed",
"offline": "Offline mode is enabled",
"failed": "Prefetch failed",
"action": "Prefetch",
"progress": "{{current}}/{{total}} processed · {{hits}} found"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,9 @@
"lyricsPrefetch": {
"title": "Precargar letras",
"subtitle": "Descargar las letras de toda la biblioteca para uso sin conexión",
"result": "{{hits}} sincronizadas, {{misses}} no encontradas, {{failed}} fallidas",
"offline": "Modo sin conexión activado",
"failed": "Error al precargar",
"action": "Precargar",
"progress": "{{current}}/{{total}} procesadas · {{hits}} encontradas"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,9 @@
"lyricsPrefetch": {
"title": "Préchargement des paroles",
"subtitle": "Télécharger les paroles de toute la bibliothèque pour usage hors-ligne",
"result": "{{hits}} synchronisées, {{misses}} introuvables, {{failed}} échecs",
"offline": "Mode hors-ligne activé",
"failed": "Échec du préchargement",
"action": "Précharger",
"progress": "{{current}}/{{total}} traités · {{hits}} trouvés"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,9 @@
"lyricsPrefetch": {
"title": "बोल पहले से लोड करें",
"subtitle": "ऑफ़लाइन उपयोग के लिए पूरी लाइब्रेरी के बोल डाउनलोड करें",
"result": "{{hits}} सिंक्ड, {{misses}} नहीं मिलीं, {{failed}} विफल",
"offline": "ऑफ़लाइन मोड सक्षम है",
"failed": "प्रीफ़ेच विफल",
"action": "पहले से लोड करें",
"progress": "{{current}}/{{total}} संसाधित · {{hits}} मिले"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,9 @@
"lyricsPrefetch": {
"title": "Pramuat lirik",
"subtitle": "Unduh lirik untuk seluruh pustaka untuk penggunaan offline",
"result": "{{hits}} disinkronkan, {{misses}} tidak ditemukan, {{failed}} gagal",
"offline": "Mode luring diaktifkan",
"failed": "Pra-pemuatan gagal",
"action": "Pramuat",
"progress": "{{current}}/{{total}} diproses · {{hits}} ditemukan"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,9 @@
"lyricsPrefetch": {
"title": "Precarica i testi",
"subtitle": "Scarica i testi dell’intera libreria per l’uso offline",
"result": "{{hits}} sincronizzati, {{misses}} non trovati, {{failed}} falliti",
"offline": "Modalità offline attiva",
"failed": "Precaricamento non riuscito",
"action": "Precarica",
"progress": "{{current}}/{{total}} elaborati · {{hits}} trovati"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,9 @@
"lyricsPrefetch": {
"title": "歌詞を事前取得",
"subtitle": "オフライン利用のためライブラリ全体の歌詞をダウンロードします",
"result": "{{hits}} 件同期、{{misses}} 件見つからず、{{failed}} 件失敗",
"offline": "オフラインモードが有効です",
"failed": "プリフェッチに失敗しました",
"action": "事前取得",
"progress": "{{current}}/{{total}} 処理済み · {{hits}} 件取得"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,9 @@
"lyricsPrefetch": {
"title": "가사 미리 가져오기",
"subtitle": "오프라인 사용을 위해 전체 라이브러리의 가사를 다운로드합니다",
"result": "{{hits}}개 동기화, {{misses}}개 없음, {{failed}}개 실패",
"offline": "오프라인 모드가 활성화됨",
"failed": "미리 가져오기 실패",
"action": "미리 가져오기",
"progress": "{{current}}/{{total}} 처리됨 · {{hits}}곡 찾음"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,9 @@
"lyricsPrefetch": {
"title": "Songteksten vooraf ophalen",
"subtitle": "Songteksten van de hele bibliotheek downloaden voor offline gebruik",
"result": "{{hits}} gesynchroniseerd, {{misses}} niet gevonden, {{failed}} mislukt",
"offline": "Offlinemodus is ingeschakeld",
"failed": "Vooraf laden mislukt",
"action": "Vooraf ophalen",
"progress": "{{current}}/{{total}} verwerkt · {{hits}} gevonden"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,9 @@
"lyricsPrefetch": {
"title": "Pré-carregar letras",
"subtitle": "Baixar as letras de toda a biblioteca para uso offline",
"result": "{{hits}} sincronizadas, {{misses}} não encontradas, {{failed}} falharam",
"offline": "Modo offline ativado",
"failed": "Pré-carregamento falhou",
"action": "Pré-carregar",
"progress": "{{current}}/{{total}} processadas · {{hits}} encontradas"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,9 @@
"lyricsPrefetch": {
"title": "Pré-carregar letras",
"subtitle": "Baixar as letras de toda a biblioteca para uso offline",
"result": "{{hits}} sincronizadas, {{misses}} não encontradas, {{failed}} falhadas",
"offline": "Modo offline ativado",
"failed": "Pré-carregamento falhou",
"action": "Pré-carregar",
"progress": "{{current}}/{{total}} processadas · {{hits}} encontradas"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,9 @@
"lyricsPrefetch": {
"title": "Предзагрузка текстов",
"subtitle": "Скачать тексты для всей библиотеки для офлайн-использования",
"result": "Синхронизировано: {{hits}}, не найдено: {{misses}}, ошибок: {{failed}}",
"offline": "Включен офлайн-режим",
"failed": "Не удалось предзагрузить",
"action": "Предзагрузить",
"progress": "{{current}}/{{total}} обработано · {{hits}} найдено"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,9 @@
"lyricsPrefetch": {
"title": "Şarkı sözlerini önceden yükle",
"subtitle": "Çevrimdışı kullanım için tüm kütüphanenin şarkı sözlerini indir",
"result": "{{hits}} eşitlendi, {{misses}} bulunamadı, {{failed}} başarısız",
"offline": "Çevrimdışı modu etkin",
"failed": "Önbelleğe alma başarısız",
"action": "Önceden yükle",
"progress": "{{current}}/{{total}} işlendi · {{hits}} bulundu"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,9 @@
"lyricsPrefetch": {
"title": "预取歌词",
"subtitle": "为整个曲库下载歌词以供离线使用",
"result": "已同步 {{hits}},未找到 {{misses}},失败 {{failed}}",
"offline": "已启用离线模式",
"failed": "预加载失败",
"action": "预取",
"progress": "已处理 {{current}}/{{total}} · 找到 {{hits}}"
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,9 @@
"lyricsPrefetch": {
"title": "預先擷取歌詞",
"subtitle": "為整個曲庫下載歌詞以供離線使用",
"result": "已同步 {{hits}},找不到 {{misses}},失敗 {{failed}}",
"offline": "已啟用離線模式",
"failed": "預先載入失敗",
"action": "預先擷取",
"progress": "已處理 {{current}}/{{total}} · 找到 {{hits}}"
},
Expand Down
Loading