diff --git a/src/backend/fetching.rs b/src/backend/fetching.rs index 0852caf..512df51 100644 --- a/src/backend/fetching.rs +++ b/src/backend/fetching.rs @@ -98,6 +98,9 @@ pub async fn index_source(source: Source, mode: IndexMode, db: &DatabaseConnecti source_id: Set(source.id.into()), hash: Set(hash.try_into().into_diagnostic()?), artist: Set(tags.and_then(|t| t.artist()).map(|t| t.to_string())), + album_artist: Set(tags + .and_then(|t| t.get_string(&lofty::ItemKey::AlbumArtist)) + .map(|t| t.to_string())), name: Set(tags.and_then(|t| t.title()).map(|t| t.to_string())), album: Set(tags.and_then(|t| t.album()).map(|t| t.to_string())), genres: Set(tags.and_then(|t| t.genre()).map(|t| t.to_string())), diff --git a/src/backend/migrator/m20220803_000001_create_library.rs b/src/backend/migrator/m20220803_000001_create_library.rs index 1ba8f5f..28f202f 100644 --- a/src/backend/migrator/m20220803_000001_create_library.rs +++ b/src/backend/migrator/m20220803_000001_create_library.rs @@ -28,6 +28,7 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(Song::SourceId).integer().not_null()) .col(ColumnDef::new(Song::Hash).integer().not_null().unique_key()) .col(ColumnDef::new(Song::Artist).string()) + .col(ColumnDef::new(Song::AlbumArtist).string()) .col(ColumnDef::new(Song::Name).string()) .col(ColumnDef::new(Song::Album).string()) .col(ColumnDef::new(Song::Duration).integer().not_null()) @@ -60,6 +61,7 @@ pub enum Song { /// A hash of the song's samples as Vec Hash, Artist, + AlbumArtist, Name, Album, Duration, diff --git a/src/backend/model/library.rs b/src/backend/model/library.rs index e3fbad4..0b1d40d 100644 --- a/src/backend/model/library.rs +++ b/src/backend/model/library.rs @@ -1,8 +1,9 @@ //! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)] #[sea_orm(table_name = "library")] pub struct Model { #[sea_orm(primary_key)] @@ -12,6 +13,7 @@ pub struct Model { pub source_id: i32, pub hash: u32, pub artist: Option, + pub album_artist: Option, pub name: Option, pub album: Option, pub duration: u32, diff --git a/src/backend/model/playlist_entries.rs b/src/backend/model/playlist_entries.rs index 7d12974..d677e5f 100644 --- a/src/backend/model/playlist_entries.rs +++ b/src/backend/model/playlist_entries.rs @@ -1,8 +1,9 @@ //! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)] #[sea_orm(table_name = "playlist_entries")] pub struct Model { #[sea_orm(primary_key)] diff --git a/src/backend/model/playlists.rs b/src/backend/model/playlists.rs index 0a61c6e..b033ee8 100644 --- a/src/backend/model/playlists.rs +++ b/src/backend/model/playlists.rs @@ -1,8 +1,9 @@ //! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)] #[sea_orm(table_name = "playlists")] pub struct Model { #[sea_orm(primary_key)]