2013-03-02 21:25:39 +03:00
|
|
|
using NzbDrone.Core.Tv;
|
2013-02-24 09:48:52 +03:00
|
|
|
|
2013-04-01 05:43:58 +03:00
|
|
|
namespace NzbDrone.Core.DataAugmentation.DailySeries
|
2013-02-24 09:48:52 +03:00
|
|
|
{
|
2013-07-19 04:52:31 +03:00
|
|
|
public interface IDailySeriesService
|
|
|
|
{
|
|
|
|
void UpdateDailySeries();
|
|
|
|
bool IsDailySeries(int tvdbid);
|
|
|
|
}
|
|
|
|
|
|
|
|
public class DailySeriesService : IDailySeriesService
|
2013-02-24 09:48:52 +03:00
|
|
|
{
|
2013-05-07 03:39:33 +03:00
|
|
|
//TODO: add timer command
|
|
|
|
|
2013-03-02 21:25:39 +03:00
|
|
|
private readonly IDailySeriesDataProxy _proxy;
|
|
|
|
private readonly ISeriesService _seriesService;
|
2013-02-24 09:48:52 +03:00
|
|
|
|
2013-03-02 21:25:39 +03:00
|
|
|
public DailySeriesService(IDailySeriesDataProxy proxy, ISeriesService seriesService)
|
2013-02-24 09:48:52 +03:00
|
|
|
{
|
2013-03-02 21:25:39 +03:00
|
|
|
_proxy = proxy;
|
|
|
|
_seriesService = seriesService;
|
2013-02-24 09:48:52 +03:00
|
|
|
}
|
|
|
|
|
2013-07-19 04:52:31 +03:00
|
|
|
public void UpdateDailySeries()
|
2013-02-24 09:48:52 +03:00
|
|
|
{
|
2013-03-02 21:25:39 +03:00
|
|
|
var dailySeries = _proxy.GetDailySeriesIds();
|
2013-02-24 09:48:52 +03:00
|
|
|
|
2013-03-02 21:25:39 +03:00
|
|
|
foreach (var tvdbId in dailySeries)
|
2013-02-24 09:48:52 +03:00
|
|
|
{
|
2013-03-02 21:25:39 +03:00
|
|
|
var series = _seriesService.FindByTvdbId(tvdbId);
|
2013-02-24 09:48:52 +03:00
|
|
|
|
2013-03-02 21:25:39 +03:00
|
|
|
if (series != null)
|
|
|
|
{
|
2013-03-04 08:53:02 +03:00
|
|
|
_seriesService.SetSeriesType(series.Id, SeriesTypes.Daily);
|
2013-03-02 21:25:39 +03:00
|
|
|
}
|
2013-02-24 09:48:52 +03:00
|
|
|
}
|
|
|
|
}
|
2013-07-19 04:52:31 +03:00
|
|
|
|
|
|
|
public bool IsDailySeries(int tvdbid)
|
|
|
|
{
|
|
|
|
return _proxy.IsDailySeries(tvdbid);
|
|
|
|
}
|
2013-02-24 09:48:52 +03:00
|
|
|
}
|
|
|
|
}
|