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()) {
|
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) {
|
||||||
_logger.LogDebug("- {0}", asm);
|
_logger.LogDebug("- {0}", asm);
|
||||||
}
|
}
|
||||||
|
var i = 0;
|
||||||
foreach (SmartPlaylistDto dto in await _store.GetAllSmartPlaylistsAsync()) {
|
foreach (SmartPlaylistDto dto in await _store.GetAllSmartPlaylistsAsync()) {
|
||||||
if (!dto.Enabled) {
|
if (!dto.Enabled) {
|
||||||
|
i += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var changedDto = false;
|
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.
|
_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) {
|
||||||
|
@ -203,9 +204,9 @@ 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(100 * ((double)i)/dto.Playlists.Count());
|
|
||||||
}
|
}
|
||||||
|
i += 1;
|
||||||
|
progress.Report(100 * ((double)i)/dto.Playlists.Count());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue