2013-05-19 23:17:32 +00:00
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Notifications.Xbmc
|
|
|
|
|
{
|
2013-05-20 02:43:22 +00:00
|
|
|
|
public class Xbmc : NotificationBase<XbmcSettings>
|
2013-05-19 23:17:32 +00:00
|
|
|
|
{
|
|
|
|
|
private readonly XbmcProvider _xbmcProvider;
|
|
|
|
|
|
|
|
|
|
public Xbmc(XbmcProvider xbmcProvider, Logger logger)
|
|
|
|
|
{
|
|
|
|
|
_xbmcProvider = xbmcProvider;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "XBMC"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnGrab(string message)
|
|
|
|
|
{
|
|
|
|
|
const string header = "NzbDrone [TV] - Grabbed";
|
|
|
|
|
|
|
|
|
|
_xbmcProvider.Notify(Settings, header, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnDownload(string message, Series series)
|
|
|
|
|
{
|
|
|
|
|
const string header = "NzbDrone [TV] - Downloaded";
|
|
|
|
|
|
|
|
|
|
_xbmcProvider.Notify(Settings, header, message);
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|