Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
Fixes download of tagged posts
Browse files Browse the repository at this point in the history
- Fixes logical error for downloading tagged posts in the XDocument
parsing.
  • Loading branch information
johanneszab committed May 16, 2017
1 parent b963599 commit 18da527
Showing 1 changed file with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ private void AddPhotoUrlToDownloadList(XDocument document, IList<string> 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);
Expand All @@ -389,8 +389,8 @@ private void AddVideoUrlToDownloadList(XDocument document, IList<string> 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);
}
Expand All @@ -404,8 +404,8 @@ private void AddAudioUrlToDownloadList(XDocument document, IList<string> 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);
}
Expand All @@ -419,8 +419,8 @@ private void AddTextUrlToDownloadList(XDocument document, IList<string> 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));
Expand All @@ -435,8 +435,8 @@ private void AddQuoteUrlToDownloadList(XDocument document, IList<string> 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));
Expand All @@ -451,8 +451,8 @@ private void AddLinkUrlToDownloadList(XDocument document, IList<string> 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));
Expand All @@ -467,8 +467,8 @@ private void AddConversationUrlToDownloadList(XDocument document, IList<string>
{
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));
Expand All @@ -483,8 +483,8 @@ private void AddAnswerUrlToDownloadList(XDocument document, IList<string> 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));
Expand All @@ -499,8 +499,8 @@ private void AddPhotoMetaUrlToDownloadList(XDocument document, IList<string> 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));
Expand All @@ -515,8 +515,8 @@ private void AddVideoMetaUrlToDownloadList(XDocument document, IList<string> 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));
Expand All @@ -531,8 +531,8 @@ private void AddAudioMetaUrlToDownloadList(XDocument document, IList<string> 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));
Expand Down

0 comments on commit 18da527

Please sign in to comment.