aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Migrations
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2026-03-07 20:12:42 +0100
committerShadowghost <Ghost_of_Stone@web.de>2026-03-07 20:12:42 +0100
commit077fa89717957f871b172ca4b2dc4a178efd3bc5 (patch)
tree1c2be0089b3c33cda1ed96bde4b76a715a845df7 /Jellyfin.Server/Migrations
parent268f23f39ac18e783156b91b575ee6a105b6937c (diff)
Split BaseItemRepository and IItemRepository
Diffstat (limited to 'Jellyfin.Server/Migrations')
-rw-r--r--Jellyfin.Server/Migrations/Routines/CleanupOrphanedExtras.cs3
-rw-r--r--Jellyfin.Server/Migrations/Routines/FixAudioData.cs19
-rw-r--r--Jellyfin.Server/Migrations/Routines/FixIncorrectOwnerIdRelationships.cs10
3 files changed, 17 insertions, 15 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/CleanupOrphanedExtras.cs b/Jellyfin.Server/Migrations/Routines/CleanupOrphanedExtras.cs
index ffde30f0ca..fccecfa9dc 100644
--- a/Jellyfin.Server/Migrations/Routines/CleanupOrphanedExtras.cs
+++ b/Jellyfin.Server/Migrations/Routines/CleanupOrphanedExtras.cs
@@ -36,6 +36,7 @@ public class CleanupOrphanedExtras : IAsyncMigrationRoutine
/// <param name="dbContextFactory">The database context factory.</param>
/// <param name="libraryManager">The library manager.</param>
/// <param name="itemRepository">The item repository.</param>
+ /// <param name="itemCountService">The item count service.</param>
/// <param name="channelManager">The channel manager.</param>
/// <param name="recordingsManager">The recordings manager.</param>
/// <param name="mediaSourceManager">The media source manager.</param>
@@ -46,6 +47,7 @@ public class CleanupOrphanedExtras : IAsyncMigrationRoutine
IDbContextFactory<JellyfinDbContext> dbContextFactory,
ILibraryManager libraryManager,
IItemRepository itemRepository,
+ IItemCountService itemCountService,
IChannelManager channelManager,
IRecordingsManager recordingsManager,
IMediaSourceManager mediaSourceManager,
@@ -57,6 +59,7 @@ public class CleanupOrphanedExtras : IAsyncMigrationRoutine
_libraryManager = libraryManager;
BaseItem.LibraryManager ??= libraryManager;
BaseItem.ItemRepository ??= itemRepository;
+ BaseItem.ItemCountService ??= itemCountService;
BaseItem.ChannelManager ??= channelManager;
BaseItem.MediaSourceManager ??= mediaSourceManager;
BaseItem.MediaSegmentManager ??= mediaSegmentManager;
diff --git a/Jellyfin.Server/Migrations/Routines/FixAudioData.cs b/Jellyfin.Server/Migrations/Routines/FixAudioData.cs
index 05ded06ba8..d102e24b91 100644
--- a/Jellyfin.Server/Migrations/Routines/FixAudioData.cs
+++ b/Jellyfin.Server/Migrations/Routines/FixAudioData.cs
@@ -1,10 +1,6 @@
-using System;
-using System.Globalization;
-using System.IO;
using System.Linq;
using System.Threading;
using Jellyfin.Data.Enums;
-using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Persistence;
@@ -23,16 +19,19 @@ namespace Jellyfin.Server.Migrations.Routines
#pragma warning restore CS0618 // Type or member is obsolete
{
private readonly ILogger<FixAudioData> _logger;
- private readonly IServerApplicationPaths _applicationPaths;
private readonly IItemRepository _itemRepository;
+ private readonly IItemCountService _countService;
+ private readonly IItemPersistenceService _persistenceService;
public FixAudioData(
- IServerApplicationPaths applicationPaths,
ILoggerFactory loggerFactory,
- IItemRepository itemRepository)
+ IItemRepository itemRepository,
+ IItemCountService countService,
+ IItemPersistenceService persistenceService)
{
- _applicationPaths = applicationPaths;
_itemRepository = itemRepository;
+ _countService = countService;
+ _persistenceService = persistenceService;
_logger = loggerFactory.CreateLogger<FixAudioData>();
}
@@ -41,7 +40,7 @@ namespace Jellyfin.Server.Migrations.Routines
{
_logger.LogInformation("Backfilling audio lyrics data to database.");
var startIndex = 0;
- var records = _itemRepository.GetCount(new InternalItemsQuery
+ var records = _countService.GetCount(new InternalItemsQuery
{
IncludeItemTypes = [BaseItemKind.Audio],
});
@@ -68,7 +67,7 @@ namespace Jellyfin.Server.Migrations.Routines
}
}
- _itemRepository.SaveItems(results, CancellationToken.None);
+ _persistenceService.SaveItems(results, CancellationToken.None);
startIndex += results.Count;
_logger.LogInformation("Backfilled data for {UpdatedRecords} of {TotalRecords} audio records", startIndex, records);
}
diff --git a/Jellyfin.Server/Migrations/Routines/FixIncorrectOwnerIdRelationships.cs b/Jellyfin.Server/Migrations/Routines/FixIncorrectOwnerIdRelationships.cs
index b9f5964c6a..c926362802 100644
--- a/Jellyfin.Server/Migrations/Routines/FixIncorrectOwnerIdRelationships.cs
+++ b/Jellyfin.Server/Migrations/Routines/FixIncorrectOwnerIdRelationships.cs
@@ -24,7 +24,7 @@ public class FixIncorrectOwnerIdRelationships : IAsyncMigrationRoutine
private readonly IStartupLogger<FixIncorrectOwnerIdRelationships> _logger;
private readonly IDbContextFactory<JellyfinDbContext> _dbContextFactory;
private readonly ILibraryManager _libraryManager;
- private readonly IItemRepository _itemRepository;
+ private readonly IItemPersistenceService _persistenceService;
/// <summary>
/// Initializes a new instance of the <see cref="FixIncorrectOwnerIdRelationships"/> class.
@@ -32,17 +32,17 @@ public class FixIncorrectOwnerIdRelationships : IAsyncMigrationRoutine
/// <param name="logger">The startup logger.</param>
/// <param name="dbContextFactory">The database context factory.</param>
/// <param name="libraryManager">The library manager.</param>
- /// <param name="itemRepository">The item repository.</param>
+ /// <param name="persistenceService">The item persistence service.</param>
public FixIncorrectOwnerIdRelationships(
IStartupLogger<FixIncorrectOwnerIdRelationships> logger,
IDbContextFactory<JellyfinDbContext> dbContextFactory,
ILibraryManager libraryManager,
- IItemRepository itemRepository)
+ IItemPersistenceService persistenceService)
{
_logger = logger;
_dbContextFactory = dbContextFactory;
_libraryManager = libraryManager;
- _itemRepository = itemRepository;
+ _persistenceService = persistenceService;
}
/// <inheritdoc/>
@@ -157,7 +157,7 @@ public class FixIncorrectOwnerIdRelationships : IAsyncMigrationRoutine
{
try
{
- _itemRepository.DeleteItem([itemId]);
+ _persistenceService.DeleteItem([itemId]);
deletedCount++;
_logger.LogInformation("Successfully deleted duplicate item {ItemId} at path {Path} via direct database deletion", itemId, path);
}