Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Fixes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
gfrn committed Feb 6, 2021
1 parent 62d194d commit 3962940
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 78 deletions.
15 changes: 5 additions & 10 deletions WPFMETRO/Converter.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
xmlns:local="clr-namespace:WPFMETRO"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static localization:Strings.Converter}" Height="463" Width="440">
Title="{x:Static localization:Strings.Converter}" Height="463" Width="480">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.00085*" />
Expand Down Expand Up @@ -59,12 +59,11 @@
</StackPanel>

<StackPanel Margin="13,6, 0, 0" Grid.Column = "0" Grid.Row = "3" Orientation = "Horizontal">
<Label Content = "{x:Static localization:Strings.Other}" VerticalAlignment = "Center" Width = "75"/>
<Button IsEnabled="False" x:Name="JoinVideosButton" Content = "{x:Static localization:Strings.JoinVideos}" MinWidth="203" MaxWidth="210"/>
<Button Margin="10,0,0,0" x:Name="CancelJoinButton" Click="ImportButton_Click" MinWidth="150" MaxWidth="160" Content="{x:Static localization:Strings.Cancel}" Visibility="Hidden"/>
<Button Name="MergeButton" Click="MergeButton_Click" Content="{x:Static localization:Strings.MergeAV}" HorizontalAlignment="Left" MinWidth="203" MaxWidth="210" Margin="75,0,0,0"/>
<Button Name="CancelMergeButton" Margin="10,0,0,0" Click="CancelMergeButton_Click" MinWidth="150" MaxWidth="160" HorizontalAlignment="Left" Content="{x:Static localization:Strings.Cancel}" Visibility="Hidden"/>
</StackPanel>
<StackPanel Margin="13,2" Orientation="Vertical" Grid.Row = "4" >

<StackPanel Margin="13,2" Orientation="Vertical" Grid.Row = "4" >
<StackPanel Grid.Column = "0" Grid.Row = "4" Orientation = "Horizontal">
<Button IsEnabled="False" Name="AddSubsButton" Content="{x:Static localization:Strings.AddSubtitles}" HorizontalAlignment="Left" MinWidth="203" MaxWidth="210" Margin="75,2"/>
<Button Margin="10,0,0,0" x:Name="CancelSubsButton" Click="ImportButton_Click" MinWidth="150" MaxWidth="160" Content="{x:Static localization:Strings.Cancel}" Visibility="Hidden"/>
Expand All @@ -74,10 +73,6 @@
<TextBox Name="IntervalSnagBox" Width = "50" IsEnabled="False" TextInput="IntervalSnagBox_TextInput"/>
<Label Content = "{x:Static localization:Strings.Seconds}" VerticalAlignment = "Center" Width = "75"/>
</StackPanel>
<StackPanel Grid.Column = "0" Grid.Row = "4" Orientation = "Horizontal">
<Button IsEnabled="False" Name="MergeButton" Content="{x:Static localization:Strings.MergeAV}" HorizontalAlignment="Left" MinWidth="203" MaxWidth="210" Margin="75,2"/>
<Button Margin="10,0,0,0" x:Name="CancelMergeButton" Click="ImportButton_Click" MinWidth="150" MaxWidth="160" Content="{x:Static localization:Strings.Cancel}" Visibility="Hidden"/>
</StackPanel>
</StackPanel>

<GroupBox Margin="13,2" Grid.Row="5" Header="{x:Static localization:Strings.Information}">
Expand Down
80 changes: 17 additions & 63 deletions WPFMETRO/Converter.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ public Converter()

