diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c5ebbfb..b75eafd 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -87,8 +87,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tagName: muzik-offline-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. - releaseName: 'Muzik-offline v__VERSION__' + tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. + releaseName: 'v__VERSION__-Speeding things up(patch)' releaseBody: 'See the assets to download this version and install.' releaseDraft: true prerelease: false diff --git a/muzik-offline/package-lock.json b/muzik-offline/package-lock.json index f2235d4..483a292 100644 --- a/muzik-offline/package-lock.json +++ b/muzik-offline/package-lock.json @@ -1,12 +1,12 @@ { "name": "muzik-offline", - "version": "0.6.1", + "version": "0.6.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "muzik-offline", - "version": "0.6.1", + "version": "0.6.2", "dependencies": { "@hello-pangea/dnd": "^16.5.0", "@tauri-apps/api": "2.1.1", diff --git a/muzik-offline/package.json b/muzik-offline/package.json index f25faef..3a9ce81 100644 --- a/muzik-offline/package.json +++ b/muzik-offline/package.json @@ -1,7 +1,7 @@ { "name": "muzik-offline", "private": true, - "version": "0.6.1", + "version": "0.6.2", "type": "module", "scripts": { "dev": "vite", diff --git a/muzik-offline/src-tauri/Cargo.lock b/muzik-offline/src-tauri/Cargo.lock index a4a8aa6..979e0b5 100644 --- a/muzik-offline/src-tauri/Cargo.lock +++ b/muzik-offline/src-tauri/Cargo.lock @@ -1495,6 +1495,21 @@ dependencies = [ "new_debug_unreachable", ] +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.31" @@ -1570,6 +1585,7 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ + "futures-channel", "futures-core", "futures-io", "futures-macro", @@ -2941,13 +2957,14 @@ dependencies = [ [[package]] name = "muzik-offline" -version = "0.6.1" +version = "0.6.2" dependencies = [ "base64 0.21.7", "cocoa 0.26.0", "dirs 5.0.1", "discord-rich-presence", "dotenv", + "futures", "id3", "image", "kira", @@ -2970,6 +2987,7 @@ dependencies = [ "tauri-plugin-shell", "tokio", "uuid 1.11.0", + "walkdir", "warp", "windows 0.44.0", ] diff --git a/muzik-offline/src-tauri/Cargo.toml b/muzik-offline/src-tauri/Cargo.toml index c06c12c..d6a81f6 100644 --- a/muzik-offline/src-tauri/Cargo.toml +++ b/muzik-offline/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "muzik-offline" -version = "0.6.1" +version = "0.6.2" description = "A desktop music player for listening to music offline." authors = ["Michael"] license = "MIT" @@ -38,6 +38,8 @@ tauri-plugin-http = "2" tauri-plugin-os = "2" printpdf = "0.7.0" tabled = "0.16.0" +walkdir = "2.5.0" +futures = "0.3.31" [dependencies.uuid] version = "1.11.0" diff --git a/muzik-offline/src-tauri/src/commands/metadata_edit.rs b/muzik-offline/src-tauri/src/commands/metadata_edit.rs index 412c844..9055493 100644 --- a/muzik-offline/src-tauri/src/commands/metadata_edit.rs +++ b/muzik-offline/src-tauri/src/commands/metadata_edit.rs @@ -25,6 +25,7 @@ pub fn edit_song_metadata( //convert song_metadata to Song using serde_json match serde_json::from_str::(&song_metadata) { Ok(mut song) => { + let db_manager = Arc::clone(&db_manager); if let Ok(cov_as_vec) = edit_metadata_id3(&song_path, &song, &has_changed_cover, &cover) { if has_changed_cover == true { diff --git a/muzik-offline/src-tauri/src/commands/metadata_retriever.rs b/muzik-offline/src-tauri/src/commands/metadata_retriever.rs index a4511d6..ff29c17 100644 --- a/muzik-offline/src-tauri/src/commands/metadata_retriever.rs +++ b/muzik-offline/src-tauri/src/commands/metadata_retriever.rs @@ -14,6 +14,8 @@ use lofty::TaggedFileExt; use lofty::{AudioFile, Probe}; use serde_json::Value; use std::path::Path; +use std::sync::atomic::{AtomicUsize, Ordering}; +use walkdir::WalkDir; use std::sync::{Arc, Mutex}; use tauri::State; @@ -23,20 +25,22 @@ pub async fn get_all_songs( db_manager: State<'_, Arc>>, paths_as_json_array: String, compress_image_option: bool, + max_depth: usize, ) -> Result { clear_all_trees(db_manager.clone()); let paths_as_vec = decode_directories(&paths_as_json_array); let mut new_songs_detected = 0; - let mut song_id: i32 = 0; + let song_id = Arc::new(Mutex::new(0)); for path in &paths_as_vec { new_songs_detected += get_songs_in_path( db_manager.clone(), &path, - &mut song_id, - &compress_image_option, + song_id.clone(), + compress_image_option, false, + max_depth, ) .await; } @@ -73,79 +77,109 @@ pub fn decode_directories(paths_as_json: &str) -> Vec { pub async fn get_songs_in_path( db_manager: State<'_, Arc>>, dir_path: &str, - song_id: &mut i32, - compress_image_option: &bool, + song_id: Arc>, + compress_image_option: bool, check_if_exists: bool, + max_depth: usize, ) -> i32 { - let mut new_songs_detected = 0; - match tokio::fs::read_dir(dir_path).await { - Ok(mut paths) => { - while let Ok(Some(entry)) = paths.next_entry().await { - match entry.path().to_str() { - Some(full_path) => { - match is_media_file(full_path) { - Ok(true) => {} - Ok(false) => { - continue; - } - Err(_) => { - continue; - } - } - - if check_if_exists { - // check if song is already in the library - if song_exists_in_tree(db_manager.clone(), full_path) { - continue; - } - } + let new_songs_detected = Arc::new(AtomicUsize::new(0)); + let mut tasks = vec![]; + + for entry in WalkDir::new(dir_path).max_depth(max_depth).into_iter().filter_map(Result::ok) { + let db_manager = Arc::clone(&db_manager); + let song_id_one = song_id.clone(); + let song_id_two = song_id.clone(); + let compress_image_option = compress_image_option.clone(); + let new_songs_detected = new_songs_detected.clone(); + let check_if_exists = check_if_exists.clone(); + + let task = tauri::async_runtime::spawn(async move{ + let path = entry.path(); + if path.is_file(){ + let full_path = match entry.path().to_str(){ + Some(path) => path, + None => { + return; + } + }; + match is_media_file(full_path) { + Ok(true) => {} + Ok(false) => { + return; + } + Err(_) => { + return; + } + } - if let Ok(song_data) = id3_read_from_path( - db_manager.clone(), - full_path, - song_id, - compress_image_option, - ) { - insert_song_into_tree(db_manager.clone(), &song_data); - insert_into_album_tree(db_manager.clone(), &song_data); - insert_into_artist_tree(db_manager.clone(), &song_data); - insert_into_genre_tree(db_manager.clone(), &song_data); - new_songs_detected += 1; - } else if let Ok(song_data) = lofty_read_from_path( - db_manager.clone(), - full_path, - song_id, - compress_image_option, - ) { - insert_song_into_tree(db_manager.clone(), &song_data); - insert_into_album_tree(db_manager.clone(), &song_data); - insert_into_artist_tree(db_manager.clone(), &song_data); - insert_into_genre_tree(db_manager.clone(), &song_data); - new_songs_detected += 1; - } else { - } + if check_if_exists { + // check if song is already in the library + if song_exists_in_tree(db_manager.clone(), full_path) { + return; } - None => {} + } + + if let Ok(song_data) = id3_read_from_path( + db_manager.clone(), + full_path, + song_id_one, + compress_image_option, + ) { + insert_song_into_tree(db_manager.clone(), &song_data); + insert_into_album_tree(db_manager.clone(), &song_data); + insert_into_artist_tree(db_manager.clone(), &song_data); + insert_into_genre_tree(db_manager.clone(), &song_data); + new_songs_detected.fetch_add(1, Ordering::SeqCst); + } else if let Ok(song_data) = lofty_read_from_path( + db_manager.clone(), + full_path, + song_id_two, + compress_image_option, + ) { + insert_song_into_tree(db_manager.clone(), &song_data); + insert_into_album_tree(db_manager.clone(), &song_data); + insert_into_artist_tree(db_manager.clone(), &song_data); + insert_into_genre_tree(db_manager.clone(), &song_data); + new_songs_detected.fetch_add(1, Ordering::SeqCst); + } else { } } + }); + + tasks.push(task); + } + + let result = futures::future::join_all(tasks).await; + + // ensure all tasks have completed + for res in result { + if let Err(_) = res { + return 0; } - Err(_) => {} } - new_songs_detected + new_songs_detected.load(Ordering::SeqCst) as i32 } fn lofty_read_from_path( - db_manager: State<'_, Arc>>, + db_manager: Arc>, path: &str, - song_id: &mut i32, - compress_image_option: &bool, + song_id: Arc>, + compress_image_option: bool, ) -> Result> { let tagged_file = lofty::read_from_path(path)?; - *song_id += 1; + let song_id_val = match song_id.lock(){ + Ok(mut song_id) => { + *song_id += 1; + *song_id + }, + Err(_) => { + return Err(Box::new(std::io::Error::new(std::io::ErrorKind::Other, "Error getting song id"))); + }, + }; let mut song_meta_data = Song { - id: *song_id, + id: song_id_val, uuid: uuid::Uuid::new_v5(&uuid::Uuid::NAMESPACE_URL, path.as_bytes()), title: String::from(""), name: String::from(""), @@ -211,10 +245,10 @@ fn lofty_read_from_path( } fn id3_read_from_path( - db_manager: State<'_, Arc>>, + db_manager: Arc>, path: &str, - song_id: &mut i32, - compress_image_option: &bool, + song_id: Arc>, + compress_image_option: bool, ) -> Result> { let tag = match id3::Tag::read_from_path(path) { Ok(tag) => tag, @@ -225,10 +259,18 @@ fn id3_read_from_path( Err(err) => return Err(Box::new(err)), }; - *song_id += 1; + let song_id_val = match song_id.lock(){ + Ok(mut song_id) => { + *song_id += 1; + *song_id + }, + Err(_) => { + return Err(Box::new(std::io::Error::new(std::io::ErrorKind::Other, "Error getting song id"))); + }, + }; let mut song_meta_data = Song { - id: *song_id, + id: song_id_val, uuid: uuid::Uuid::new_v5(&uuid::Uuid::NAMESPACE_URL, path.as_bytes()), title: String::from(""), name: String::from(""), @@ -413,10 +455,10 @@ fn set_path(path: &str, song_meta_data: &mut Song) { } fn set_cover_id3( - db_manager: State<'_, Arc>>, + db_manager: Arc>, tag: &id3::Tag, song_meta_data: &mut Song, - compress_image_option: &bool, + compress_image_option: bool, path: &str, ) { //COVER @@ -467,10 +509,10 @@ fn set_cover_id3( } fn set_cover_lofty( - db_manager: State<'_, Arc>>, + db_manager: Arc>, tag: &lofty::Tag, song_meta_data: &mut Song, - compress_image_option: &bool, + compress_image_option: bool, path: &str, ) { //COVER diff --git a/muzik-offline/src-tauri/src/commands/refresh_paths_at_start.rs b/muzik-offline/src-tauri/src/commands/refresh_paths_at_start.rs index 0665614..410de2a 100644 --- a/muzik-offline/src-tauri/src/commands/refresh_paths_at_start.rs +++ b/muzik-offline/src-tauri/src/commands/refresh_paths_at_start.rs @@ -17,18 +17,20 @@ pub async fn refresh_paths( db_manager: State<'_, Arc>>, paths_as_json_array: String, compress_image_option: bool, + max_depth: usize, ) -> Result { let paths_as_vec = decode_directories(&paths_as_json_array); - let mut song_id: i32 = 0; + let song_id = Arc::new(Mutex::new(0)); let mut new_songs_detected = 0; for path in &paths_as_vec { new_songs_detected += get_songs_in_path( db_manager.clone(), &path, - &mut song_id, - &compress_image_option, + song_id.clone(), + compress_image_option, true, + max_depth ) .await; } diff --git a/muzik-offline/src-tauri/src/database/db_api.rs b/muzik-offline/src-tauri/src/database/db_api.rs index 44d6991..d39b62c 100644 --- a/muzik-offline/src-tauri/src/database/db_api.rs +++ b/muzik-offline/src-tauri/src/database/db_api.rs @@ -545,10 +545,11 @@ pub async fn create_playlist_cover( } }; + let dbm = Arc::clone(&db_manager); if compress_image { match resize_and_compress_image(&image_as_bytes, &250) { Some(thumbnail) => { - match insert_into_covers_tree(db_manager.clone(), thumbnail, &playlist_name) { + match insert_into_covers_tree(dbm, thumbnail, &playlist_name) { uuid => { return Ok(uuid.to_string()); } @@ -559,7 +560,7 @@ pub async fn create_playlist_cover( } } } else { - match insert_into_covers_tree(db_manager.clone(), image_as_bytes, &playlist_name) { + match insert_into_covers_tree(dbm, image_as_bytes, &playlist_name) { uuid => { return Ok(uuid.to_string()); } @@ -869,7 +870,7 @@ pub fn get_song_paths(db_manager: State<'_, Arc>>) -> HashMap>>, song: &Song) { +pub fn insert_song_into_tree(db_manager: Arc>, song: &Song) { match db_manager.lock() { Ok(dbm) => { let song_tree = match dbm.song_tree.write() { @@ -893,7 +894,7 @@ pub fn insert_song_into_tree(db_manager: State<'_, Arc>>, song: } } -pub fn song_exists_in_tree(db_manager: State<'_, Arc>>, path: &str) -> bool { +pub fn song_exists_in_tree(db_manager: Arc>, path: &str) -> bool { match db_manager.lock() { Ok(dbm) => { let song_tree = match dbm.song_tree.read() { @@ -986,7 +987,7 @@ pub fn delete_song_from_tree(db_manager: State<'_, Arc>>, path: } } -pub fn insert_into_album_tree(db_manager: State<'_, Arc>>, song: &Song) { +pub fn insert_into_album_tree(db_manager: Arc>, song: &Song) { match db_manager.lock() { Ok(dbm) => { let album_tree = match dbm.album_tree.write() { @@ -1065,7 +1066,7 @@ pub fn insert_into_album_tree(db_manager: State<'_, Arc>>, song } } -pub fn insert_into_artist_tree(db_manager: State<'_, Arc>>, song: &Song) { +pub fn insert_into_artist_tree(db_manager: Arc>, song: &Song) { match db_manager.lock() { Ok(dbm) => { let artist_tree = match dbm.artist_tree.write() { @@ -1147,7 +1148,7 @@ pub fn insert_into_artist_tree(db_manager: State<'_, Arc>>, son } } -pub fn insert_into_genre_tree(db_manager: State<'_, Arc>>, song: &Song) { +pub fn insert_into_genre_tree(db_manager: Arc>, song: &Song) { match db_manager.lock() { Ok(dbm) => { let genre_tree = match dbm.genre_tree.write() { @@ -1227,7 +1228,7 @@ pub fn insert_into_genre_tree(db_manager: State<'_, Arc>>, song } pub fn insert_into_covers_tree( - db_manager: State<'_, Arc>>, + db_manager: Arc>, cover: Vec, song_path: &String, ) -> uuid::Uuid { diff --git a/muzik-offline/src-tauri/tauri.conf.json b/muzik-offline/src-tauri/tauri.conf.json index d42ae11..97e5ef3 100644 --- a/muzik-offline/src-tauri/tauri.conf.json +++ b/muzik-offline/src-tauri/tauri.conf.json @@ -36,7 +36,7 @@ }, "productName": "muzik-offline", "mainBinaryName": "muzik-offline", - "version": "0.6.1", + "version": "0.6.2", "identifier": "com.muzik-offline.dev", "plugins": {}, "app": { diff --git a/muzik-offline/src-tauri/tauri.linux.conf.json b/muzik-offline/src-tauri/tauri.linux.conf.json index a5aa4e5..4fba83b 100644 --- a/muzik-offline/src-tauri/tauri.linux.conf.json +++ b/muzik-offline/src-tauri/tauri.linux.conf.json @@ -43,7 +43,7 @@ }, "productName": "muzik-offline", "mainBinaryName": "muzik-offline", - "version": "0.6.1", + "version": "0.6.2", "identifier": "com.muzik-offline.dev", "plugins": {}, "app": { diff --git a/muzik-offline/src-tauri/tauri.macos.conf.json b/muzik-offline/src-tauri/tauri.macos.conf.json index 79b0055..99d75ed 100644 --- a/muzik-offline/src-tauri/tauri.macos.conf.json +++ b/muzik-offline/src-tauri/tauri.macos.conf.json @@ -36,7 +36,7 @@ }, "productName": "muzik-offline", "mainBinaryName": "muzik-offline", - "version": "0.6.1", + "version": "0.6.2", "identifier": "com.muzik-offline.dev", "plugins": {}, "app": { diff --git a/muzik-offline/src-tauri/tauri.windows.conf.json b/muzik-offline/src-tauri/tauri.windows.conf.json index c8ede5c..13a70b1 100644 --- a/muzik-offline/src-tauri/tauri.windows.conf.json +++ b/muzik-offline/src-tauri/tauri.windows.conf.json @@ -36,7 +36,7 @@ }, "productName": "muzik-offline", "mainBinaryName": "muzik-offline", - "version": "0.6.1", + "version": "0.6.2", "identifier": "com.muzik-offline.dev", "plugins": {}, "app": { diff --git a/muzik-offline/src/database/saved_object.ts b/muzik-offline/src/database/saved_object.ts index 92b87a6..d6462d1 100644 --- a/muzik-offline/src/database/saved_object.ts +++ b/muzik-offline/src/database/saved_object.ts @@ -19,6 +19,7 @@ export interface SavedObject{ SongLengthORremaining: string, AlwaysRoundedCornersWindows: string, AutoStartApp: string, + DirectoryScanningDepth: number } export const emptySavedObject: SavedObject = { @@ -39,5 +40,6 @@ export const emptySavedObject: SavedObject = { SeekStepAmount: "10", SongLengthORremaining: "song length", AlwaysRoundedCornersWindows: "No", - AutoStartApp: "No" + AutoStartApp: "No", + DirectoryScanningDepth: 1 } \ No newline at end of file diff --git a/muzik-offline/src/interface/App/App.tsx b/muzik-offline/src/interface/App/App.tsx index 742b325..d209eea 100644 --- a/muzik-offline/src/interface/App/App.tsx +++ b/muzik-offline/src/interface/App/App.tsx @@ -106,7 +106,11 @@ const App = () => { } setFirstRun(false); }*/ - invoke("refresh_paths", { pathsAsJsonArray: JSON.stringify(paths), compressImageOption: local_store.CompressImage === "Yes" ? true : false }) + invoke("refresh_paths", { + athsAsJsonArray: JSON.stringify(paths), + compressImageOption: local_store.CompressImage === "Yes" ? true : false, + maxDepth: local_store.DirectoryScanningDepth + }) .then(async(response: any) => { if(response === "No new songs detected")return; const res = await fetch_library(false); diff --git a/muzik-offline/src/interface/layouts/AboutSettings.tsx b/muzik-offline/src/interface/layouts/AboutSettings.tsx index 1610688..31bd0d9 100644 --- a/muzik-offline/src/interface/layouts/AboutSettings.tsx +++ b/muzik-offline/src/interface/layouts/AboutSettings.tsx @@ -11,7 +11,7 @@ const AboutSettings = () => {

Copyright 2024 muzik-apps. All rights reserved.

-

Version "0.6.1"

+

Version "0.6.2"

open("https://github.com/muzik-apps/muzik-offline")}> muzik-offline diff --git a/muzik-offline/src/interface/layouts/AdvancedSettings.tsx b/muzik-offline/src/interface/layouts/AdvancedSettings.tsx index 0b7e234..50733c9 100644 --- a/muzik-offline/src/interface/layouts/AdvancedSettings.tsx +++ b/muzik-offline/src/interface/layouts/AdvancedSettings.tsx @@ -118,23 +118,37 @@ const AdvancedSettings = () => { ) } - {/*
-

Create a backup of your library(may take some time)

-
- {}}> -

Create backup

-
-
+

Max folder depth to scan between 1 and 50(Note larger values will take longer)

+ { + // clamp the value to 1-50 + if(e.target.value === "") e.target.value = "0"; + else if(parseInt(e.target.value) < 1) e.target.value = "1"; + else if(parseInt(e.target.value) > 50) e.target.value = "50"; + else if(e.target.value.startsWith("0")) e.target.value = e.target.value.slice(1); + let temp: SavedObject = local_store; + temp.DirectoryScanningDepth = parseInt(e.target.value); + setStore(temp); + }}/>
-
-

Import library backup(may take some time)

-
- {}}> -

Import backup

-
+ {/* +
+

Create a backup of your library(may take some time)

+
+ {}}> +

Create backup

+
+
+
+
+

Import library backup(may take some time)

+
+ {}}> +

Import backup

+
+
-
*/} + */}
) diff --git a/muzik-offline/src/interface/layouts/MusicFoldersSettings.tsx b/muzik-offline/src/interface/layouts/MusicFoldersSettings.tsx index 8d66ef5..31ac7b4 100644 --- a/muzik-offline/src/interface/layouts/MusicFoldersSettings.tsx +++ b/muzik-offline/src/interface/layouts/MusicFoldersSettings.tsx @@ -24,7 +24,11 @@ const MusicFoldersSettings: FunctionComponent = (prop const [directory, setDirectory] = useState(""); function reloadSongs(){ - invoke("get_all_songs", { pathsAsJsonArray: JSON.stringify(Array.from(currentDir)), compressImageOption: local_store.CompressImage === "Yes" ? true : false }) + invoke("get_all_songs", { + pathsAsJsonArray: JSON.stringify(Array.from(currentDir)), + compressImageOption: local_store.CompressImage === "Yes" ? true : false, + maxDepth: local_store.DirectoryScanningDepth + }) .then(async() => { setDir({Dir: currentDir}); await local_songs_db.songs.clear(); diff --git a/muzik-offline/src/interface/styles/layouts/AdvancedSettings.scss b/muzik-offline/src/interface/styles/layouts/AdvancedSettings.scss index cc438ac..b0b70c5 100644 --- a/muzik-offline/src/interface/styles/layouts/AdvancedSettings.scss +++ b/muzik-offline/src/interface/styles/layouts/AdvancedSettings.scss @@ -74,6 +74,25 @@ top: 55px; z-index: $z-index-9250; } + + input[type="number"]{ + width: 156px; + height: 40px; + border-radius: 10px; + background: $gray-stroke-20; + border: none; + outline: none; + padding: 0px 0px 0px 0px; + padding-left: 4px; + padding-right: 4px; + font-size: 13px; + color: $white-900; + font-family: 'inter-italic-regular', sans-serif; + font-style: italic; + display: flex; + align-items: center; + justify-content: flex-end; + } } } } \ No newline at end of file diff --git a/muzik-offline/src/utils/index.ts b/muzik-offline/src/utils/index.ts index 020e7bc..428475d 100644 --- a/muzik-offline/src/utils/index.ts +++ b/muzik-offline/src/utils/index.ts @@ -293,7 +293,11 @@ export async function reloadLibrary(paths: string[]){ }); const local_store = useSavedObjectStore.getState().local_store; - invoke("get_all_songs", { pathsAsJsonArray: JSON.stringify(Array.from(dirs)), compressImageOption: local_store.CompressImage === "Yes" ? true : false }) + invoke("get_all_songs", { + pathsAsJsonArray: JSON.stringify(Array.from(dirs)), + compressImageOption: local_store.CompressImage === "Yes" ? true : false, + maxDepth: local_store.DirectoryScanningDepth + }) .then(async() => { useDirStore.getState().setDir({Dir: dirs}); await local_songs_db.songs.clear();