fix: progress report should consider all playlists and maybe not jump around.
This commit is contained in:
parent
097d267d24
commit
b73f65829d
1 changed files with 4 additions and 3 deletions
|
@ -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,11 +204,11 @@ 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ClearPlaylist(Playlist playlist) {
|
||||
// fuck if I know
|
||||
|
|
Loading…
Reference in a new issue