Implemented tag refresh on a playlist. Made audio file scanning truly asynchronous. Added basic playlist sorting functionality.
This commit is contained in:
@@ -164,6 +164,8 @@ public class Playlist
|
||||
|
||||
public void ImportTags(Song[] songs)
|
||||
{
|
||||
List<PlaylistSong> updatedPlaylistSongs = [];
|
||||
|
||||
foreach (Song song in songs)
|
||||
{
|
||||
PlaylistSong[] playlistSongs = [.. Songs.Where(playlistSong =>
|
||||
@@ -171,10 +173,24 @@ public class Playlist
|
||||
|
||||
foreach (PlaylistSong playlistSong in playlistSongs)
|
||||
{
|
||||
//playlistSong.Song = song;
|
||||
//playlistSong.Song.Update(song);
|
||||
playlistSong.Song.Update(song);
|
||||
}
|
||||
|
||||
updatedPlaylistSongs.AddRange(playlistSongs);
|
||||
}
|
||||
|
||||
if (updatedPlaylistSongs.Count == 0)
|
||||
return;
|
||||
|
||||
PlaylistUpdatedEventArgs eventArgs = new()
|
||||
{
|
||||
Action = PlaylistUpdateAction.Refresh,
|
||||
Index = -1,
|
||||
Count = updatedPlaylistSongs.Count,
|
||||
Songs = [.. updatedPlaylistSongs]
|
||||
};
|
||||
|
||||
PlaylistUpdated?.Invoke(this, eventArgs);
|
||||
}
|
||||
|
||||
public void RemoveMissingSongs()
|
||||
|
||||
@@ -17,5 +17,9 @@ public enum PlaylistUpdateAction
|
||||
/// <summary>
|
||||
/// The contents of the collection changed dramatically.
|
||||
/// </summary>
|
||||
Reset
|
||||
Reset,
|
||||
/// <summary>
|
||||
/// The tags of the songs in the collection were refreshed.
|
||||
/// </summary>
|
||||
Refresh
|
||||
}
|
||||
Reference in New Issue
Block a user