diff --git a/ShareX.HelpersLib/ShareX.HelpersLib.csproj b/ShareX.HelpersLib/ShareX.HelpersLib.csproj index e5a84d266..245e452eb 100644 --- a/ShareX.HelpersLib/ShareX.HelpersLib.csproj +++ b/ShareX.HelpersLib/ShareX.HelpersLib.csproj @@ -56,6 +56,10 @@ False ..\packages\QrCode.Net.0.4.0.0\lib\net40\Gma.QrCodeNet.Encoding.dll + + ..\..\TDMaker\packages\MegaApiClient.1.1.1\lib\net40\MegaApiClient.dll + True + ..\packages\Newtonsoft.Json.7.0.1\lib\net40\Newtonsoft.Json.dll True @@ -906,6 +910,7 @@ + diff --git a/ShareX.HelpersLib/app.config b/ShareX.HelpersLib/app.config new file mode 100644 index 000000000..195db1f42 --- /dev/null +++ b/ShareX.HelpersLib/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ShareX.HelpersLib/packages.config b/ShareX.HelpersLib/packages.config index e28f1d054..66479f5c3 100644 --- a/ShareX.HelpersLib/packages.config +++ b/ShareX.HelpersLib/packages.config @@ -1,6 +1,7 @@  - - - + + + + \ No newline at end of file diff --git a/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs b/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs index 30d9b56a9..d1d19cf97 100644 --- a/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs +++ b/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs @@ -58,7 +58,7 @@ private void btnStart_Click(object sender, EventArgs e) Options.LastVideoPath = mediaPath; pbProgress.Value = 0; - pbProgress.Maximum = Options.ScreenshotCount; + pbProgress.Maximum = Options.ThumbnailCount; pbProgress.Visible = true; btnStart.Visible = false; diff --git a/ShareX.MediaLib/VideoThumbnailOptions.cs b/ShareX.MediaLib/VideoThumbnailOptions.cs index 2eb046612..a9720b2ef 100644 --- a/ShareX.MediaLib/VideoThumbnailOptions.cs +++ b/ShareX.MediaLib/VideoThumbnailOptions.cs @@ -1,7 +1,7 @@ #region License Information (GPL v3) /* - ShareX - A program that allows you to take screenshots and share any file type + ShareX - A program that allows you to take thumbnails and share any file type Copyright © 2007-2015 ShareX Developers This program is free software; you can redistribute it and/or @@ -31,58 +31,58 @@ namespace ShareX.MediaLib { public class VideoThumbnailOptions { - [Category("Screenshots"), DefaultValue(ThumbnailLocationType.DefaultFolder), Description("Create screenshots in default screenshot folder, same folder as the media file or in a custom folder.")] + [Category("Thumbnails"), DefaultValue(ThumbnailLocationType.DefaultFolder), Description("Create thumbnails in default screenshot folder, same folder as the media file or in a custom folder.")] public ThumbnailLocationType OutputLocation { get; set; } - [Category("Screenshots"), DefaultValue(""), Description("Output folder where screenshots will get saved."), Editor(typeof(DirectoryNameEditor), typeof(UITypeEditor))] + [Category("Thumbnails"), DefaultValue(""), Description("Output folder where thumbnails will get saved."), Editor(typeof(DirectoryNameEditor), typeof(UITypeEditor))] public string CustomOutputDirectory { get; set; } - [Category("Screenshots"), DefaultValue(EImageFormat.PNG), Description("Thumbnail image format to save.")] + [Category("Thumbnails"), DefaultValue(EImageFormat.PNG), Description("Thumbnail image format to save.")] public EImageFormat ImageFormat { get; set; } - [Category("Screenshots"), DefaultValue(9), Description("Total number of screenshots to take.")] - public int ScreenshotCount { get; set; } + [Category("Thumbnails"), DefaultValue(9), Description("Total number of thumbnails to take.")] + public int ThumbnailCount { get; set; } - [Category("Screenshots"), DefaultValue("_Thumbnail"), Description("Suffix to append to the screenshot filename.")] + [Category("Thumbnails"), DefaultValue("_Thumbnail"), Description("Suffix to append to the thumbnail filename.")] public string FilenameSuffix { get; set; } - [Category("Screenshots"), DefaultValue(false), Description("Choose random frame each time a media file is processed.")] + [Category("Thumbnails"), DefaultValue(false), Description("Choose random frame each time a media file is processed.")] public bool RandomFrame { get; set; } - [Category("Screenshots"), DefaultValue(true), Description("Upload screenshots.")] - public bool UploadScreenshots { get; set; } + [Category("Thumbnails"), DefaultValue(true), Description("Upload thumbnails.")] + public bool UploadThumbnails { get; set; } - [Category("Screenshots"), DefaultValue(false), Description("After combine screenshots keep single image files.")] + [Category("Thumbnails"), DefaultValue(false), Description("After combine thumbnails keep single image files.")] public bool KeepScreenshots { get; set; } - [Category("Screenshots"), DefaultValue(false), Description("After all screenshots taken open output directory automatically.")] + [Category("Thumbnails"), DefaultValue(false), Description("After all thumbnails taken open output directory automatically.")] public bool OpenDirectory { get; set; } - [Category("Screenshots"), DefaultValue(512), Description("Maximum thumbnail width size, 0 means don't resize.")] + [Category("Thumbnails"), DefaultValue(512), Description("Maximum thumbnail width size, 0 means don't resize.")] public int MaxThumbnailWidth { get; set; } - [Category("Screenshots / Combined"), DefaultValue(true), Description("Combine all screenshots to one large screenshot.")] + [Category("Thumbnails / Combined"), DefaultValue(true), Description("Combine all thumbnails to one large thumbnail.")] public bool CombineScreenshots { get; set; } - [Category("Screenshots / Combined"), DefaultValue(10), Description("Space between border and content as pixel.")] + [Category("Thumbnails / Combined"), DefaultValue(10), Description("Space between border and content as pixel.")] public int Padding { get; set; } - [Category("Screenshots / Combined"), DefaultValue(10), Description("Space between screenshots as pixel.")] + [Category("Thumbnails / Combined"), DefaultValue(10), Description("Space between thumbnails as pixel.")] public int Spacing { get; set; } - [Category("Screenshots / Combined"), DefaultValue(3), Description("Number of screenshots per row.")] + [Category("Thumbnails / Combined"), DefaultValue(3), Description("Number of thumbnails per row.")] public int ColumnCount { get; set; } - [Category("Screenshots / Combined"), DefaultValue(true), Description("Add video information to the combined screenshot.")] + [Category("Thumbnails / Combined"), DefaultValue(true), Description("Add video information to the combined thumbnail.")] public bool AddVideoInfo { get; set; } - [Category("Screenshots / Combined"), DefaultValue(true), Description("Add timestamp of screenshot at corner of image.")] + [Category("Thumbnails / Combined"), DefaultValue(true), Description("Add timestamp of thumbnail at corner of image.")] public bool AddTimestamp { get; set; } - [Category("Screenshots / Combined"), DefaultValue(true), Description("Draw rectangle shadow behind thumbnails.")] + [Category("Thumbnails / Combined"), DefaultValue(true), Description("Draw rectangle shadow behind thumbnails.")] public bool DrawShadow { get; set; } - [Category("Screenshots / Combined"), DefaultValue(true), Description("Draw border around thumbnails.")] + [Category("Thumbnails / Combined"), DefaultValue(true), Description("Draw border around thumbnails.")] public bool DrawBorder { get; set; } public string DefaultOutputDirectory, LastVideoPath; diff --git a/ShareX.MediaLib/VideoThumbnailer.cs b/ShareX.MediaLib/VideoThumbnailer.cs index 8f022d703..0f2bae1bb 100644 --- a/ShareX.MediaLib/VideoThumbnailer.cs +++ b/ShareX.MediaLib/VideoThumbnailer.cs @@ -57,9 +57,9 @@ public VideoThumbnailer(string mediaPath, string ffmpegPath, VideoThumbnailOptio public List TakeThumbnails() { - List tempScreenshots = new List(); + List tempThumbnails = new List(); - for (int i = 0; i < Options.ScreenshotCount; i++) + for (int i = 0; i < Options.ThumbnailCount; i++) { string mediaFileName = Path.GetFileNameWithoutExtension(MediaPath); @@ -71,70 +71,70 @@ public List TakeThumbnails() } else { - timeSliceElapsed = GetTimeSlice(Options.ScreenshotCount) * (i + 1); + timeSliceElapsed = GetTimeSlice(Options.ThumbnailCount) * (i + 1); } string filename = string.Format("{0}-{1}.{2}", mediaFileName, timeSliceElapsed, Options.ImageFormat.GetDescription()); - string tempScreenshotPath = Path.Combine(GetOutputDirectory(), filename); + string tempThumbnailPath = Path.Combine(GetOutputDirectory(), filename); using (Process p = new Process()) { ProcessStartInfo psi = new ProcessStartInfo(FFmpegPath); psi.WindowStyle = ProcessWindowStyle.Hidden; - psi.Arguments = string.Format("-ss {0} -i \"{1}\" -f image2 -vframes 1 -y \"{2}\"", timeSliceElapsed, MediaPath, tempScreenshotPath); + psi.Arguments = string.Format("-ss {0} -i \"{1}\" -f image2 -vframes 1 -y \"{2}\"", timeSliceElapsed, MediaPath, tempThumbnailPath); p.StartInfo = psi; p.Start(); p.WaitForExit(1000 * 30); } - if (File.Exists(tempScreenshotPath)) + if (File.Exists(tempThumbnailPath)) { - VideoThumbnailInfo screenshotInfo = new VideoThumbnailInfo(tempScreenshotPath) + VideoThumbnailInfo screenshotInfo = new VideoThumbnailInfo(tempThumbnailPath) { Timestamp = TimeSpan.FromSeconds(timeSliceElapsed) }; - tempScreenshots.Add(screenshotInfo); + tempThumbnails.Add(screenshotInfo); } - OnProgressChanged(i + 1, Options.ScreenshotCount); + OnProgressChanged(i + 1, Options.ThumbnailCount); } - return Finish(tempScreenshots); + return Finish(tempThumbnails); } - private List Finish(List tempScreenshots) + private List Finish(List tempThumbnails) { - List screenshots = new List(); + List thumbnails = new List(); - if (tempScreenshots != null && tempScreenshots.Count > 0) + if (tempThumbnails != null && tempThumbnails.Count > 0) { if (Options.CombineScreenshots) { - using (Image img = CombineScreenshots(tempScreenshots)) + using (Image img = CombineScreenshots(tempThumbnails)) { string tempFilepath = Path.Combine(GetOutputDirectory(), Path.GetFileNameWithoutExtension(MediaPath) + Options.FilenameSuffix + "." + Options.ImageFormat.GetDescription()); ImageHelpers.SaveImage(img, tempFilepath); - screenshots.Add(new VideoThumbnailInfo(tempFilepath)); + thumbnails.Add(new VideoThumbnailInfo(tempFilepath)); } if (!Options.KeepScreenshots) { - tempScreenshots.ForEach(x => File.Delete(x.Filepath)); + tempThumbnails.ForEach(x => File.Delete(x.Filepath)); } } else { - screenshots.AddRange(tempScreenshots); + thumbnails.AddRange(tempThumbnails); } - if (Options.OpenDirectory && screenshots.Count > 0) + if (Options.OpenDirectory && thumbnails.Count > 0) { - Helpers.OpenFolderWithFile(screenshots[0].Filepath); + Helpers.OpenFolderWithFile(thumbnails[0].Filepath); } } - return screenshots; + return thumbnails; } protected void OnProgressChanged(int current, int length) @@ -168,16 +168,16 @@ private int GetRandomTimeSlice(int start) { List mediaSeekTimes = new List(); - for (int i = 1; i < Options.ScreenshotCount + 2; i++) + for (int i = 1; i < Options.ThumbnailCount + 2; i++) { - mediaSeekTimes.Add(GetTimeSlice(Options.ScreenshotCount + 2) * i); + mediaSeekTimes.Add(GetTimeSlice(Options.ThumbnailCount + 2) * i); } Random random = new Random(); return (int)(random.NextDouble() * (mediaSeekTimes[start + 1] - mediaSeekTimes[start]) + mediaSeekTimes[start]); } - private Image CombineScreenshots(List screenshots) + private Image CombineScreenshots(List thumbnails) { List images = new List(); Image finalImage = null; @@ -197,9 +197,9 @@ private Image CombineScreenshots(List screenshots) } } - foreach (VideoThumbnailInfo screenshot in screenshots) + foreach (VideoThumbnailInfo thumbnail in thumbnails) { - Image img = Image.FromFile(screenshot.Filepath); + Image img = Image.FromFile(thumbnail.Filepath); if (Options.MaxThumbnailWidth > 0 && img.Width > Options.MaxThumbnailWidth) { @@ -273,7 +273,7 @@ private Image CombineScreenshots(List screenshots) using (Font font = new Font("Arial", 10, FontStyle.Bold)) { - ImageHelpers.DrawTextWithShadow(g, screenshots[i].Timestamp.ToString(), + ImageHelpers.DrawTextWithShadow(g, thumbnails[i].Timestamp.ToString(), new Point(offsetX + timestampOffset, offsetY + timestampOffset), font, Color.White, Color.Black); } } diff --git a/ShareX/TaskHelpers.cs b/ShareX/TaskHelpers.cs index 0f3c226fe..bb5ff88d9 100644 --- a/ShareX/TaskHelpers.cs +++ b/ShareX/TaskHelpers.cs @@ -630,7 +630,7 @@ public static void OpenVideoThumbnailer(TaskSettings taskSettings = null) VideoThumbnailerForm thumbnailerForm = new VideoThumbnailerForm(taskSettings.CaptureSettings.FFmpegOptions.CLIPath, Program.Settings.VideoThumbnailOptions); thumbnailerForm.ThumbnailsTaken += thumbnails => { - if (Program.Settings.VideoThumbnailOptions.UploadScreenshots) + if (Program.Settings.VideoThumbnailOptions.UploadThumbnails) { foreach (VideoThumbnailInfo thumbnailInfo in thumbnails) {