diff options
| author | Tim Eisele <Ghost_of_Stone@web.de> | 2025-10-13 20:32:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-13 12:32:41 -0600 |
| commit | 5c519270b84cc07928bd45a14f38f9b1add24d01 (patch) | |
| tree | 83be33f0dfcfb22cb2e127eda7c64049ad58cd82 /Jellyfin.Server.Implementations/Item | |
| parent | 55047b11834cd2679329eeb6fd208dda3e5d164f (diff) | |
Remove chapters on file change (#14984)
Diffstat (limited to 'Jellyfin.Server.Implementations/Item')
| -rw-r--r-- | Jellyfin.Server.Implementations/Item/ChapterRepository.cs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Jellyfin.Server.Implementations/Item/ChapterRepository.cs b/Jellyfin.Server.Implementations/Item/ChapterRepository.cs index e0d23a261..98700f322 100644 --- a/Jellyfin.Server.Implementations/Item/ChapterRepository.cs +++ b/Jellyfin.Server.Implementations/Item/ChapterRepository.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; +using System.Threading.Tasks; using Jellyfin.Database.Implementations; using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Drawing; @@ -82,11 +84,14 @@ public class ChapterRepository : IChapterRepository } /// <inheritdoc /> - public void DeleteChapters(Guid itemId) + public async Task DeleteChaptersAsync(Guid itemId, CancellationToken cancellationToken) { - using var context = _dbProvider.CreateDbContext(); - context.Chapters.Where(c => c.ItemId.Equals(itemId)).ExecuteDelete(); - context.SaveChanges(); + var dbContext = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false); + await using (dbContext.ConfigureAwait(false)) + { + await dbContext.Chapters.Where(c => c.ItemId.Equals(itemId)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + await dbContext.SaveChangesAsync(cancellationToken).ConfigureAwait(false); + } } private Chapter Map(ChapterInfo chapterInfo, int index, Guid itemId) |
