Skip to content

Commit 6fdcd85

Browse files
committed
fix: remove binary extractor music
1 parent 15dc58f commit 6fdcd85

File tree

4 files changed

+1
-163
lines changed

4 files changed

+1
-163
lines changed

src-tauri/src/cmds.rs

Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use walkdir::WalkDir;
1212
use crate::prisma_main_client::{directory, file};
1313
use crate::utils::app::AppState;
1414
use crate::utils::audio_utils::get_audio_metadata;
15-
use crate::utils::extractor_music::extractor_music;
1615

1716
#[tauri::command]
1817
pub async fn create_directory(
@@ -209,130 +208,6 @@ pub async fn open_in_finder(path: String) {
209208
}
210209
}
211210

212-
#[tauri::command]
213-
pub async fn analyze_file(
214-
app_handle: &tauri::AppHandle,
215-
path_dir: String,
216-
) -> Result<Value, std::io::Error> {
217-
let mut output_path = app_handle.path_resolver().app_data_dir().unwrap();
218-
output_path.push("extractor_music.temp.json");
219-
220-
extractor_music(path_dir, output_path.to_string_lossy().to_string()).await
221-
}
222-
223-
#[derive(Clone, serde::Serialize)]
224-
struct Payload {
225-
processing: bool,
226-
file: Option<String>,
227-
}
228-
229-
#[tauri::command]
230-
pub async fn analyze_directory(
231-
app_handle: tauri::AppHandle,
232-
path_dir: String,
233-
state: tauri::State<'_, AppState>,
234-
) -> Result<(), String> {
235-
directory::include!((filter: Vec<file::WhereParam>) => directory_files {
236-
files(filter)
237-
});
238-
239-
let directory = state
240-
.prisma_client
241-
.directory()
242-
.find_unique(directory::path::equals(path_dir.clone()))
243-
.include(directory_files::include(vec![file::analyzed::equals(
244-
false,
245-
)]))
246-
.exec()
247-
.await
248-
.unwrap();
249-
250-
match directory {
251-
Some(directory_data) => {
252-
let files_unanalized = directory_data.files;
253-
254-
let mut files_unanalized_iter = files_unanalized.into_iter();
255-
256-
let break_loop_flag = Arc::new(AtomicBool::new(false));
257-
let break_loop_flag_clone = Arc::clone(&break_loop_flag);
258-
259-
app_handle.once_global("stop-analyze-directory-files".to_string(), move |_| {
260-
break_loop_flag_clone.store(true, Ordering::SeqCst);
261-
});
262-
263-
while !break_loop_flag.load(Ordering::SeqCst) {
264-
if let Some(file_unanalyzed) = files_unanalized_iter.next() {
265-
let file_name = file_unanalyzed.name;
266-
267-
app_handle
268-
.emit_all(
269-
"analyze-directory-files",
270-
Payload {
271-
processing: true,
272-
file: Some(file_name.clone()),
273-
},
274-
)
275-
.unwrap();
276-
277-
match analyze_file(&app_handle, file_unanalyzed.path.clone()).await {
278-
Ok(output) => {
279-
match state
280-
.prisma_client
281-
.file()
282-
.update(
283-
file::path::equals(file_unanalyzed.path.to_string()),
284-
vec![
285-
file::bpm::set(Some(output["rhythm"]["bpm"].as_f64().unwrap())),
286-
file::danceability::set(Some(
287-
output["rhythm"]["danceability"].as_f64().unwrap(),
288-
)),
289-
file::chords_key::set(Some(
290-
output["tonal"]["chords_key"].as_str().unwrap().to_owned(),
291-
)),
292-
file::chords_scale::set(Some(
293-
output["tonal"]["chords_scale"].as_str().unwrap().to_owned(),
294-
)),
295-
file::analyzed::set(true),
296-
],
297-
)
298-
.exec()
299-
.await
300-
{
301-
Ok(_) => {}
302-
Err(error) => {
303-
return Err(format!(
304-
"Error update file '{}': {}",
305-
file_name,
306-
error.to_string()
307-
))
308-
}
309-
}
310-
}
311-
Err(error) => return Err(format!("Erreur : {:?}", error)),
312-
}
313-
} else {
314-
break;
315-
}
316-
}
317-
318-
app_handle
319-
.emit_all(
320-
"analyze-directory-files",
321-
Payload {
322-
processing: false,
323-
file: None,
324-
},
325-
)
326-
.unwrap();
327-
328-
Ok(())
329-
}
330-
None => {
331-
return Err(format!("Error analyze file '{}'", path_dir));
332-
}
333-
}
334-
}
335-
336211
#[tauri::command]
337212
pub async fn scan_directory(
338213
app_handle: tauri::AppHandle,

src-tauri/src/utils/extractor_music.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src-tauri/src/utils/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
pub mod app;
22
pub mod audio_utils;
3-
pub mod extractor_music;

src-tauri/tauri.conf.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,10 @@
88
},
99
"package": {
1010
"productName": "pulp",
11-
"version": "1.2.0"
11+
"version": "1.1.1"
1212
},
1313
"tauri": {
1414
"allowlist": {
15-
"shell": {
16-
"sidecar": true,
17-
"scope": [
18-
{
19-
"name": "binaries/streaming_extractor_music",
20-
"sidecar": true
21-
}
22-
]
23-
},
2415
"all": true,
2516
"fs": {
2617
"all": true,
@@ -52,7 +43,6 @@
5243
"deb": {
5344
"depends": []
5445
},
55-
"externalBin": ["binaries/streaming_extractor_music"],
5646
"icon": [
5747
"icons/32x32.png",
5848
"icons/128x128.png",

0 commit comments

Comments
 (0)