fix: report progress.

This commit is contained in:
redxef 2024-11-07 22:32:11 +01:00
parent 889df318db
commit 3c3ddc9e83
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921

View file

@ -145,6 +145,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks {
_store.DeleteSmartPlaylist(dto); // delete in case the file was not the canonical one. _store.DeleteSmartPlaylist(dto); // delete in case the file was not the canonical one.
await _store.SaveSmartPlaylistAsync(dto); await _store.SaveSmartPlaylistAsync(dto);
} }
var i = 0;
foreach (SmartPlaylistLinkDto playlistLink in dto.Playlists) { foreach (SmartPlaylistLinkDto playlistLink in dto.Playlists) {
User? user = _userManager.GetUserById(playlistLink.UserId); User? user = _userManager.GetUserById(playlistLink.UserId);
if (user == null) { if (user == null) {
@ -154,6 +155,8 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks {
var playlist = _playlistManager.GetPlaylists(playlistLink.UserId).Where(x => x.Id == playlistLink.PlaylistId).First(); var playlist = _playlistManager.GetPlaylists(playlistLink.UserId).Where(x => x.Id == playlistLink.PlaylistId).First();
await ClearPlaylist(playlist); await ClearPlaylist(playlist);
await _playlistManager.AddItemToPlaylistAsync(playlist.Id, insertItems, playlistLink.UserId); await _playlistManager.AddItemToPlaylistAsync(playlist.Id, insertItems, playlistLink.UserId);
i += 1;
progress.Report(((double)i)/dto.Playlists.Count());
} }
} }
} }