2026-11-26 16:05:42 +02:00
|
|
|
//! Music library import: provider exports are stored as durable imports,
|
|
|
|
|
//! matched against the library and the federation, and published as ordinary
|
|
|
|
|
//! private playlists.
|
|
|
|
|
//!
|
|
|
|
|
//! The subsystem owns the `furumusic__library_import*` tables. It touches the
|
|
|
|
|
//! rest of Furumi only when publishing: target playlists, their tracks and the
|
|
|
|
|
//! existing Device Sync operations.
|
|
|
|
|
|
2026-11-26 16:30:07 +02:00
|
|
|
// Imports are processed by the resolver and publisher; until those are wired
|
|
|
|
|
// in, parts of the model and the storage layer are used by the tests only.
|
2026-11-26 16:05:42 +02:00
|
|
|
pub mod adapters;
|
|
|
|
|
mod handlers;
|
|
|
|
|
pub mod job;
|
2026-11-26 16:55:27 +02:00
|
|
|
pub mod matcher;
|
2026-11-26 16:05:42 +02:00
|
|
|
#[allow(dead_code)]
|
|
|
|
|
pub mod model;
|
2026-11-26 16:30:07 +02:00
|
|
|
pub mod providers;
|
2026-11-26 16:55:27 +02:00
|
|
|
pub mod resolver;
|
2026-11-26 16:05:42 +02:00
|
|
|
#[allow(dead_code)]
|
|
|
|
|
pub mod store;
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests;
|
|
|
|
|
|
|
|
|
|
pub use handlers::ImportApp;
|
|
|
|
|
pub use job::LibraryImportJob;
|
|
|
|
|
|
|
|
|
|
pub mod db_migrations {
|
|
|
|
|
use cot::db::migrations::{self, Operation, SyncDynMigration};
|
|
|
|
|
|
|
|
|
|
#[cot::db::migrations::migration_op]
|
|
|
|
|
async fn create_library_import(ctx: migrations::MigrationContext<'_>) -> cot::db::Result<()> {
|
|
|
|
|
for statement in include_str!("schema.sql").split(';') {
|
|
|
|
|
if !statement.trim().is_empty() {
|
|
|
|
|
ctx.db.raw(statement).await?;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone)]
|
|
|
|
|
pub struct M0065CreateLibraryImport;
|
|
|
|
|
impl migrations::Migration for M0065CreateLibraryImport {
|
|
|
|
|
const APP_NAME: &'static str = "furumusic";
|
|
|
|
|
const MIGRATION_NAME: &'static str = "m_0065_create_library_import";
|
|
|
|
|
const DEPENDENCIES: &'static [migrations::MigrationDependency] =
|
|
|
|
|
&[migrations::MigrationDependency::migration(
|
|
|
|
|
"furumusic",
|
|
|
|
|
"m_0064_review_dismissals",
|
|
|
|
|
)];
|
|
|
|
|
const OPERATIONS: &'static [Operation] =
|
|
|
|
|
&[Operation::custom(create_library_import).build()];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub const MIGRATIONS: &[&SyncDynMigration] = &[&M0065CreateLibraryImport];
|
|
|
|
|
}
|