Add a library identifier to disambiguate clashes in the library #238
@ -295,7 +295,10 @@ impl AsRef<AlbumId> for AlbumId {
|
|||||||
|
|
||||||
impl AlbumId {
|
impl AlbumId {
|
||||||
pub fn new<S: Into<String>>(name: S) -> AlbumId {
|
pub fn new<S: Into<String>>(name: S) -> AlbumId {
|
||||||
AlbumId { title: name.into(), lib_id: AlbumLibId::None }
|
AlbumId {
|
||||||
|
title: name.into(),
|
||||||
|
lib_id: AlbumLibId::None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ impl Artist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn merge_album_with_lib_id(
|
fn merge_album_with_lib_id(
|
||||||
primary_albums: &mut Vec<Album>,
|
primary_albums: &mut [Album],
|
||||||
mut secondary_album: Album,
|
mut secondary_album: Album,
|
||||||
) -> Option<Album> {
|
) -> Option<Album> {
|
||||||
if let lib_id @ AlbumLibId::Some(_) | lib_id @ AlbumLibId::Singleton =
|
if let lib_id @ AlbumLibId::Some(_) | lib_id @ AlbumLibId::Singleton =
|
||||||
@ -79,7 +79,7 @@ impl Artist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn merge_albums_with_lib_id(
|
fn merge_albums_with_lib_id(
|
||||||
primary_albums: &mut Vec<Album>,
|
primary_albums: &mut [Album],
|
||||||
mut secondary_albums: Vec<Album>,
|
mut secondary_albums: Vec<Album>,
|
||||||
) -> HashMap<String, Vec<Album>> {
|
) -> HashMap<String, Vec<Album>> {
|
||||||
let mut secondary_without_id = HashMap::<String, Vec<Album>>::new();
|
let mut secondary_without_id = HashMap::<String, Vec<Album>>::new();
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
//! Module for interacting with the music library.
|
//! Module for interacting with the music library.
|
||||||
|
|
||||||
use std::{collections::HashSet, fmt, num::ParseIntError, str::{ParseBoolError, Utf8Error}};
|
use std::{
|
||||||
|
collections::HashSet,
|
||||||
|
fmt,
|
||||||
|
num::ParseIntError,
|
||||||
|
str::{ParseBoolError, Utf8Error},
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use mockall::automock;
|
use mockall::automock;
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
use crate::{collection::album::AlbumLibId, core::{collection::track::TrackFormat, interface::library::Item}};
|
use crate::{
|
||||||
|
collection::album::AlbumLibId,
|
||||||
|
core::{collection::track::TrackFormat, interface::library::Item},
|
||||||
|
};
|
||||||
|
|
||||||
pub static LIBRARY_ITEMS: Lazy<Vec<Item>> = Lazy::new(|| -> Vec<Item> {
|
pub static LIBRARY_ITEMS: Lazy<Vec<Item>> = Lazy::new(|| -> Vec<Item> {
|
||||||
vec![
|
vec![
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use musichoard::collection::{
|
use musichoard::collection::{
|
||||||
album::{
|
album::{
|
||||||
AlbumDate, AlbumId, AlbumLibId, AlbumMeta, AlbumPrimaryType, AlbumSecondaryType, AlbumSeq, AlbumStatus
|
AlbumDate, AlbumId, AlbumLibId, AlbumMeta, AlbumPrimaryType, AlbumSecondaryType, AlbumSeq,
|
||||||
|
AlbumStatus,
|
||||||
},
|
},
|
||||||
artist::ArtistMeta,
|
artist::ArtistMeta,
|
||||||
musicbrainz::{IMusicBrainzRef, MbRefOption},
|
musicbrainz::{IMusicBrainzRef, MbRefOption},
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
use musichoard::{collection::{album::AlbumLibId, track::TrackFormat}, interface::library::Item};
|
use musichoard::{
|
||||||
|
collection::{album::AlbumLibId, track::TrackFormat},
|
||||||
|
interface::library::Item,
|
||||||
|
};
|
||||||
|
|
||||||
pub static LIBRARY_ITEMS: Lazy<Vec<Item>> = Lazy::new(|| -> Vec<Item> {
|
pub static LIBRARY_ITEMS: Lazy<Vec<Item>> = Lazy::new(|| -> Vec<Item> {
|
||||||
vec![
|
vec![
|
||||||
|
Loading…
x
Reference in New Issue
Block a user