Logging/Download notification tweaks.

pull/19/head
kay.one 13 years ago
parent e0f901dbe7
commit 7e38afc838

@ -51,7 +51,7 @@ namespace NzbDrone.Common
}
e.Data.Add("title", title);
logger.ErrorException("Unable to report parse error", e);
logger.InfoException("Unable to report parse error", e);
}
}
@ -77,8 +77,8 @@ namespace NzbDrone.Common
throw;
}
//this shouldn't log an exception since it might cause a recursive loop.
logger.Error("Unable to report exception. " + e);
//this shouldn't log an exception since it will cause a recursive loop.
logger.Info("Unable to report exception. " + e);
}
}
}

@ -0,0 +1,134 @@
using System;
using System.Collections.Generic;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test
{
[TestFixture]
// ReSharper disable InconsistentNaming
public class EpisodeParseResultTest : CoreTest
{
[Test]
public void tostring_single_season_episode()
{
var parseResult = new EpisodeParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3 };
parseResult.FullSeason = false;
parseResult.AirDate = null;
parseResult.Quality = new Quality(QualityTypes.HDTV, false);
parseResult.ToString().Should().Be("My Series - S12E03 HDTV");
}
[Test]
public void tostring_single_season_episode_proper()
{
var parseResult = new EpisodeParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3 };
parseResult.FullSeason = false;
parseResult.AirDate = null;
parseResult.Quality = new Quality(QualityTypes.HDTV, true);
parseResult.ToString().Should().Be("My Series - S12E03 HDTV [proper]");
}
[Test]
public void tostring_multi_season_episode()
{
var parseResult = new EpisodeParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 };
parseResult.FullSeason = false;
parseResult.AirDate = null;
parseResult.Quality = new Quality(QualityTypes.HDTV, false);
parseResult.ToString().Should().Be("My Series - S12E03-04-05 HDTV");
}
[Test]
public void tostring_multi_season_episode_proper()
{
var parseResult = new EpisodeParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 };
parseResult.FullSeason = false;
parseResult.AirDate = null;
parseResult.Quality = new Quality(QualityTypes.HDTV, true);
parseResult.ToString().Should().Be("My Series - S12E03-04-05 HDTV [proper]");
}
[Test]
public void tostring_full_season()
{
var parseResult = new EpisodeParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
parseResult.AirDate = null;
parseResult.Quality = new Quality(QualityTypes.HDTV, false);
parseResult.ToString().Should().Be("My Series - Season 12 HDTV");
}
[Test]
public void tostring_full_season_proper()
{
var parseResult = new EpisodeParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
parseResult.AirDate = null;
parseResult.Quality = new Quality(QualityTypes.HDTV, true);
parseResult.ToString().Should().Be("My Series - Season 12 HDTV [proper]");
}
[Test]
public void tostring_daily_show()
{
var parseResult = new EpisodeParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
parseResult.AirDate = new DateTime(2010, 12, 30);
parseResult.Quality = new Quality(QualityTypes.HDTV, false);
parseResult.ToString().Should().Be("My Series - 2010-12-30 HDTV");
}
[Test]
public void tostring_daily_show_proper()
{
var parseResult = new EpisodeParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
parseResult.AirDate = new DateTime(2010, 12, 30);
parseResult.Quality = new Quality(QualityTypes.HDTV, true);
parseResult.ToString().Should().Be("My Series - 2010-12-30 HDTV [proper]");
}
}
}

@ -109,6 +109,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="EpisodeParseResultTest.cs" />
<Compile Include="Integeration\ServiceIntegerationFixture.cs" />
<Compile Include="JobTests\BacklogSearchJobTest.cs" />
<Compile Include="JobTests\BannerDownloadJobTest.cs" />

@ -84,6 +84,8 @@ namespace NzbDrone.Core.Jobs
notification.CurrentMessage = "RSS Sync Completed";
Logger.Info("RSS Sync completed");
}
}
}

@ -44,17 +44,23 @@ namespace NzbDrone.Core.Model
public override string ToString()
{
if (AirDate != null && EpisodeNumbers == null)
return string.Format("{0} - {1} {2}", SeriesTitle, AirDate.Value.ToShortDateString(), Quality);
if (FullSeason)
return string.Format("{0} - Season {1:00}", SeriesTitle, SeasonNumber);
string episodeString = "[Unknown Episode]";
if (EpisodeNumbers != null && EpisodeNumbers.Any())
return string.Format("{0} - S{1:00}E{2} {3}", SeriesTitle, SeasonNumber,
String.Join("-", EpisodeNumbers.Select(c => c.ToString("00"))), Quality);
if (AirDate != null && EpisodeNumbers == null)
{
episodeString = string.Format("{0}", AirDate.Value.ToString("yyyy-MM-dd"));
}
else if (FullSeason)
{
episodeString = string.Format("Season {0:00}", SeasonNumber);
}
else if (EpisodeNumbers != null && EpisodeNumbers.Any())
{
episodeString = string.Format("S{0:00}E{1}",SeasonNumber, String.Join("-", EpisodeNumbers.Select(c => c.ToString("00"))));
}
return "[Invalid format]";
return string.Format("{0} - {1} {2}", SeriesTitle, episodeString, Quality);
}
}

@ -231,7 +231,7 @@ namespace NzbDrone.Core.Providers
}
else
{
logger.Debug("Unable to find {0}-S{1:00}E{2:00}", parseResult.Series.Title, parseResult.SeasonNumber, episodeNumber);
logger.Debug("Unable to find {0}", parseResult);
}
}

@ -93,7 +93,7 @@ namespace NzbDrone.Core.Providers.Indexer
result = Fetch(Urls);
_logger.Info("Finished processing feeds from " + Name);
_logger.Debug("Finished processing feeds from " + Name);
return result;
}

@ -275,10 +275,7 @@ namespace NzbDrone.Core.Providers
{
if (_downloadProvider.DownloadReport(episodeParseResult))
{
notification.CurrentMessage =
String.Format("{0} - S{1:00}E{2:00} {3} Added to download queue",
episodeParseResult.Series.Title, episodeParseResult.SeasonNumber,
episodeParseResult.EpisodeNumbers[0], episodeParseResult.Quality);
notification.CurrentMessage = String.Format("{0} Added to download queue", episodeParseResult);
//Add the list of episode numbers from this release
successes.AddRange(episodeParseResult.EpisodeNumbers);

@ -117,6 +117,7 @@ hr
font-weight: 100;
height: 135px;
background: url(images/header.jpg) no-repeat left top;
background-color: #065EFE;
font-size: 90px;
color: #FFFFFF;
text-transform: lowercase;

Loading…
Cancel
Save