protected static void AddDownloadedMedia(string url, string filename, TumblrSvcJson.Post post)
 {
     if (post == null)
     {
         throw new ArgumentNullException(nameof(post));
     }
     post.DownloadedFilenames.Add(filename);
     post.DownloadedUrls.Add(url);
 }
示例#2
0
 protected string BuildFileName(string url, TumblrSvcJson.Post post, int index)
 {
     if (post == null)
     {
         post = new TumblrSvcJson.Post()
         {
             Date = DateTime.MinValue.ToString("yyyyMMddHHmmss"), Type = "", Id = "",
             Tags = new List <string>(), Slug = "", Title = "", RebloggedFromName = "", ReblogKey = ""
         };
     }
     return(BuildFileNameCore(url, post.Date, post.Timestamp, index, post.Type, post.Id, post.Tags, post.Slug, post.Title, post.RebloggedFromName, post.ReblogKey));
 }
 protected static Post ConvertTumblrApiJson(TumblrSvcJson.Post p)
 {
     return(new Post()
     {
         DateGmt = p.Date,
         UnixTimestamp = p.Timestamp,
         Type = p.Type,
         Id = p.Id,
         Tags = new List <string>(p.Tags),
         Slug = p.Slug,
         RegularTitle = p.Title,
         RebloggedFromName = p.RebloggedFromName,
         RebloggedRootName = p.RebloggedRootName,
         ReblogKey = p.ReblogKey,
         Tumblelog = new TumbleLog2()
         {
             Name = p.Tumblelog
         },
         DownloadedFilenames = p.DownloadedFilenames?.Select(s => string.Copy(s)).ToList(),
         DownloadedUrls = p.DownloadedUrls?.Select(s => string.Copy(s)).ToList()
     });
 }
 private static DateTime GetDate(TumblrSvcJson.Post post)
 {
     return(DateTime.Parse(post.Date));
 }
        protected string BuildFileName(string url, TumblrSvcJson.Post post, int index)
        {
            var type = post?.Type ?? "";

            return(BuildFileName(url, post, type, index));
        }