< Summary - Jellyfin

Information
Class: Jellyfin.Server.Migrations.Routines.RemoveDownloadImagesInAdvance
Assembly: jellyfin
File(s): /srv/git/jellyfin/Jellyfin.Server/Migrations/Routines/20250420130000_RemoveDownloadImagesInAdvance.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 12
Coverable lines: 12
Total lines: 47
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 5/31/2026 - 12:15:44 AM Line coverage: 0% (0/12) Branch coverage: 0% (0/6) Total lines: 4511/13/2026 - 12:19:51 AM Line coverage: 0% (0/12) Branch coverage: 0% (0/6) Total lines: 47 5/31/2026 - 12:15:44 AM Line coverage: 0% (0/12) Branch coverage: 0% (0/6) Total lines: 4511/13/2026 - 12:19:51 AM Line coverage: 0% (0/12) Branch coverage: 0% (0/6) Total lines: 47

Coverage delta

Coverage delta 1 -1

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
PerformAsync(...)0%4260%

File(s)

/srv/git/jellyfin/Jellyfin.Server/Migrations/Routines/20250420130000_RemoveDownloadImagesInAdvance.cs

#LineLine coverage
 1using System;
 2using System.Threading;
 3using System.Threading.Tasks;
 4using MediaBrowser.Controller.Entities;
 5using MediaBrowser.Controller.Library;
 6using Microsoft.Extensions.Logging;
 7
 8namespace Jellyfin.Server.Migrations.Routines;
 9
 10/// <summary>
 11/// Removes the old 'RemoveDownloadImagesInAdvance' from library options.
 12/// </summary>
 13[JellyfinMigration("2025-04-20T13:00:00", nameof(RemoveDownloadImagesInAdvance), "A81F75E0-8F43-416F-A5E8-516CCAB4D8CC")
 14internal class RemoveDownloadImagesInAdvance : IAsyncMigrationRoutine
 15{
 16    private readonly ILogger<RemoveDownloadImagesInAdvance> _logger;
 17    private readonly ILibraryManager _libraryManager;
 18
 19    public RemoveDownloadImagesInAdvance(ILogger<RemoveDownloadImagesInAdvance> logger, ILibraryManager libraryManager)
 20    {
 021        _logger = logger;
 022        _libraryManager = libraryManager;
 023    }
 24
 25    /// <inheritdoc/>
 26    public Task PerformAsync(CancellationToken cancellationToken)
 27    {
 028        var virtualFolders = _libraryManager.GetVirtualFolders(false);
 029        _logger.LogInformation("Removing 'RemoveDownloadImagesInAdvance' settings in all the libraries");
 030        foreach (var virtualFolder in virtualFolders)
 31        {
 32            // Some virtual folders don't have a proper item id.
 033            if (!Guid.TryParse(virtualFolder.ItemId, out var folderId))
 34            {
 35                continue;
 36            }
 37
 038            var libraryOptions = virtualFolder.LibraryOptions;
 039            var collectionFolder = _libraryManager.GetItemById<CollectionFolder>(folderId) ?? throw new InvalidOperation
 40            // The property no longer exists in LibraryOptions, so we just re-save the options to get old data removed.
 041            collectionFolder.UpdateLibraryOptions(libraryOptions);
 042            _logger.LogInformation("Removed from '{VirtualFolder}'", virtualFolder.Name);
 43        }
 44
 045        return Task.CompletedTask;
 46    }
 47}