diff --git a/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs b/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs index f0472c3..f56c9f8 100644 --- a/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs +++ b/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs @@ -165,8 +165,10 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks { foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) { _logger.LogDebug("- {0}", asm); } + var i = 0; foreach (SmartPlaylistDto dto in await _store.GetAllSmartPlaylistsAsync()) { if (!dto.Enabled) { + i += 1; continue; } var changedDto = false; @@ -193,7 +195,6 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks { _store.DeleteSmartPlaylist(dto); // delete in case the file was not the canonical one. await _store.SaveSmartPlaylistAsync(dto); } - var i = 0; foreach (SmartPlaylistLinkDto playlistLink in dto.Playlists) { User? user = _userManager.GetUserById(playlistLink.UserId); if (user == null) { @@ -203,9 +204,9 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks { var playlist = _playlistManager.GetPlaylists(playlistLink.UserId).Where(x => x.Id == playlistLink.PlaylistId).First(); await ClearPlaylist(playlist); await _playlistManager.AddItemToPlaylistAsync(playlist.Id, insertItems, playlistLink.UserId); - i += 1; - progress.Report(100 * ((double)i)/dto.Playlists.Count()); } + i += 1; + progress.Report(100 * ((double)i)/dto.Playlists.Count()); } }