mirror of
https://github.com/Dummi26/musicdb.git
synced 2025-03-10 14:13:53 +01:00
fixed empty-string albums and possible artist empty string weirdness
This commit is contained in:
parent
3093ec1a25
commit
9c340aa913
@ -68,8 +68,8 @@ fn main() {
|
|||||||
let (artist_id, album_id) = if let Some(artist) = song
|
let (artist_id, album_id) = if let Some(artist) = song
|
||||||
.1
|
.1
|
||||||
.album_artist()
|
.album_artist()
|
||||||
.or_else(|| song.1.artist())
|
|
||||||
.filter(|v| !v.trim().is_empty())
|
.filter(|v| !v.trim().is_empty())
|
||||||
|
.or_else(|| song.1.artist().filter(|v| !v.trim().is_empty()))
|
||||||
{
|
{
|
||||||
let artist_id = if !artists.contains_key(artist) {
|
let artist_id = if !artists.contains_key(artist) {
|
||||||
let artist_id = database.add_artist_new(Artist {
|
let artist_id = database.add_artist_new(Artist {
|
||||||
@ -85,7 +85,7 @@ fn main() {
|
|||||||
} else {
|
} else {
|
||||||
artists.get(artist).unwrap().0
|
artists.get(artist).unwrap().0
|
||||||
};
|
};
|
||||||
if let Some(album) = song.1.album() {
|
if let Some(album) = song.1.album().filter(|a| !a.trim().is_empty()) {
|
||||||
let (_, albums) = artists.get_mut(artist).unwrap();
|
let (_, albums) = artists.get_mut(artist).unwrap();
|
||||||
let album_id = if !albums.contains_key(album) {
|
let album_id = if !albums.contains_key(album) {
|
||||||
let album_id = database.add_album_new(Album {
|
let album_id = database.add_album_new(Album {
|
||||||
|
Loading…
Reference in New Issue
Block a user