Files
furumi-web/src/library_import/mod.rs
T

57 lines
1.9 KiB
Rust
Raw Normal View History

//! 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.
// 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.
pub mod adapters;
mod handlers;
pub mod job;
pub mod matcher;
#[allow(dead_code)]
pub mod model;
pub mod providers;
pub mod publisher;
pub mod resolver;
#[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];
}