< Summary - Jellyfin

Information
Class: Jellyfin.LiveTv.LiveTvChannelImageHelper
Assembly: Jellyfin.LiveTv
File(s): /srv/git/jellyfin/src/Jellyfin.LiveTv/LiveTvChannelImageHelper.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 33
Line coverage: 100%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 6/28/2026 - 12:15:35 AM Line coverage: 100% (7/7) Branch coverage: 75% (3/4) Total lines: 33 6/28/2026 - 12:15:35 AM Line coverage: 100% (7/7) Branch coverage: 75% (3/4) Total lines: 33

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
UpdateChannelImageIfNeeded(...)75%44100%

File(s)

/srv/git/jellyfin/src/Jellyfin.LiveTv/LiveTvChannelImageHelper.cs

#LineLine coverage
 1using MediaBrowser.Controller.Entities;
 2using MediaBrowser.Model.Entities;
 3
 4namespace Jellyfin.LiveTv;
 5
 6/// <summary>
 7/// Helpers for keeping Live TV channel icons in sync with guide data.
 8/// </summary>
 9internal static class LiveTvChannelImageHelper
 10{
 11    /// <summary>
 12    /// Applies the channel icon from guide or tuner metadata.
 13    /// Called on each guide refresh so remote icons are re-downloaded even when the URL is unchanged.
 14    /// </summary>
 15    /// <param name="item">The channel item.</param>
 16    /// <param name="imagePath">The local image path from the tuner, if any.</param>
 17    /// <param name="imageUrl">The remote image URL from the guide provider, if any.</param>
 18    /// <returns><c>true</c> when the item image metadata was updated.</returns>
 19    internal static bool UpdateChannelImageIfNeeded(BaseItem item, string? imagePath, string? imageUrl)
 20    {
 421        var newImageSource = !string.IsNullOrWhiteSpace(imagePath)
 422            ? imagePath
 423            : imageUrl;
 24
 425        if (string.IsNullOrWhiteSpace(newImageSource))
 26        {
 127            return false;
 28        }
 29
 330        item.SetImagePath(ImageType.Primary, newImageSource);
 331        return true;
 32    }
 33}