Better parser logging.

pull/4/head
kay.one 13 years ago
parent 1e580856ca
commit 78268f3c58

@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test
parseResults.Should().NotBeEmpty();
parseResults.Should().OnlyContain(s => s.Indexer == mockIndexer.Name);
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.OriginalString));
ExceptionVerification.ExpectedWarns(warns);
}
@ -115,7 +115,7 @@ namespace NzbDrone.Core.Test
parseResults.Should().NotBeEmpty();
parseResults.Should().OnlyContain(s => s.Indexer == newzbinProvider.Name);
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.OriginalString));
ExceptionVerification.MarkInconclusive(typeof(WebException));
ExceptionVerification.IgnoreWarns();

@ -65,6 +65,7 @@ namespace NzbDrone.Core.Test
result.SeasonNumber.Should().Be(seasonNumber);
result.EpisodeNumbers.First().Should().Be(episodeNumber);
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
result.OriginalString.Should().Be(postTitle);
}
[Test]
@ -84,6 +85,7 @@ namespace NzbDrone.Core.Test
result.EpisodeNumbers.Should().HaveCount(1);
result.SeasonNumber.Should().Be(season);
result.EpisodeNumbers[0].Should().Be(episode);
result.OriginalString.Should().Be(path);
ExceptionVerification.IgnoreWarns();
}
@ -162,6 +164,7 @@ namespace NzbDrone.Core.Test
result.EpisodeNumbers.Should().BeEquivalentTo(result.EpisodeNumbers);
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
result.EpisodeNumbers.Count.Should().Be(count);
result.OriginalString.Should().Be(postTitle);
}
@ -178,7 +181,8 @@ namespace NzbDrone.Core.Test
var airDate = new DateTime(year, month, day);
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
result.AirDate.Should().Be(airDate);
Assert.IsNull(result.EpisodeNumbers);
result.EpisodeNumbers.Should().BeNull();
result.OriginalString.Should().Be(postTitle);
}
[Test]
@ -203,6 +207,7 @@ namespace NzbDrone.Core.Test
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
result.EpisodeNumbers.Count.Should().Be(0);
result.FullSeason.Should().BeTrue();
result.OriginalString.Should().Be(postTitle);
}
[TestCase("Conan", "conan")]
@ -342,6 +347,7 @@ namespace NzbDrone.Core.Test
result.CleanTitle.Should().Be(Parser.NormalizeTitle(seriesName));
result.SeasonNumber.Should().Be(seasonNumber);
result.FullSeason.Should().BeTrue();
result.OriginalString.Should().Be(postTitle);
}
[TestCase("5.64 GB", 6055903887)]

@ -29,7 +29,7 @@ namespace NzbDrone.Core.Model
public string NzbUrl { get; set; }
public string NzbTitle { get; set; }
public string OriginalString { get; set; }
public Series Series { get; set; }
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Model
return string.Format("{0} - S{1:00}E{2} {3}", SeriesTitle, SeasonNumber,
String.Join("-", EpisodeNumbers), Quality);
return NzbTitle;
return OriginalString;
}
}

@ -77,6 +77,8 @@ namespace NzbDrone.Core
result = ParseTitle(fileInfo.FullName);
}
result.OriginalString = path;
return result;
}
@ -102,6 +104,7 @@ namespace NzbDrone.Core
result.Language = ParseLanguage(title);
result.Quality = ParseQuality(title);
result.OriginalString = title;
return result;
}
}
@ -313,8 +316,8 @@ namespace NzbDrone.Core
return result;
}
if ((normalizedName.Contains("sdtv") ||
(result.QualityType == QualityTypes.Unknown && normalizedName.Contains("hdtv"))) &&
if ((normalizedName.Contains("sdtv") ||
(result.QualityType == QualityTypes.Unknown && normalizedName.Contains("hdtv"))) &&
!normalizedName.Contains("mpeg"))
{
result.QualityType = QualityTypes.SDTV;

@ -49,7 +49,7 @@ namespace NzbDrone.Core.Providers
history.Indexer = parseResult.Indexer;
history.IsProper = parseResult.Quality.Proper;
history.Quality = parseResult.Quality.QualityType;
history.NzbTitle = parseResult.NzbTitle;
history.NzbTitle = parseResult.OriginalString;
history.EpisodeId = episode.EpisodeId;
history.SeriesId = episode.SeriesId;

@ -133,7 +133,7 @@ namespace NzbDrone.Core.Providers
if (!parseResult.Series.IsDaily)
{
//Todo: Collect this as a Series we want to treat as a daily series, or possible parsing error
Logger.Warn("Found daily-style episode for non-daily series: {0}. {1}", parseResult.Series.Title, parseResult.NzbTitle);
Logger.Warn("Found daily-style episode for non-daily series: {0}. {1}", parseResult.Series.Title, parseResult.OriginalString);
return new List<Episode>();
}
@ -141,7 +141,7 @@ namespace NzbDrone.Core.Providers
if (episodeInfo == null && autoAddNew)
{
Logger.Info("Episode {0} doesn't exist in db. adding it now. {1}", parseResult, parseResult.NzbTitle);
Logger.Info("Episode {0} doesn't exist in db. adding it now. {1}", parseResult, parseResult.OriginalString);
episodeInfo = new Episode
{
SeriesId = parseResult.Series.SeriesId,
@ -193,7 +193,7 @@ namespace NzbDrone.Core.Providers
//if still null we should add the temp episode
if (episodeInfo == null && autoAddNew)
{
Logger.Info("Episode {0} doesn't exist in db. adding it now. {1}", parseResult, parseResult.NzbTitle);
Logger.Info("Episode {0} doesn't exist in db. adding it now. {1}", parseResult, parseResult.OriginalString);
episodeInfo = new Episode
{
SeriesId = parseResult.Series.SeriesId,

@ -177,7 +177,7 @@ namespace NzbDrone.Core.Providers.Indexer
{
parsedEpisode.NzbUrl = NzbDownloadUrl(item);
parsedEpisode.Indexer = Name;
parsedEpisode.NzbTitle = item.Title.Text;
parsedEpisode.OriginalString = item.Title.Text;
result.Add(parsedEpisode);
}
}

Loading…
Cancel
Save