Logging/Download notification tweaks.

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

@ -51,7 +51,7 @@ namespace NzbDrone.Common
} }
e.Data.Add("title", title); 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; throw;
} }
//this shouldn't log an exception since it might cause a recursive loop. //this shouldn't log an exception since it will cause a recursive loop.
logger.Error("Unable to report exception. " + e); 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> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="EpisodeParseResultTest.cs" />
<Compile Include="Integeration\ServiceIntegerationFixture.cs" /> <Compile Include="Integeration\ServiceIntegerationFixture.cs" />
<Compile Include="JobTests\BacklogSearchJobTest.cs" /> <Compile Include="JobTests\BacklogSearchJobTest.cs" />
<Compile Include="JobTests\BannerDownloadJobTest.cs" /> <Compile Include="JobTests\BannerDownloadJobTest.cs" />

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

@ -44,17 +44,23 @@ namespace NzbDrone.Core.Model
public override string ToString() public override string ToString()
{ {
if (AirDate != null && EpisodeNumbers == null)
return string.Format("{0} - {1} {2}", SeriesTitle, AirDate.Value.ToShortDateString(), Quality);
if (FullSeason) string episodeString = "[Unknown Episode]";
return string.Format("{0} - Season {1:00}", SeriesTitle, SeasonNumber);
if (EpisodeNumbers != null && EpisodeNumbers.Any()) if (AirDate != null && EpisodeNumbers == null)
return string.Format("{0} - S{1:00}E{2} {3}", SeriesTitle, SeasonNumber, {
String.Join("-", EpisodeNumbers.Select(c => c.ToString("00"))), Quality); 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 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); result = Fetch(Urls);
_logger.Info("Finished processing feeds from " + Name); _logger.Debug("Finished processing feeds from " + Name);
return result; return result;
} }

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

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

Loading…
Cancel
Save