public void Get_files_to_download() { var contentMatcher = new ShowMatcher("Test 123"); string[] downloadedLinks = { "rabble123", "rabble321" }; var feed = new RssFeed(); feed.Items = new List <RssItem>() { new RssItem() { Link = "rabble444", Title = "Test 123 - S01E02.1080P" }, new RssItem() { Link = "rabble321", Title = "Test 123 - S01E03.1080P" } }; var downloader = new RssDownloader(feed, "", "", contentMatcher); downloader.DownloadedLinks = downloadedLinks.ToList(); var filesToDownload = downloader.UrlToDownload(); Assert.AreEqual(1, filesToDownload.Count); Assert.IsTrue(filesToDownload.First() == "rabble444"); }
public void Show_content_matching() { var show = "The Truman Show"; var matcher = new ShowMatcher(show, new RegexContentMatcher(".mkv|.png")); Assert.IsFalse(matcher.Match(@"C:\temp\The.Walking.Dead S01E03.mkv")); Assert.IsTrue(matcher.Match(@"C:\temp\The.Truman.Show[S01E03] EclipseSwag 720p.mkv")); }
public static IContentMatcher ParseContentMatch(XElement matcherElement) { switch (matcherElement.Name.LocalName.ToLower()) { case "showmatcher": ShowMatcher matcher = GetShowMatcher(matcherElement); return(matcher); case "filematcher": FileMatcher filematcher = GetFileMatcher(matcherElement); return(filematcher); default: throw new NotImplementedException(); } }