Implemented tag refresh on a playlist. Made audio file scanning truly asynchronous. Added basic playlist sorting functionality.

This commit is contained in:
2026-08-02 23:34:04 -04:00
parent 7aaf36f7b2
commit 99978c62c4
7 changed files with 191 additions and 36 deletions

View File

@@ -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()

View File

@@ -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
}