removed some warnings, logging tweaks

This commit is contained in:
kay.one 2011-05-08 14:49:15 -07:00
parent 56a13b2511
commit 34f7b9ca7d
4 changed files with 12 additions and 17 deletions

View File

@ -135,8 +135,6 @@ namespace NzbDrone.Core.Test
//Constants //Constants
const string fileName = @"WEEDS.S03E01.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi"; const string fileName = @"WEEDS.S03E01.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi";
const int seasonNumber = 3;
const int episodeNumner = 1;
const int size = 12345; const int size = 12345;
//Fakes //Fakes

View File

@ -1,23 +1,17 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Core.Providers.ExternalNotification namespace NzbDrone.Core.Providers.ExternalNotification
{ {
public class XbmcNotificationProvider : ExternalNotificationProviderBase public class XbmcNotificationProvider : ExternalNotificationProviderBase
{ {
private readonly Logger _logger;
private readonly XbmcProvider _xbmcProvider; private readonly XbmcProvider _xbmcProvider;
public XbmcNotificationProvider(ConfigProvider configProvider, XbmcProvider xbmcProvider, public XbmcNotificationProvider(ConfigProvider configProvider, XbmcProvider xbmcProvider,
ExternalNotificationProvider externalNotificationProvider) : base(configProvider, externalNotificationProvider) ExternalNotificationProvider externalNotificationProvider)
: base(configProvider, externalNotificationProvider)
{ {
_xbmcProvider = xbmcProvider; _xbmcProvider = xbmcProvider;
_logger = LogManager.GetLogger(GetType().ToString());
} }
public override string Name public override string Name
@ -27,13 +21,13 @@ namespace NzbDrone.Core.Providers.ExternalNotification
public override void OnGrab(string message) public override void OnGrab(string message)
{ {
var header = "NzbDrone [TV] - Grabbed"; const string header = "NzbDrone [TV] - Grabbed";
if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true))) if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)))
{ {
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true))) if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true)))
{ {
_logger.Trace("Sending Notifcation to XBMC"); _logger.Trace("Sending Notification to XBMC");
_xbmcProvider.Notify(header, message); _xbmcProvider.Notify(header, message);
return; return;
} }
@ -45,13 +39,13 @@ namespace NzbDrone.Core.Providers.ExternalNotification
public override void OnDownload(string message, int seriesId) public override void OnDownload(string message, int seriesId)
{ {
var header = "NzbDrone [TV] - Downloaded"; const string header = "NzbDrone [TV] - Downloaded";
if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true))) if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)))
{ {
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true))) if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true)))
{ {
_logger.Trace("Sending Notifcation to XBMC"); _logger.Trace("Sending Notification to XBMC");
_xbmcProvider.Notify(header, message); _xbmcProvider.Notify(header, message);
} }
@ -73,11 +67,11 @@ namespace NzbDrone.Core.Providers.ExternalNotification
public override void OnRename(string message, int seriesId) public override void OnRename(string message, int seriesId)
{ {
var header = "NzbDrone [TV] - Renamed"; const string header = "NzbDrone [TV] - Renamed";
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true))) if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true)))
{ {
_logger.Trace("Sending Notifcation to XBMC"); _logger.Trace("Sending Notification to XBMC");
_xbmcProvider.Notify(header, message); _xbmcProvider.Notify(header, message);
} }

View File

@ -180,6 +180,7 @@ namespace NzbDrone.Core.Providers.Indexer
if (!_sabProvider.AddByUrl(NzbDownloadUrl(feedItem), sabTitle)) if (!_sabProvider.AddByUrl(NzbDownloadUrl(feedItem), sabTitle))
{ {
_logger.Warn("Unable to add item to SAB queue. {0} {1}", NzbDownloadUrl(feedItem), sabTitle);
return; return;
} }
} }

View File

@ -42,11 +42,13 @@ namespace NzbDrone.Core.Providers
Logger.Info("Adding report [{0}] to the queue.", title); Logger.Info("Adding report [{0}] to the queue.", title);
string response = _httpProvider.DownloadString(request).Replace("\n", String.Empty); string response = _httpProvider.DownloadString(request).Replace("\n", String.Empty);
Logger.Debug("Queue Repsonse: [{0}]", response); Logger.Debug("Queue Response: [{0}]", response);
if (response == "ok") if (response == "ok")
return true; return true;
Logger.Warn("SAB returned unexpected response '{0}'", response);
return false; return false;
} }