private void ImportButton_Click(object sender, RoutedEventArgs e)
{
JoinVideosButton.IsEnabled = false;

importAVDialog.ShowDialog();
if (importAVDialog.CheckFileExists)
{
Expand Down Expand Up @@ -97,32 +95,26 @@ private void ExportButton_Click(object sender, RoutedEventArgs e)
private void ConvertButton_Click(object sender, RoutedEventArgs e)
{
string args = "";
if (JoinVideosButton.IsEnabled)

args = "-i \"" + inputFile + "\"";
string output = Path.GetExtension(outputFile) == ".png" ? "\"" + outputFile.Substring(0, outputFile.LastIndexOf('.')) + "_%03d.png\"" : " \"" + saveAVDialog.FileName + "\"";
if (Path.GetExtension(outputFile) == ".png") { args += " -vf fps=" + IntervalSnagBox.Text + " "; }
if (CutStartTextbox.Text == "00:00:00.0" && EndOfVideoCheckbox.IsChecked == true)
{
args = "-f concat -i file -list.txt -c copy " + saveAVDialog.FileName;
if (openMergeDialog.FileName != "" && openSubtitlesDialog.FileName != "") { System.Windows.Forms.MessageBox.Show(""); }
else if (openSubtitlesDialog.FileName != "") { args += " -i \"" + openSubtitlesDialog.FileName + "\" - map 0 - map 1 - c copy - c:v"; }
else if (openMergeDialog.FileName != "") { args += " -i \"" + openMergeDialog.FileName + "\" -c:v copy -c:a aac -map 0:v:0 -map 1:a:0"; }
}
else
{
args = "-i \"" + inputFile + "\"";
string output = Path.GetExtension(outputFile) == ".png" ? "\"" + outputFile.Substring(0, outputFile.LastIndexOf('.')) + "_%03d.png\"" : " \"" + saveAVDialog.FileName + "\"";
if (Path.GetExtension(outputFile) == ".png") { args += " -vf fps=" + IntervalSnagBox.Text + " "; }
if (CutStartTextbox.Text == "00:00:00.0" && EndOfVideoCheckbox.IsChecked == true)
{
if (openMergeDialog.FileName != "" && openSubtitlesDialog.FileName != "") { System.Windows.Forms.MessageBox.Show(""); }
else if (openSubtitlesDialog.FileName != "") { args += "-i " + openSubtitlesDialog.FileName + " - map 0 - map 1 - c copy - c:v"; }
else if (openMergeDialog.FileName != "") { args += "-i " + openMergeDialog.FileName + " -c:v copy -c:a aac -strict experimental"; }
}
if (openMergeDialog.FileName != "" || openSubtitlesDialog.FileName != "") { System.Windows.Forms.MessageBox.Show(""); }
else
{
if (openMergeDialog.FileName != "" || openSubtitlesDialog.FileName != "") { System.Windows.Forms.MessageBox.Show(""); }
else
{
args += " -ss " + CutStartTextbox.Text;
args += EndOfVideoCheckbox.IsChecked == true ? "" : " -to " + CutEndTextbox.Text + " ";
}
args += " -ss " + CutStartTextbox.Text;
args += EndOfVideoCheckbox.IsChecked == true ? "" : " -to " + CutEndTextbox.Text + " ";
}
args += output;
}
args += output;

ffMpegProc.StartInfo.Arguments = args;
ffMpegProc.StartInfo.UseShellExecute = false;
Expand All @@ -136,7 +128,7 @@ private void ConvertButton_Click(object sender, RoutedEventArgs e)

ffMpegProc.Start();

CancelButton.Visibility = CancelJoinButton.Visibility = CancelMergeButton.Visibility = CancelSubsButton.Visibility = Visibility.Hidden;
CancelButton.Visibility = CancelMergeButton.Visibility = CancelSubsButton.Visibility = Visibility.Hidden;

EndOfVideoCheckbox.IsEnabled = ConvertButton.IsEnabled = ExportButton.IsEnabled = ImportButton.IsEnabled = false;
MergeButton.IsEnabled = CutStartTextbox.IsEnabled = EndOfVideoCheckbox.IsEnabled = AddSubsButton.IsEnabled = false;
Expand All @@ -155,7 +147,7 @@ private void ffMpegProc_Exited(object sender, EventArgs e)
ConvertFromLabel.Content = "";
ConvertToLabel.Content = "";

ImportButton.IsEnabled = CutStartTextbox.IsEnabled = EndOfVideoCheckbox.IsEnabled = JoinVideosButton.IsEnabled = true;
ImportButton.IsEnabled = CutStartTextbox.IsEnabled = EndOfVideoCheckbox.IsEnabled = true;

StatusLabel.Content = Localization.Strings.Done;
}));
Expand All @@ -167,43 +159,16 @@ private void EndOfVideoCheckbox_CheckedChanged(object sender, EventArgs e)
CutEndTextbox.Text = "0000000";
}

private void JoinVideosButton_Click(object sender, EventArgs e)
{
ImportButton.IsEnabled = false;
AddSubsButton.IsEnabled = false;
IntervalSnagBox.IsEnabled = false;
MergeButton.IsEnabled = false;
CancelJoinButton.Visibility = Visibility.Visible;

/*openVideoListDialog.ShowDialog();
if (openVideoListDialog.CheckFileExists)
{
ExportButton.IsEnabled = true;
}*/
}

private void CancelImportButton_Click(object sender, EventArgs e)
{
importAVDialog.FileName = "";
inputFile = "";

OriginalFileLabel.Content = "";

JoinVideosButton.IsEnabled = true;
CancelButton.Visibility = Visibility.Hidden;
}

private void CancelJoinButton_Click(object sender, EventArgs e)
{
ConvertButton.IsEnabled = false;
ImportButton.IsEnabled = true;

//openVideoListDialog.FileName = ""; Will implement later

CancelJoinButton.Visibility = Visibility.Hidden;
}

private void AddSubsButton_Click(object sender, EventArgs e)
{
CancelSubsButton.Visibility = Visibility.Visible;
Expand All @@ -218,20 +183,9 @@ private void AddSubsButton_Click(object sender, EventArgs e)

private void MergeButton_Click(object sender, EventArgs e)
{
if (videoFormats.Any(Path.GetExtension(inputFile).Contains))
{
CancelMergeButton.Visibility = Visibility.Visible;
AddSubsButton.IsEnabled = false;
openMergeDialog.Filter = videoFilter;
openMergeDialog.ShowDialog();
}
else if (audioFormats.Any(Path.GetExtension(inputFile).Contains))
{
AddSubsButton.IsEnabled = false;
CancelMergeButton.Visibility = Visibility.Visible;
openMergeDialog.FileName = audioFilter;
openMergeDialog.ShowDialog();
}
CancelMergeButton.Visibility = Visibility.Visible;
AddSubsButton.IsEnabled = false;
openMergeDialog.ShowDialog();
}

private void CancelMergeButton_Click(object sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions WPFMETRO/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 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("1.5.0.7")]
[assembly: AssemblyFileVersion("1.5.0.7")]
[assembly: AssemblyVersion("1.5.1.0")]
[assembly: AssemblyFileVersion("1.5.1.0")]
6 changes: 3 additions & 3 deletions WPFMETRO/WPFMETRO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>false</MapFileExtensions>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>7</ApplicationRevision>
<ApplicationVersion>1.5.0.%2a</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.5.1.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
Expand All @@ -52,7 +52,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>6EC2C9CFFD1C18115525233621D8D7F404685BD1</ManifestCertificateThumbprint>
<ManifestCertificateThumbprint>07BF3C69710D4229175A128FD11DB7AFC4FE483F</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>WPFMETRO_TemporaryKey.pfx</ManifestKeyFile>
Expand Down

0 comments on commit 3962940

Please sign in to comment.