jellyfin-server/MediaBrowser.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs

64 lines
1.6 KiB
C#
Raw Normal View History

2014-03-18 17:05:57 +00:00
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Model.Tasks;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.Channels
{
class RefreshChannelsScheduledTask : IScheduledTask, IConfigurableScheduledTask
{
private readonly IChannelManager _manager;
public RefreshChannelsScheduledTask(IChannelManager manager)
{
_manager = manager;
}
public string Name
{
get { return "Refresh Channels"; }
}
public string Description
{
get { return "Refreshes internet channel information."; }
}
public string Category
{
get { return "Channels"; }
}
public Task Execute(System.Threading.CancellationToken cancellationToken, IProgress<double> progress)
{
var manager = (ChannelManager)_manager;
return manager.RefreshChannels(progress, cancellationToken);
}
public IEnumerable<ITaskTrigger> GetDefaultTriggers()
{
return new ITaskTrigger[]
{
2014-08-11 23:41:11 +00:00
new StartupTrigger{DelayMs = 10000},
2014-03-18 17:05:57 +00:00
new SystemEventTrigger{ SystemEvent = SystemEvent.WakeFromSleep},
new IntervalTrigger{ Interval = TimeSpan.FromHours(24)}
};
}
public bool IsHidden
{
get { return true; }
}
public bool IsEnabled
{
get { return true; }
}
}
}