2013-05-20 01:17:32 +02:00
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Notifications.Xbmc
|
|
|
|
|
{
|
2013-05-20 04:43:22 +02:00
|
|
|
|
public class Xbmc : NotificationBase<XbmcSettings>
|
2013-05-20 01:17:32 +02:00
|
|
|
|
{
|
2013-06-12 08:45:25 +02:00
|
|
|
|
private readonly IXbmcService _xbmcProvider;
|
2013-05-20 01:17:32 +02:00
|
|
|
|
|
2013-06-12 08:45:25 +02:00
|
|
|
|
public Xbmc(IXbmcService xbmcProvider, Logger logger)
|
2013-05-20 01:17:32 +02:00
|
|
|
|
{
|
|
|
|
|
_xbmcProvider = xbmcProvider;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "XBMC"; }
|
2013-06-13 08:41:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ImplementationName
|
|
|
|
|
{
|
|
|
|
|
get { return "XBMC"; }
|
2013-07-27 22:57:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string Link
|
|
|
|
|
{
|
|
|
|
|
get { return "http://xbmc.org/"; }
|
2013-05-20 01:17:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnGrab(string message)
|
|
|
|
|
{
|
|
|
|
|
const string header = "NzbDrone [TV] - Grabbed";
|
|
|
|
|
|
2013-05-20 06:19:54 +02:00
|
|
|
|
if (Settings.Notify)
|
|
|
|
|
{
|
|
|
|
|
_xbmcProvider.Notify(Settings, header, message);
|
|
|
|
|
}
|
2013-05-20 01:17:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnDownload(string message, Series series)
|
|
|
|
|
{
|
|
|
|
|
const string header = "NzbDrone [TV] - Downloaded";
|
|
|
|
|
|
2013-05-20 06:19:54 +02:00
|
|
|
|
if (Settings.Notify)
|
|
|
|
|
{
|
|
|
|
|
_xbmcProvider.Notify(Settings, header, message);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-20 01:17:32 +02:00
|
|
|
|
UpdateAndClean(series);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void AfterRename(Series series)
|
|
|
|
|
{
|
|
|
|
|
UpdateAndClean(series);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void UpdateAndClean(Series series)
|
|
|
|
|
{
|
|
|
|
|
if (Settings.UpdateLibrary)
|
|
|
|
|
{
|
|
|
|
|
_xbmcProvider.Update(Settings, series);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Settings.CleanLibrary)
|
|
|
|
|
{
|
|
|
|
|
_xbmcProvider.Clean(Settings);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|