From 9381ef83a77d433fabd74b28a95adba3f324311d Mon Sep 17 00:00:00 2001 From: Thomas <71355143+thomas694@users.noreply.github.com> Date: Tue, 19 Apr 2022 22:53:54 +0200 Subject: [PATCH] Fix issue #233/#234 Liked/by crawler not working --- src/TumblThree/SharedAssemblyInfo.cs | 4 ++-- .../Crawler/TumblrLikedByCrawler.cs | 7 ++++--- .../TumblThree.Applications/DataModels/TumblrApi/Post.cs | 6 ++++++ .../DataModels/TumblrSvc/TumblrSvcJson.cs | 6 ++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/TumblThree/SharedAssemblyInfo.cs b/src/TumblThree/SharedAssemblyInfo.cs index 1eb0758d..87135f26 100644 --- a/src/TumblThree/SharedAssemblyInfo.cs +++ b/src/TumblThree/SharedAssemblyInfo.cs @@ -12,5 +12,5 @@ [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)] -[assembly: AssemblyVersion("2.6.0.0")] -[assembly: AssemblyFileVersion("2.6.0.0")] +[assembly: AssemblyVersion("2.6.1.0")] +[assembly: AssemblyFileVersion("2.6.1.0")] diff --git a/src/TumblThree/TumblThree.Applications/Crawler/TumblrLikedByCrawler.cs b/src/TumblThree/TumblThree.Applications/Crawler/TumblrLikedByCrawler.cs index 08323459..f97ca3ae 100644 --- a/src/TumblThree/TumblThree.Applications/Crawler/TumblrLikedByCrawler.cs +++ b/src/TumblThree/TumblThree.Applications/Crawler/TumblrLikedByCrawler.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using TumblThree.Applications.DataModels; +using TumblThree.Applications.DataModels.TumblrApiJson; using TumblThree.Applications.DataModels.TumblrPosts; using TumblThree.Applications.Downloader; using TumblThree.Applications.Parser; @@ -312,8 +313,8 @@ private void AddPhotoUrlToDownloadList(string document) return; } - var post = new DataModels.TumblrApiJson.Post() { Date = DateTime.Now.ToString("R"), UnixTimestamp = (int)((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds(), Type = "", - Id = "", Tags = new List(), Slug = "", RegularTitle = "", RebloggedFromName = "", ReblogKey = "", Tumblelog = new DataModels.TumblrApiJson.TumbleLog2() { Name = "" } }; + var post = new Post() { Date = DateTime.Now.ToString("R"), DateGmt= DateTime.Now.ToString("R"), UnixTimestamp = (int)((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds(), Type = "", + Id = "", Tags = new List(), Slug = "", RegularTitle = "", RebloggedFromName = "", RebloggedRootName="", ReblogKey = "", Tumblelog = new TumbleLog2() { Name = "" } }; AddTumblrPhotoUrl(document, post); if (Blog.RegExPhotos) @@ -329,7 +330,7 @@ private void AddVideoUrlToDownloadList(string document) return; } - var post = new DataModels.TumblrApiJson.Post() { Id = "", Tumblelog = new DataModels.TumblrApiJson.TumbleLog2() { Name = "" }, + var post = new Post() { Id = "", Tumblelog = new TumbleLog2() { Name = "" }, UnixTimestamp = (int)((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds() }; AddTumblrVideoUrl(document, post); AddInlineTumblrVideoUrl(document, TumblrParser.GetTumblrVVideoUrlRegex(), TumblrParser.GetTumblrThumbnailUrlRegex()); diff --git a/src/TumblThree/TumblThree.Applications/DataModels/TumblrApi/Post.cs b/src/TumblThree/TumblThree.Applications/DataModels/TumblrApi/Post.cs index b7224802..20a06ee0 100644 --- a/src/TumblThree/TumblThree.Applications/DataModels/TumblrApi/Post.cs +++ b/src/TumblThree/TumblThree.Applications/DataModels/TumblrApi/Post.cs @@ -254,6 +254,12 @@ public class Post : ICloneable public List DownloadedFilenames { get; set; } + public Post() + { + DownloadedUrls = new List(); + DownloadedFilenames = new List(); + } + public object Clone() { return MemberwiseClone(); diff --git a/src/TumblThree/TumblThree.Applications/DataModels/TumblrSvc/TumblrSvcJson.cs b/src/TumblThree/TumblThree.Applications/DataModels/TumblrSvc/TumblrSvcJson.cs index 7e882814..b6c422ca 100644 --- a/src/TumblThree/TumblThree.Applications/DataModels/TumblrSvc/TumblrSvcJson.cs +++ b/src/TumblThree/TumblThree.Applications/DataModels/TumblrSvc/TumblrSvcJson.cs @@ -853,6 +853,12 @@ public class Post : ICloneable public List DownloadedFilenames { get; private set; } + public Post() + { + DownloadedUrls = new List(); + DownloadedFilenames = new List(); + } + public object Clone() { return MemberwiseClone();