feat(library): expose v2_library_list_folder_children + folder_tracks
Tauri command wrappers for the qbz-library SQL primitives. V2 cleanroom: both commands call directly into qbz-library, no legacy delegation. cc
This commit is contained in:
2 files changed
+35
No files matched your search
@@ -10,6 +10,7 @@ use crate::library::{
|
||||
get_artwork_cache_dir, thumbnails, AudioFormat, LibraryState, LocalAlbum, LocalTrack,
|
||||
MetadataExtractor, PlaylistLocalTrack, PlaylistSettings, PlaylistStats, ScanProgress,
|
||||
};
|
||||
use qbz_library::FolderTreeEntry;
|
||||
use crate::lyrics::LyricsState;
|
||||
use crate::offline::OfflineState;
|
||||
use crate::offline_cache::OfflineCacheState;
|
||||
@@ -2627,6 +2628,38 @@ pub async fn v2_library_get_folders_with_metadata(
|
||||
Ok(folders)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[allow(non_snake_case)]
|
||||
pub async fn v2_library_list_folder_children(
|
||||
parentPath: String,
|
||||
state: State<'_, LibraryState>,
|
||||
) -> Result<Vec<FolderTreeEntry>, String> {
|
||||
log::info!("Command: v2_library_list_folder_children {}", parentPath);
|
||||
|
||||
let guard__ = state.db.lock().await;
|
||||
let db = guard__
|
||||
.as_ref()
|
||||
.ok_or("No active session - please log in")?;
|
||||
db.list_folder_children(&parentPath)
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[allow(non_snake_case)]
|
||||
pub async fn v2_library_list_folder_tracks(
|
||||
folderPath: String,
|
||||
state: State<'_, LibraryState>,
|
||||
) -> Result<Vec<LocalTrack>, String> {
|
||||
log::info!("Command: v2_library_list_folder_tracks {}", folderPath);
|
||||
|
||||
let guard__ = state.db.lock().await;
|
||||
let db = guard__
|
||||
.as_ref()
|
||||
.ok_or("No active session - please log in")?;
|
||||
db.list_folder_tracks(&folderPath)
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn v2_library_add_folder(
|
||||
path: String,
|
||||
|
||||
@@ -1767,6 +1767,8 @@ pub fn run(qconnect_cli_override: Option<bool>) {
|
||||
commands_v2::v2_library_get_albums_metadata,
|
||||
commands_v2::v2_library_get_folders,
|
||||
commands_v2::v2_library_get_folders_with_metadata,
|
||||
commands_v2::v2_library_list_folder_children,
|
||||
commands_v2::v2_library_list_folder_tracks,
|
||||
commands_v2::v2_library_add_folder,
|
||||
commands_v2::v2_library_cleanup_missing_files,
|
||||
commands_v2::v2_library_fetch_missing_artwork,
|
||||
|
||||
Reference in new issue
Block a user