mirror of
https://github.com/markuryy/shark.git
synced 2025-12-12 19:51:01 +00:00
feat(dz): add cache clearing and database reset functionality
Add ability to fully clear cached online library by deleting and recreating the database file. Integrate new Clear Cache option in settings UI, which restarts the app after clearing. Remove unused artist/album fields from cache and UI. Add process plugin for relaunch.
This commit is contained in:
@@ -16,21 +16,15 @@ fn tag_audio_file(
|
||||
cover_data: Option<Vec<u8>>,
|
||||
embed_lyrics: bool,
|
||||
) -> Result<(), String> {
|
||||
tagger::tag_audio_file(
|
||||
&path,
|
||||
&metadata,
|
||||
cover_data.as_deref(),
|
||||
embed_lyrics,
|
||||
)
|
||||
tagger::tag_audio_file(&path, &metadata, cover_data.as_deref(), embed_lyrics)
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
let library_migrations = vec![
|
||||
Migration {
|
||||
version: 1,
|
||||
description: "create_library_tables",
|
||||
sql: "
|
||||
let library_migrations = vec![Migration {
|
||||
version: 1,
|
||||
description: "create_library_tables",
|
||||
sql: "
|
||||
CREATE TABLE IF NOT EXISTS artists (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
@@ -61,15 +55,13 @@ pub fn run() {
|
||||
CREATE INDEX IF NOT EXISTS idx_albums_year ON albums(year);
|
||||
CREATE INDEX IF NOT EXISTS idx_albums_artist_title ON albums(artist_name, title);
|
||||
",
|
||||
kind: MigrationKind::Up,
|
||||
}
|
||||
];
|
||||
kind: MigrationKind::Up,
|
||||
}];
|
||||
|
||||
let deezer_migrations = vec![
|
||||
Migration {
|
||||
version: 1,
|
||||
description: "create_deezer_cache_tables",
|
||||
sql: "
|
||||
let deezer_migrations = vec![Migration {
|
||||
version: 1,
|
||||
description: "create_deezer_cache_tables",
|
||||
sql: "
|
||||
CREATE TABLE IF NOT EXISTS deezer_playlists (
|
||||
id TEXT PRIMARY KEY,
|
||||
title TEXT NOT NULL,
|
||||
@@ -94,7 +86,6 @@ pub fn run() {
|
||||
CREATE TABLE IF NOT EXISTS deezer_artists (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
nb_album INTEGER DEFAULT 0,
|
||||
picture_small TEXT,
|
||||
picture_medium TEXT,
|
||||
cached_at INTEGER NOT NULL
|
||||
@@ -114,16 +105,16 @@ pub fn run() {
|
||||
CREATE INDEX IF NOT EXISTS idx_deezer_artists_name ON deezer_artists(name);
|
||||
CREATE INDEX IF NOT EXISTS idx_deezer_tracks_title ON deezer_tracks(title);
|
||||
",
|
||||
kind: MigrationKind::Up,
|
||||
}
|
||||
];
|
||||
kind: MigrationKind::Up,
|
||||
}];
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_process::init())
|
||||
.plugin(
|
||||
tauri_plugin_sql::Builder::new()
|
||||
.add_migrations("sqlite:library.db", library_migrations)
|
||||
.add_migrations("sqlite:deezer.db", deezer_migrations)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.plugin(tauri_plugin_http::init())
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
|
||||
Reference in New Issue
Block a user