Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
vDeggial committed Dec 19, 2014
1 parent 34f6224 commit 0481a91
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Tumbl Tool/Image Ripper/ImageRipper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void generateImageListForDownload(HashSet<TumblrPost> posts)
removeHash.UnionWith(new HashSet<PhotoPostImage>((from p in imageList where p.filename.ToLower().EndsWith(".png") select p)));
}

this.imageList.RemoveWhere(x => removeHash.Any(y => x.filename == y.filename));
this.imageList.RemoveWhere(x => removeHash.Contains(x));
}

public HashSet<TumblrPost> getTumblrPostList(int start = 0)
Expand All @@ -160,9 +160,10 @@ public HashSet<TumblrPost> getTumblrPostList(int start = 0)
query = JSONHelper.getQueryString(this.tumblrDomain, tumblrPostTypes.photo.ToString(), start);
}

if (this.crawlManager.isValidTumblr(@query))
this.crawlManager.getDocument(query);

if (this.crawlManager.jsonDocument != null)
{
this.crawlManager.getDocument(query);
HashSet<TumblrPost> posts = crawlManager.getPostList(tumblrPostTypes.photo.ToString(), apiMode);
return posts;
}
Expand Down Expand Up @@ -260,9 +261,9 @@ public TumblrBlog parseBlogPosts(int parseMode)
{
HashSet<TumblrPost> posts = getTumblrPostList(i);

HashSet<TumblrPost> existingHash = new HashSet<TumblrPost>((from p in posts where this.existingImageList.Any(s => s.ToLower() == p.photos.First().filename.ToLower()) select p));
HashSet<TumblrPost> existingHash = new HashSet<TumblrPost>((from p in posts where this.existingImageList.Contains(p.photos.First().filename.ToLower()) select p));

posts.RemoveWhere(x => existingHash.Any(y => x.id == y.id));
posts.RemoveWhere(x => existingHash.Contains(x));

this.blog.posts.UnionWith(posts);
this.parsedPosts += posts.Count;
Expand Down
10 changes: 10 additions & 0 deletions Tumbl Tool/Managers/CrawlManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ public void getJSONDocument(string url)
try
{
this.jsonDocument = JSONHelper.getJSONObject(url);

if ((this.jsonDocument != null && this.jsonDocument.meta != null && this.jsonDocument.meta.status == ((int)tumblrAPIResponseEnum.OK).ToString()))
{

}

else
{
this.jsonDocument = null;
}
}
catch
{
Expand Down

0 comments on commit 0481a91

Please sign in to comment.