private static string ParseAudioMeta(Post post)
 {
     return(string.Format(CultureInfo.CurrentCulture, Resources.PostId, post.id) + ", " +
            string.Format(CultureInfo.CurrentCulture, Resources.Date, post.date) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.UrlWithSlug, post.slug) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogKey, post.reblog_key) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogUrl, post.reblogged_from_url) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogName, post.reblogged_from_name) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.AudioCaption, post.caption) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.Id3Artist, post.artist) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.Id3Title, post.title) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.Id3Track, post.track) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.Id3Album, post.album) +
            string.Format(CultureInfo.CurrentCulture, Resources.Id3Track, post.year) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.Tags,
                          string.Join(", ", post.tags.ToArray())) +
            Environment.NewLine);
 }
 private bool CheckIfDownloadRebloggedPosts(Post post)
 {
     if (!blog.DownloadRebloggedPosts)
     {
         if (!post.reblogged_from_url.Any())
         {
             return(true);
         }
         return(false);
     }
     return(true);
 }
        private void AddVideoUrl(Post post)
        {
            string postId   = post.id;
            string videoUrl = post.video_url;

            if (shellService.Settings.VideoSize == 480)
            {
                if (!videoUrl.Contains("_480"))
                {
                    videoUrl.Replace(".mp4", "_480.mp4");
                }
            }
            AddToDownloadList(new TumblrPost(PostTypes.Video, videoUrl, postId, post.timestamp.ToString()));
        }
        private void AddPhotoUrl(Post post)
        {
            string postId = post.id;

            foreach (Photo photo in post.photos)
            {
                string imageUrl = photo.original_size.url;

                if (blog.SkipGif && imageUrl.EndsWith(".gif"))
                {
                    continue;
                }
                imageUrl = ResizeTumblrImageUrl(imageUrl);

                AddToDownloadList(new TumblrPost(PostTypes.Photo, imageUrl, postId, post.timestamp.ToString()));
            }
        }
 private static string ParseVideoMeta(Post post)
 {
     return(string.Format(CultureInfo.CurrentCulture, Resources.PostId, post.id) + ", " +
            string.Format(CultureInfo.CurrentCulture, Resources.Date, post.date) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.UrlWithSlug, post.slug) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogKey, post.reblog_key) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogUrl, post.reblogged_from_url) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogName, post.reblogged_from_name) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.VideoPlayer, post.caption) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.Tags,
                          string.Join(", ", post.tags.ToArray())) +
            Environment.NewLine);
 }
        private void AddInlineVideoUrl(Post post)
        {
            var regex = new Regex("\"(http[\\S]*.com/video_file/[\\S]*)\"");

            foreach (Match match in regex.Matches(post.body))
            {
                string videoUrl = match.Groups[1].Value;
                if (shellService.Settings.VideoSize == 1080)
                {
                    AddToDownloadList(new TumblrPost(PostTypes.Video, videoUrl.Replace("/480", "") + ".mp4", post.id, post.timestamp.ToString()));
                }
                else if (shellService.Settings.VideoSize == 480)
                {
                    AddToDownloadList(new TumblrPost(PostTypes.Video,
                                                     "https://vt.tumblr.com/" + videoUrl.Replace("/480", "").Split('/').Last() + "_480.mp4",
                                                     post.id, post.timestamp.ToString()));
                }
            }
        }
 private static string ParseConversation(Post post)
 {
     return(string.Format(CultureInfo.CurrentCulture, Resources.PostId, post.id) + ", " +
            string.Format(CultureInfo.CurrentCulture, Resources.Date, post.date) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.UrlWithSlug, post.slug) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogKey, post.reblog_key) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogUrl, post.reblogged_from_url) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogName, post.reblogged_from_name) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.Quote, string.Join(", ", post.dialogue.SelectMany(dialogue => dialogue.phrase.ToArray()))) +
            Environment.NewLine + post.body +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.Tags,
                          string.Join(", ", post.tags.ToArray())) +
            Environment.NewLine);
 }
        private void AddInlinePhotoUrl(Post post)
        {
            var regex = new Regex("\"(http[\\S]*media.tumblr.com[\\S]*(jpg|png|gif))\"");

            foreach (Match match in regex.Matches(post.body))
            {
                string postId = post.id;

                string imageUrl = match.Groups[1].Value;
                if (imageUrl.Contains("avatar") || imageUrl.Contains("previews"))
                {
                    continue;
                }
                if (blog.SkipGif && imageUrl.EndsWith(".gif"))
                {
                    continue;
                }
                AddToDownloadList(new TumblrPost(PostTypes.Photo, imageUrl, postId, post.timestamp.ToString()));
            }
        }
        private void AddPhotoUrl(Post post)
        {
            string postId = post.id;

            foreach (Photo photo in post.photos)
            {
                string imageUrl = photo.alt_sizes.Where(url => url.width == int.Parse(ImageSize())).Select(url => url.url).FirstOrDefault();
                if (imageUrl == null)
                {
                    imageUrl = photo.alt_sizes.FirstOrDefault().url;
                }

                if (blog.SkipGif && imageUrl.EndsWith(".gif"))
                {
                    continue;
                }

                AddToDownloadList(new TumblrPost(PostTypes.Photo, imageUrl, postId, post.timestamp.ToString()));
            }
        }
 private static string ParsePhotoMeta(Post post)
 {
     return(string.Format(CultureInfo.CurrentCulture, Resources.PostId, post.id) + ", " +
            string.Format(CultureInfo.CurrentCulture, Resources.Date, post.date) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.UrlWithSlug, post.slug) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogKey, post.reblog_key) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogUrl, post.reblogged_from_url) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.ReblogName, post.reblogged_from_name) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.PhotoUrl, string.Join(", ", post.photos.SelectMany(photo => photo.original_size.url.ToArray()))) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.PhotoCaption, string.Join(", ", post.photos.SelectMany(photo => photo.caption.ToArray()))) +
            Environment.NewLine +
            string.Format(CultureInfo.CurrentCulture, Resources.Tags,
                          string.Join(", ", post.tags.ToArray())) +
            Environment.NewLine);
 }