Added the import/cleanup functionality
This commit is contained in:
@@ -69,6 +69,9 @@ pub struct TaggingConfig {
|
|||||||
|
|
||||||
#[serde(default = "default_confidence")]
|
#[serde(default = "default_confidence")]
|
||||||
pub confidence: f64,
|
pub confidence: f64,
|
||||||
|
|
||||||
|
#[serde(default = "default_tag_concurrency")]
|
||||||
|
pub concurrency: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
@@ -243,10 +246,15 @@ impl Default for TaggingConfig {
|
|||||||
auto_tag: false,
|
auto_tag: false,
|
||||||
write_tags: true,
|
write_tags: true,
|
||||||
confidence: default_confidence(),
|
confidence: default_confidence(),
|
||||||
|
concurrency: default_tag_concurrency(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_tag_concurrency() -> usize {
|
||||||
|
4
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for DownloadConfig {
|
impl Default for DownloadConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
@@ -715,6 +715,9 @@ pub fn run_import(
|
|||||||
PRAGMA foreign_keys = OFF;",
|
PRAGMA foreign_keys = OFF;",
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
// Wrap entire import in a transaction so interrupted imports don't leave empty tables
|
||||||
|
conn.execute_batch("BEGIN;")?;
|
||||||
|
|
||||||
let mut stats = ImportStats::default();
|
let mut stats = ImportStats::default();
|
||||||
|
|
||||||
// Import artists
|
// Import artists
|
||||||
@@ -818,6 +821,9 @@ pub fn run_import(
|
|||||||
rusqlite::params![stats.recordings.to_string()],
|
rusqlite::params![stats.recordings.to_string()],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
// Commit the transaction — if we got here, everything succeeded
|
||||||
|
conn.execute_batch("COMMIT;")?;
|
||||||
|
|
||||||
progress(&format!("Import complete: {stats}"));
|
progress(&format!("Import complete: {stats}"));
|
||||||
Ok(stats)
|
Ok(stats)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
Submodule shanty-db updated: 1ff385c826...cc42f8ecbb
+1
-1
Submodule shanty-index updated: 3cba8f88c1...494de64f0a
+1
-1
Submodule shanty-tag updated: 82fed6ea6e...8e3d86c25e
+1
-1
Submodule shanty-web updated: 1431cd2fbc...823ef15022
Reference in New Issue
Block a user