Skip to content

Commit

Permalink
changes for 3.40.0
Browse files Browse the repository at this point in the history
Now you can set default values to caption filter, find it in *General* tab
  • Loading branch information
argorar committed May 29, 2024
1 parent 66eb4b9 commit ea9873c
Show file tree
Hide file tree
Showing 11 changed files with 310 additions and 238 deletions.
24 changes: 0 additions & 24 deletions Dialogs/ConverterDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,7 @@ private WebRequest CreateGfyRequest()
httpWRequest.Method = "POST";
httpWRequest.Headers.Add("Authorization", "Bearer " + Program.token);
var aux = _outfile.Split('\\');
string tmp = StringTags();
string postData = " {\"title\":\"" + aux[aux.Length - 1].Split('.')[0] + "\",";
if (!String.IsNullOrEmpty(tmp))
postData = postData + "\"tags\": [" + StringTags() + "],";
postData = postData + "\"nsfw\": 0}";
UTF8Encoding encoding = new UTF8Encoding();
byte[] byte1 = encoding.GetBytes(postData);
Expand Down Expand Up @@ -635,27 +632,6 @@ private void buttonShareX_Click(object sender, EventArgs e)
}
}

private string StringTags()
{
string[] tags = ((MainForm)Owner).GetGfyTags();

if (tags == null)
return string.Empty;

if (tags.Length == 1)
return $"\"{tags[0]}\"";

string text = string.Empty;
foreach (string tag in tags)
{
if (!String.IsNullOrEmpty(text))
text = $"{text},\"{tag}\"";
else
text = $"\"{tag}\"";
}
return text;
}

