Skip to content

Commit

Permalink
converted converter methods
Browse files Browse the repository at this point in the history
finished settings form
added options for converter, should work better with more options.
  • Loading branch information
obscurename authored Sep 17, 2017
1 parent 2146338 commit cebe9cc
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 20 deletions.
4 changes: 1 addition & 3 deletions Forms/frmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions Forms/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ private void frmMain_Shown(object sender, EventArgs e)
}

if (Properties.Settings.Default.saveArgs)
txtArgs.Text = File.ReadAllText(System.Windows.Forms.Application.StartupPath + @"\args.txt");
if (File.Exists(System.Windows.Forms.Application.StartupPath + @"\args.txt"))
txtArgs.Text = File.ReadAllText(System.Windows.Forms.Application.StartupPath + @"\args.txt");

cbFormat.SelectedIndex = 0;
cbQuality.SelectedIndex = 0;
cbConvFormat.SelectedIndex = 0;
}
private void frmMain_SizeChanged(object sender, EventArgs e)
{
Expand Down Expand Up @@ -252,7 +254,7 @@ private void txtURL_MouseEnter(object sender, EventArgs e)
{
if (Properties.Settings.Default.HoverURL == true)
{
if (Clipboard.ContainsText())
if (Clipboard.ContainsText() && txtURL.Text != Clipboard.GetText())
{
txtURL.Clear();
txtURL.Text = Clipboard.GetText();
Expand Down Expand Up @@ -456,14 +458,31 @@ private void ConvertFile(string FileInput)
{
Process Converter = new Process();
Converter.StartInfo.FileName = "ffmpeg.exe";
string setArgs = "";
string convTo = "";
if (chkSaveToMaster.Checked)
{
Converter.StartInfo.Arguments = "-i \"" + FileInput + "\" -ab " + cbConvQuality.Text + " \"" + Path.GetDirectoryName(txtConvFile.Text) + "\\" + Path.GetFileNameWithoutExtension(txtConvFile.Text) + "." + cbConvFormat.Text + "\"";
convTo = Path.GetDirectoryName(txtConvFile.Text);
}
else
{
Converter.StartInfo.Arguments = "-i \"" + FileInput + "\" -ab " + cbConvQuality.Text + " \"" + txtConvSave.Text + "\\" + Path.GetFileNameWithoutExtension(txtConvFile.Text) + "." + cbConvFormat.Text + "\"";
convTo = txtConvSave.Text;
}

if (cbConvQuality.SelectedIndex == 0 || cbConvQuality.SelectedIndex == 7)
{
MessageBox.Show("Please select a valid quality.");
return;
}
if (cbConvFormat.SelectedIndex == 1 || cbConvFormat.SelectedIndex == 7)
{
MessageBox.Show("Please select a valid format.");
return;
}

setArgs = "-i \"" + FileInput + "\" -ab " + cbConvQuality.Text + " \"" + convTo + "\\" + Path.GetFileNameWithoutExtension(convTo + "." + cbConvFormat.Text + "\"");

Converter.StartInfo.Arguments = setArgs;
Converter.StartInfo.UseShellExecute = false;
Converter.StartInfo.CreateNoWindow = false;
Converter.Start();
Expand Down
30 changes: 17 additions & 13 deletions Forms/frmSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cebe9cc

Please sign in to comment.