< Summary - Jellyfin

Information
Class: Jellyfin.LiveTv.Guide.RefreshGuideScheduledTask
Assembly: Jellyfin.LiveTv
File(s): /srv/git/jellyfin/src/Jellyfin.LiveTv/Guide/RefreshGuideScheduledTask.cs
Line coverage
75%
Covered lines: 15
Uncovered lines: 5
Coverable lines: 20
Total lines: 74
Line coverage: 75%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Name()100%11100%
get_Description()100%210%
get_Category()100%210%
get_IsHidden()0%620%
get_IsEnabled()100%210%
get_IsLogged()100%210%
get_Key()100%11100%
ExecuteAsync(...)100%11100%
GetDefaultTriggers()100%11100%

File(s)

/srv/git/jellyfin/src/Jellyfin.LiveTv/Guide/RefreshGuideScheduledTask.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Threading;
 4using System.Threading.Tasks;
 5using Jellyfin.LiveTv.Configuration;
 6using MediaBrowser.Common.Configuration;
 7using MediaBrowser.Controller.LiveTv;
 8using MediaBrowser.Model.Tasks;
 9
 10namespace Jellyfin.LiveTv.Guide;
 11
 12/// <summary>
 13/// The "Refresh Guide" scheduled task.
 14/// </summary>
 15public class RefreshGuideScheduledTask : IScheduledTask, IConfigurableScheduledTask
 16{
 17    private readonly ILiveTvManager _liveTvManager;
 18    private readonly IGuideManager _guideManager;
 19    private readonly IConfigurationManager _config;
 20
 21    /// <summary>
 22    /// Initializes a new instance of the <see cref="RefreshGuideScheduledTask"/> class.
 23    /// </summary>
 24    /// <param name="liveTvManager">The live tv manager.</param>
 25    /// <param name="guideManager">The guide manager.</param>
 26    /// <param name="config">The configuration manager.</param>
 27    public RefreshGuideScheduledTask(
 28        ILiveTvManager liveTvManager,
 29        IGuideManager guideManager,
 30        IConfigurationManager config)
 31    {
 2232        _liveTvManager = liveTvManager;
 2233        _guideManager = guideManager;
 2234        _config = config;
 2235    }
 36
 37    /// <inheritdoc />
 3138    public string Name => "Refresh Guide";
 39
 40    /// <inheritdoc />
 041    public string Description => "Downloads channel information from live tv services.";
 42
 43    /// <inheritdoc />
 044    public string Category => "Live TV";
 45
 46    /// <inheritdoc />
 047    public bool IsHidden => _liveTvManager.Services.Count == 1 && _config.GetLiveTvConfiguration().TunerHosts.Length == 
 48
 49    /// <inheritdoc />
 050    public bool IsEnabled => true;
 51
 52    /// <inheritdoc />
 053    public bool IsLogged => true;
 54
 55    /// <inheritdoc />
 256    public string Key => "RefreshGuide";
 57
 58    /// <inheritdoc />
 59    public Task ExecuteAsync(IProgress<double> progress, CancellationToken cancellationToken)
 160        => _guideManager.RefreshGuide(progress, cancellationToken);
 61
 62    /// <inheritdoc />
 63    public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
 64    {
 2265        return new[]
 2266        {
 2267            new TaskTriggerInfo
 2268            {
 2269                Type = TaskTriggerInfo.TriggerInterval,
 2270                IntervalTicks = TimeSpan.FromHours(24).Ticks
 2271            }
 2272        };
 73    }
 74}