From 18da527698e0e23c8f837b9039921f3355a63040 Mon Sep 17 00:00:00 2001 From: Johannes Meyer zum Alten Borgloh Date: Tue, 16 May 2017 07:04:44 +0200 Subject: [PATCH] Fixes download of tagged posts - Fixes logical error for downloading tagged posts in the XDocument parsing. --- .../Downloader/TumblrDownloader.cs | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/TumblThree/TumblThree.Applications/Downloader/TumblrDownloader.cs b/src/TumblThree/TumblThree.Applications/Downloader/TumblrDownloader.cs index 8a7d10c..f24737d 100644 --- a/src/TumblThree/TumblThree.Applications/Downloader/TumblrDownloader.cs +++ b/src/TumblThree/TumblThree.Applications/Downloader/TumblrDownloader.cs @@ -364,8 +364,8 @@ private void AddPhotoUrlToDownloadList(XDocument document, IList tags) { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "photo" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "photo" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { AddPhotoUrl(post); AddPhotoSetUrl(post); @@ -389,8 +389,8 @@ private void AddVideoUrlToDownloadList(XDocument document, IList tags) { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "video" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "video" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { AddVideoUrl(post); } @@ -404,8 +404,8 @@ private void AddAudioUrlToDownloadList(XDocument document, IList tags) { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "audio" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "audio" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { AddAudioUrl(post); } @@ -419,8 +419,8 @@ private void AddTextUrlToDownloadList(XDocument document, IList tags) { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "regular" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "regular" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { string textBody = ParseText(post); AddToDownloadList(Tuple.Create(PostTypes.Text, textBody, post.Attribute("id").Value)); @@ -435,8 +435,8 @@ private void AddQuoteUrlToDownloadList(XDocument document, IList tags) { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "quote" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "quote" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { string textBody = ParseQuote(post); AddToDownloadList(Tuple.Create(PostTypes.Quote, textBody, post.Attribute("id").Value)); @@ -451,8 +451,8 @@ private void AddLinkUrlToDownloadList(XDocument document, IList tags) { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "link" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "link" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { string textBody = ParseLink(post); AddToDownloadList(Tuple.Create(PostTypes.Link, textBody, post.Attribute("id").Value)); @@ -467,8 +467,8 @@ private void AddConversationUrlToDownloadList(XDocument document, IList { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "conversation" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "conversation" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { string textBody = ParseConversation(post); AddToDownloadList(Tuple.Create(PostTypes.Conversation, textBody, post.Attribute("id").Value)); @@ -483,8 +483,8 @@ private void AddAnswerUrlToDownloadList(XDocument document, IList tags) { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "answer" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "answer" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { string textBody = ParseAnswer(post); AddToDownloadList(Tuple.Create(PostTypes.Answer, textBody, post.Attribute("id").Value)); @@ -499,8 +499,8 @@ private void AddPhotoMetaUrlToDownloadList(XDocument document, IList tag { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "photo" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "photo" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { string textBody = ParsePhotoMeta(post); AddToDownloadList(Tuple.Create(PostTypes.PhotoMeta, textBody, post.Attribute("id").Value)); @@ -515,8 +515,8 @@ private void AddVideoMetaUrlToDownloadList(XDocument document, IList tag { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "video" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "video" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { string textBody = ParseVideoMeta(post); AddToDownloadList(Tuple.Create(PostTypes.VideoMeta, textBody, post.Attribute("id").Value)); @@ -531,8 +531,8 @@ private void AddAudioMetaUrlToDownloadList(XDocument document, IList tag { foreach (XElement post in document.Descendants("post")) { - if (post.Attribute("type").Value == "audio" && (!tags.Any()) || - post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase))) + if (post.Attribute("type").Value == "audio" && (!tags.Any() || + post.Descendants("tag").Any(x => tags.Contains(x.Value, StringComparer.OrdinalIgnoreCase)))) { string textBody = ParseAudioMeta(post); AddToDownloadList(Tuple.Create(PostTypes.AudioMeta, textBody, post.Attribute("id").Value));