public void ShouldGiveBiggerWeightToRightmostKeyword() { var extraction = new Keywords(new File(@"C:\Media\lost.102.avi")); Assert.AreEqual(2, extraction.List.Count); Assert.AreEqual(2, extraction.List.First(k => k.Guess.CleanString == "lost").Weight); Assert.AreEqual(1, extraction.List.First(k => k.Guess.CleanString == "media").Weight); }
public void ShouldExtractKeywordsThatAreNumericOnly() { var extraction = new Keywords(new File(@"C:\Media\24\102.avi")); Assert.AreEqual(2, extraction.List.Count); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "24")); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "media")); }
public void ShouldExtractKeywordsFromPath() { var extraction = new Keywords(new File(@"C:\Media\Lost\102.avi")); Assert.AreEqual(2, extraction.List.Count); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "lost")); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "media")); }
public void ShouldAddUpWeightsOfRepeatedKeywords() { var extraction = new Keywords(new File(@"C:\Media\Lost\lost.102.avi")); Assert.AreEqual(2, extraction.List.Count); Assert.AreEqual(5, extraction.List.First(k => k.Guess.CleanString == "lost").Weight); Assert.AreEqual(1, extraction.List.First(k => k.Guess.CleanString == "media").Weight); }
public void ShouldExtractKeywordsFromPathAndFilenameWhenTheyAreNumericOnly() { var extraction = new Keywords(new File(@"C:\Media\Shows\24 - 102.avi")); Assert.AreEqual(3, extraction.List.Count); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "24")); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "shows")); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "media")); }
public void IdentifyShow(File file) { file.ShowMatches.Clear(); var extraction = new Keywords(file); foreach (var keyword in extraction.List) { IdentifyShow(file, keyword.Guess, keyword.Weight, extraction); } }
private void IdentifyShow(File file, FuzzyString showName, int keywordWeight, Keywords keywords) { var shows = this.Database.GetShows(); var showMatches = shows.Select(s => new WeightedGuess<Show>(s, s.Name.GetSimilarity(showName)) ) .Where(s => s.Weight >= (int) FuzzyString.Resemblance.VerySimilar); foreach (var entry in showMatches) { entry.Weight *= keywordWeight; file.ShowMatches.Add(entry); } }
public void ShouldReturnUniqueKeywordsEvenWhenPresentMultipleTimes() { var extraction = new Keywords(new File(@"C:\Media\Lost\lost.102.avi")); Assert.AreEqual(2, extraction.List.Count); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "lost")); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "media")); }
public void ShouldNotConsiderSeasonFoldersAsKeywords() { var extraction = new Keywords(new File(@"C:\Media\Lost\Season 2\lost.202.avi")); Assert.AreEqual(2, extraction.List.Count); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "lost")); Assert.True(extraction.List.Exists(k => k.Guess.CleanString == "media")); }
public void ShouldIgnoreCommonNoiseWords() { var extraction = new Keywords(new File(@"C:\TV shows\Lost\102.dvdrip.hd.avi")); Assert.False(extraction.List.Exists(k => k.Guess.CleanString == "dvdrip")); Assert.False(extraction.List.Exists(k => k.Guess.CleanString == "hd")); }