Add album artist field
This commit is contained in:
parent
429755f1e1
commit
644403c2f3
|
@ -98,6 +98,9 @@ pub async fn index_source(source: Source, mode: IndexMode, db: &DatabaseConnecti
|
||||||
source_id: Set(source.id.into()),
|
source_id: Set(source.id.into()),
|
||||||
hash: Set(hash.try_into().into_diagnostic()?),
|
hash: Set(hash.try_into().into_diagnostic()?),
|
||||||
artist: Set(tags.and_then(|t| t.artist()).map(|t| t.to_string())),
|
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())),
|
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())),
|
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())),
|
genres: Set(tags.and_then(|t| t.genre()).map(|t| t.to_string())),
|
||||||
|
|
|
@ -28,6 +28,7 @@ impl MigrationTrait for Migration {
|
||||||
.col(ColumnDef::new(Song::SourceId).integer().not_null())
|
.col(ColumnDef::new(Song::SourceId).integer().not_null())
|
||||||
.col(ColumnDef::new(Song::Hash).integer().not_null().unique_key())
|
.col(ColumnDef::new(Song::Hash).integer().not_null().unique_key())
|
||||||
.col(ColumnDef::new(Song::Artist).string())
|
.col(ColumnDef::new(Song::Artist).string())
|
||||||
|
.col(ColumnDef::new(Song::AlbumArtist).string())
|
||||||
.col(ColumnDef::new(Song::Name).string())
|
.col(ColumnDef::new(Song::Name).string())
|
||||||
.col(ColumnDef::new(Song::Album).string())
|
.col(ColumnDef::new(Song::Album).string())
|
||||||
.col(ColumnDef::new(Song::Duration).integer().not_null())
|
.col(ColumnDef::new(Song::Duration).integer().not_null())
|
||||||
|
@ -60,6 +61,7 @@ pub enum Song {
|
||||||
/// A hash of the song's samples as Vec<f32>
|
/// A hash of the song's samples as Vec<f32>
|
||||||
Hash,
|
Hash,
|
||||||
Artist,
|
Artist,
|
||||||
|
AlbumArtist,
|
||||||
Name,
|
Name,
|
||||||
Album,
|
Album,
|
||||||
Duration,
|
Duration,
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1
|
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
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")]
|
#[sea_orm(table_name = "library")]
|
||||||
pub struct Model {
|
pub struct Model {
|
||||||
#[sea_orm(primary_key)]
|
#[sea_orm(primary_key)]
|
||||||
|
@ -12,6 +13,7 @@ pub struct Model {
|
||||||
pub source_id: i32,
|
pub source_id: i32,
|
||||||
pub hash: u32,
|
pub hash: u32,
|
||||||
pub artist: Option<String>,
|
pub artist: Option<String>,
|
||||||
|
pub album_artist: Option<String>,
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub album: Option<String>,
|
pub album: Option<String>,
|
||||||
pub duration: u32,
|
pub duration: u32,
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1
|
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
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")]
|
#[sea_orm(table_name = "playlist_entries")]
|
||||||
pub struct Model {
|
pub struct Model {
|
||||||
#[sea_orm(primary_key)]
|
#[sea_orm(primary_key)]
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1
|
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1
|
||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
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")]
|
#[sea_orm(table_name = "playlists")]
|
||||||
pub struct Model {
|
pub struct Model {
|
||||||
#[sea_orm(primary_key)]
|
#[sea_orm(primary_key)]
|
||||||
|
|
Loading…
Reference in New Issue