fix: make sure albums and artists are bound to songs
This commit is contained in:
@@ -75,6 +75,8 @@ public static class MediaParser
|
|||||||
"ID3v2_3:Album", // Generic mp3/wav ID3 v2.3.0
|
"ID3v2_3:Album", // Generic mp3/wav ID3 v2.3.0
|
||||||
]) ?? "[Unknown Album]"; // again, weak line of defense
|
]) ?? "[Unknown Album]"; // again, weak line of defense
|
||||||
|
|
||||||
|
// TODO: Try and find genres
|
||||||
|
|
||||||
// Try to find relevant artists and albums
|
// Try to find relevant artists and albums
|
||||||
Artist artist = db.Artists
|
Artist artist = db.Artists
|
||||||
.FirstOrDefault(a => a.NormalizedName == artistName.ToLower())
|
.FirstOrDefault(a => a.NormalizedName == artistName.ToLower())
|
||||||
@@ -108,6 +110,7 @@ public static class MediaParser
|
|||||||
// Is Update() safe here?
|
// Is Update() safe here?
|
||||||
db.Artists.Update(artist);
|
db.Artists.Update(artist);
|
||||||
db.Albums.Update(album);
|
db.Albums.Update(album);
|
||||||
|
db.SaveChanges();
|
||||||
db.Songs.Update(song);
|
db.Songs.Update(song);
|
||||||
artist.Albums.Add(album);
|
artist.Albums.Add(album);
|
||||||
artist.Songs.Add(song);
|
artist.Songs.Add(song);
|
||||||
@@ -115,7 +118,7 @@ public static class MediaParser
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine("[Error: MediaParser] Failed to extract metadata from {filepath}:\n" +
|
Console.WriteLine($"[Error: MediaParser] Failed to extract metadata from {filepath}:\n" +
|
||||||
$"{e}");
|
$"{e}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user