private void buttonCreate_Click(object sender, EventArgs e)
{
string newOutput = Utility.IncreaseFileNumber(_outfile);
Expand Down
1 change: 0 additions & 1 deletion Dialogs/DownloadDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ private void Exited(object sender, EventArgs eventArgs)
if (_downloaderProcess.ExitCode != 0)
{
boxOutput.AppendText($"{Environment.NewLine}{Environment.NewLine}{Program.yt_dl} exited with exit code {_downloaderProcess.ExitCode}. That's usually bad.");
boxOutput.AppendText($"{Environment.NewLine}If you have no idea what went wrong, open an issue on GitGud and copy paste the output of this window there.");
pictureStatus.BackgroundImage = StatusImages.Images["Failure"];
buttonCancel.Enabled = true;
taskbarManager.SetProgressState(TaskbarProgressBarState.Error);
Expand Down
15 changes: 15 additions & 0 deletions Filters/Caption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ void CaptionForm_Load(object sender, EventArgs e)
colorDialogBorderColor.Color = InputFilter.BorderColor;
numericBorderThickness.Value = InputFilter.BorderThickness;
}
else
{
if (!String.IsNullOrEmpty((Owner as MainForm).getConfigurationValue("Text")))
boxText.Text = (Owner as MainForm).getConfigurationValue("Text");

if (!String.IsNullOrEmpty((Owner as MainForm).getConfigurationValue("Font")))
fontDialog1.Font = Utility.CreateFontFromString((Owner as MainForm).getConfigurationValue("Font"));

if (!String.IsNullOrEmpty((Owner as MainForm).getConfigurationValue("TextColor")))
colorDialogTextColor.Color = Color.FromArgb(Int32.Parse((Owner as MainForm).getConfigurationValue("TextColor")));

if (!String.IsNullOrEmpty((Owner as MainForm).getConfigurationValue("BorderColor")))
colorDialogBorderColor.Color = Color.FromArgb(Int32.Parse((Owner as MainForm).getConfigurationValue("BorderColor")));

}

if ((Owner as MainForm).SarCompensate)
{
Expand Down
317 changes: 145 additions & 172 deletions MainForm.Designer.cs

Large diffs are not rendered by default.

81 changes: 74 additions & 7 deletions MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ public partial class MainForm : Form
public static readonly int MAX_CAPACITY = 400;
private const int MAX_PROCESS = 2;
public static AspectRatio aspectRatio { get; set; }

private System.Windows.Forms.ColorDialog colorDialogTextColor;
private System.Windows.Forms.ColorDialog colorDialogBorderColor;
private System.Windows.Forms.FontDialog fontDialog;
#region MainForm

public MainForm()
Expand All @@ -149,7 +153,6 @@ public MainForm()
InitializeComponent();
this.KeyPreview = true;
taskbarManager = TaskbarManager.Instance;
groupGfycat.Visible = false;
CheckAppSettings();
CheckProccess();
LoadConfiguration();
Expand Down Expand Up @@ -227,6 +230,18 @@ private void CheckAppSettings()

if (!configuration.AppSettings.Settings.AllKeys.Contains("h265"))
configuration.AppSettings.Settings.Add("h265", "False");

if (!configuration.AppSettings.Settings.AllKeys.Contains("Font"))
configuration.AppSettings.Settings.Add("Font", "");

if (!configuration.AppSettings.Settings.AllKeys.Contains("Text"))
configuration.AppSettings.Settings.Add("Text", "");

if (!configuration.AppSettings.Settings.AllKeys.Contains("TextColor"))
configuration.AppSettings.Settings.Add("TextColor", "");

if (!configuration.AppSettings.Settings.AllKeys.Contains("BorderColor"))
configuration.AppSettings.Settings.Add("BorderColor", "");
}

private void ToolTip()
Expand Down Expand Up @@ -327,6 +342,7 @@ private void LoadConfiguration()
if (!String.IsNullOrEmpty(configuration.AppSettings.Settings["PathDownload"].Value))
textPathDownloaded.Text = configuration.AppSettings.Settings["PathDownload"].Value;

boxDefaultText.Text = configuration.AppSettings.Settings["Text"].Value;
CRF4k.Value = Decimal.Parse(configuration.AppSettings.Settings["CRF4k"].Value);
CRFother.Value = Decimal.Parse(configuration.AppSettings.Settings["CRFother"].Value);
checkBoxAlpha.Enabled = boxNGOV.Checked && !checkMP4.Checked;
Expand Down Expand Up @@ -524,7 +540,7 @@ void MainForm_Shown(object sender, EventArgs e)
if (args.Length > 1) // We were "Open with..."ed with a file
SetFile(args[1]);
SendMessage(textBoxIn.Handle, EM_SETCUEBANNER, 0, "Paste URL here if you want to download a video, to download just a part add @*start_time-end_time e.g. URL@*5:35-5:45");
SendMessage(boxTags.Handle, EM_SETCUEBANNER, 0, "tag1,tag2,tag3...");

this.ActiveControl = buttonBrowseIn;
if (!Program.DisableUpdates)
{
Expand Down Expand Up @@ -2836,12 +2852,7 @@ private void buttonLogOut_Click(object sender, EventArgs e)
{
UpdateConfiguration("RefreshToken", string.Empty);
Program.token = string.Empty;
groupGfycat.Visible = false;
}

public string[] GetGfyTags()
{
return String.IsNullOrEmpty(boxTags.Text) ? null : boxTags.Text.Split(',');
}

private void listViewProcessingScript_KeyDown(object sender, KeyEventArgs e)
Expand Down Expand Up @@ -3137,5 +3148,61 @@ private void textBoxdB_TextChanged(object sender, EventArgs e)
{
UpdateArguments(sender, e);
}

private void buttonFont_Click(object sender, EventArgs e)
{
using (fontDialog = new FontDialog())
{
if (!String.IsNullOrEmpty(getConfigurationValue("Font")))
fontDialog.Font = Utility.CreateFontFromString(getConfigurationValue("Font"));

if (fontDialog.ShowDialog() == DialogResult.OK)
UpdateConfiguration("Font", fontDialog.Font.ToString());
}
}

private void buttonTextColor_Click(object sender, EventArgs e)
{
using (colorDialogTextColor = new ColorDialog())
{
if (!String.IsNullOrEmpty(getConfigurationValue("TextColor")))
colorDialogTextColor.Color = Color.FromArgb(Int32.Parse(getConfigurationValue("TextColor")));

if (colorDialogTextColor.ShowDialog() == DialogResult.OK)
UpdateConfiguration("TextColor", colorDialogTextColor.Color.ToArgb().ToString());
}

}

private void buttonBorderColor_Click(object sender, EventArgs e)
{
using (colorDialogBorderColor = new ColorDialog())
{
if (!String.IsNullOrEmpty(getConfigurationValue("BorderColor")))
colorDialogBorderColor.Color = Color.FromArgb(Int32.Parse(getConfigurationValue("BorderColor")));

if (colorDialogBorderColor.ShowDialog() == DialogResult.OK)
UpdateConfiguration("BorderColor", colorDialogBorderColor.Color.ToArgb().ToString());
}
}

public String getConfigurationValue(String key)
{
return configuration.AppSettings.Settings[key].Value;
}

private void boxDefaultText_TextChanged(object sender, EventArgs e)
{
UpdateConfiguration("Text", boxDefaultText.Text);
}

private void buttonRemove_Click(object sender, EventArgs e)
{
UpdateConfiguration("Font", String.Empty);
UpdateConfiguration("TextColor", String.Empty);
UpdateConfiguration("BorderColor", String.Empty);
UpdateConfiguration("Text", String.Empty);
boxDefaultText.Text = String.Empty;
}
}
}
91 changes: 59 additions & 32 deletions MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -141,33 +141,6 @@
<metadata name="tableEncoding.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupEncodingGeneral.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tableEncodingGeneral.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupEncodingVideo.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupEncodingAudio.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tableEncodingAudio.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labeldB.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelAmplification.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelNormalization.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="panelEncodingModeSwapperTwo.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tabAdvanced.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand All @@ -177,6 +150,9 @@
<metadata name="groupBox1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupBox2.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tableMain.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand Down Expand Up @@ -220,7 +196,7 @@
<data name="buttonExportProcessing.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
Expand All @@ -243,7 +219,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAM
cwAAAk1TRnQBSQFMAgEBDAEAAfABBAHwAQQBZAEAAWQBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
cwAAAk1TRnQBSQFMAgEBDAEAAQgBBQEIAQUBZAEAAWQBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABkAEBAgABkAEBAgABAQEAAQgGAAFxAQIXAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEA
AcAB3AHAAQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEA
A0IBAAM5AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIA
Expand Down Expand Up @@ -736,6 +712,24 @@
Mv8CADL/AgAy/wIAMv8CADL/AgAy/wIAMv8CADL/AgAy/wIAMv8CADL/AgAy/wIAMv8CADL/AgAL
</value>
</data>
<metadata name="tableEncoding.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupEncodingGeneral.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupEncodingVideo.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupEncodingAudio.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupEncodingGeneral.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tableEncodingGeneral.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tableEncodingGeneral.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand Down Expand Up @@ -769,6 +763,9 @@
<metadata name="labelGeneralTitleHint.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupEncodingVideo.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="panelEncodingModeSwapper.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand Down Expand Up @@ -829,6 +826,39 @@
<metadata name="labelVideoCrfToleranceHint.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupEncodingAudio.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tableEncodingAudio.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tableEncodingAudio.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labeldB.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelAmplification.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelNormalization.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="panelEncodingModeSwapperTwo.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labeldB.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelAmplification.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelNormalization.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="panelEncodingModeSwapperTwo.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelAudioBitrate.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand Down Expand Up @@ -943,9 +973,6 @@
<metadata name="groupBox1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupBox2.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="statusStrip.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
Expand Down
Binary file added NewUpdate/3.40.0.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion NewUpdate/latest
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.39.3
3.40.0
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.39.3")]
[assembly: AssemblyVersion("3.40.0")]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ Drag and drop two or more video files inside the application, select what do you

## Changelog

#### Version 3.40.0
* Now you can set default values to caption filter, find it in *General* tab

#### Version 3.39.3
* Allow long file names by @DoTheSneedful
* Improve workflow using dynamic filters
Expand Down
12 changes: 12 additions & 0 deletions Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -426,6 +427,17 @@ public static string IncreaseFileNumber(string file)
return $"{directory}\\{auxName}{extension}";
}

public static System.Drawing.Font CreateFontFromString(String data)
{
string[] fontInfo = data.Split(',');

string fontName = fontInfo[0].Split('=')[1];
float fontSize = float.Parse(fontInfo[1].Split('=')[1]);
FontStyle fontStyle = FontStyle.Regular;

return new Font(fontName, fontSize, fontStyle);
}

}

public enum FileType
Expand Down

0 comments on commit ea9873c

Please sign in to comment.