2012-10-18 04:15:42 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Core.Helpers;
|
2013-03-05 05:20:47 +00:00
|
|
|
|
using NzbDrone.Core.Jobs.Framework;
|
2012-10-18 04:15:42 +00:00
|
|
|
|
using NzbDrone.Core.Model.Notification;
|
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Jobs
|
|
|
|
|
{
|
|
|
|
|
public class XemUpdateJob : IJob
|
|
|
|
|
{
|
|
|
|
|
private readonly XemProvider _xemProvider;
|
|
|
|
|
|
|
|
|
|
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
|
|
|
|
public XemUpdateJob(XemProvider xemProvider)
|
|
|
|
|
{
|
|
|
|
|
_xemProvider = xemProvider;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public XemUpdateJob()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "XEM Update"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TimeSpan DefaultInterval
|
|
|
|
|
{
|
|
|
|
|
get { return TimeSpan.FromHours(12); }
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-20 23:07:04 +00:00
|
|
|
|
public virtual void Start(ProgressNotification notification, dynamic options)
|
2012-10-18 04:15:42 +00:00
|
|
|
|
{
|
2012-10-20 23:07:04 +00:00
|
|
|
|
if (options == null || options.SeriesId == 0)
|
2012-10-18 04:15:42 +00:00
|
|
|
|
{
|
|
|
|
|
_logger.Trace("Starting XEM Update for all series");
|
|
|
|
|
_xemProvider.UpdateMappings();
|
|
|
|
|
}
|
2012-10-18 06:49:53 +00:00
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
2012-10-20 23:07:04 +00:00
|
|
|
|
_logger.Trace("Starting XEM Update for series: {0}", options.SeriesId);
|
2013-02-22 23:55:43 +00:00
|
|
|
|
_xemProvider.UpdateMappings((int)options.SeriesId);
|
2012-10-18 06:49:53 +00:00
|
|
|
|
}
|
2013-02-22 23:55:43 +00:00
|
|
|
|
|
2012-10-18 04:15:42 +00:00
|
|
|
|
_logger.Trace("XEM Update complete");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|