2013-03-02 19:25:39 +01:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
2013-02-24 07:48:52 +01:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.ReferenceData
|
|
|
|
|
{
|
|
|
|
|
public class DailySeriesService
|
|
|
|
|
{
|
2013-03-02 19:25:39 +01:00
|
|
|
|
private readonly IDailySeriesDataProxy _proxy;
|
|
|
|
|
private readonly ISeriesService _seriesService;
|
2013-02-24 07:48:52 +01:00
|
|
|
|
|
2013-03-02 19:25:39 +01:00
|
|
|
|
public DailySeriesService(IDailySeriesDataProxy proxy, ISeriesService seriesService)
|
2013-02-24 07:48:52 +01:00
|
|
|
|
{
|
2013-03-02 19:25:39 +01:00
|
|
|
|
_proxy = proxy;
|
|
|
|
|
_seriesService = seriesService;
|
2013-02-24 07:48:52 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void UpdateDailySeries()
|
|
|
|
|
{
|
2013-03-02 19:25:39 +01:00
|
|
|
|
var dailySeries = _proxy.GetDailySeriesIds();
|
2013-02-24 07:48:52 +01:00
|
|
|
|
|
2013-03-02 19:25:39 +01:00
|
|
|
|
foreach (var tvdbId in dailySeries)
|
2013-02-24 07:48:52 +01:00
|
|
|
|
{
|
2013-03-02 19:25:39 +01:00
|
|
|
|
var series = _seriesService.FindByTvdbId(tvdbId);
|
2013-02-24 07:48:52 +01:00
|
|
|
|
|
2013-03-02 19:25:39 +01:00
|
|
|
|
if (series != null)
|
|
|
|
|
{
|
2013-03-04 06:53:02 +01:00
|
|
|
|
_seriesService.SetSeriesType(series.Id, SeriesTypes.Daily);
|
2013-03-02 19:25:39 +01:00
|
|
|
|
}
|
2013-02-24 07:48:52 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|