mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
Better parser logging.
This commit is contained in:
parent
1e580856ca
commit
78268f3c58
@ -55,7 +55,7 @@ public void parse_feed_xml(string fileName, int warns)
|
||||
|
||||
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 @@ public void newzbin_rss_fetch()
|
||||
|
||||
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 @@ public void ParseTitle_single(string postTitle, string title, int seasonNumber,
|
||||
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 @@ public void PathParse_tests(string path, int season, int episode)
|
||||
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 @@ public void TitleParse_multi(string postTitle, string title, int season, int[] e
|
||||
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 @@ public void parse_daily_episodes(string postTitle, string title, int year, int m
|
||||
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 @@ public void full_season_release_parse(string postTitle, string title, int season
|
||||
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 @@ public void parse_season_info(string postTitle, string seriesName, int seasonNum
|
||||
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 @@ public string CleanTitle
|
||||
|
||||
public string NzbUrl { get; set; }
|
||||
|
||||
public string NzbTitle { get; set; }
|
||||
public string OriginalString { get; set; }
|
||||
|
||||
public Series Series { get; set; }
|
||||
|
||||
@ -48,7 +48,7 @@ public override string ToString()
|
||||
return string.Format("{0} - S{1:00}E{2} {3}", SeriesTitle, SeasonNumber,
|
||||
String.Join("-", EpisodeNumbers), Quality);
|
||||
|
||||
return NzbTitle;
|
||||
return OriginalString;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ internal static EpisodeParseResult ParsePath(string path)
|
||||
result = ParseTitle(fileInfo.FullName);
|
||||
}
|
||||
|
||||
result.OriginalString = path;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -102,6 +104,7 @@ internal static EpisodeParseResult ParseTitle(string title)
|
||||
|
||||
result.Language = ParseLanguage(title);
|
||||
result.Quality = ParseQuality(title);
|
||||
result.OriginalString = title;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -313,8 +316,8 @@ internal static Quality ParseQuality(string name)
|
||||
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 @@ public virtual bool DownloadReport(EpisodeParseResult parseResult)
|
||||
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 @@ public virtual IList<Episode> GetEpisodesByParseResult(EpisodeParseResult parseR
|
||||
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 @@ public virtual IList<Episode> GetEpisodesByParseResult(EpisodeParseResult parseR
|
||||
|
||||
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 @@ public virtual IList<Episode> GetEpisodesByParseResult(EpisodeParseResult parseR
|
||||
//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 @@ private List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
|
||||
{
|
||||
parsedEpisode.NzbUrl = NzbDownloadUrl(item);
|
||||
parsedEpisode.Indexer = Name;
|
||||
parsedEpisode.NzbTitle = item.Title.Text;
|
||||
parsedEpisode.OriginalString = item.Title.Text;
|
||||
result.Add(parsedEpisode);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user