mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-16 16:04:08 +01:00
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using NzbDrone.Core.Tv;
|
|
|
|
namespace NzbDrone.Core.DataAugmentation.DailySeries
|
|
{
|
|
public interface IDailySeriesService
|
|
{
|
|
void UpdateDailySeries();
|
|
bool IsDailySeries(int tvdbid);
|
|
}
|
|
|
|
public class DailySeriesService : IDailySeriesService
|
|
{
|
|
//TODO: add timer command
|
|
|
|
private readonly IDailySeriesDataProxy _proxy;
|
|
private readonly ISeriesService _seriesService;
|
|
|
|
public DailySeriesService(IDailySeriesDataProxy proxy, ISeriesService seriesService)
|
|
{
|
|
_proxy = proxy;
|
|
_seriesService = seriesService;
|
|
}
|
|
|
|
public void UpdateDailySeries()
|
|
{
|
|
var dailySeries = _proxy.GetDailySeriesIds();
|
|
|
|
foreach (var tvdbId in dailySeries)
|
|
{
|
|
var series = _seriesService.FindByTvdbId(tvdbId);
|
|
|
|
if (series != null)
|
|
{
|
|
_seriesService.SetSeriesType(series.Id, SeriesTypes.Daily);
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool IsDailySeries(int tvdbid)
|
|
{
|
|
return _proxy.IsDailySeries(tvdbid);
|
|
}
|
|
}
|
|
}
|