Skip to content

Commit

Permalink
Add Option for Default Container #117
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Oct 20, 2022
1 parent a99d0d5 commit 2333c02
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
17 changes: 16 additions & 1 deletion NotEnoughAV1Encodes/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,26 @@ private void SingleFileInput(string path)
// Output
if (!string.IsNullOrEmpty(settingsDB.DefaultOutPath))
{
string outPath = Path.Combine(settingsDB.DefaultOutPath, Path.GetFileNameWithoutExtension(videoDB.InputPath) + ".mkv");
string outPath = Path.Combine(settingsDB.DefaultOutPath, Path.GetFileNameWithoutExtension(videoDB.InputPath) + settingsDB.DefaultOutContainer);

videoDB.OutputPath = outPath;
LabelVideoDestination.Content = videoDB.OutputPath;
videoDB.OutputFileName = Path.GetFileName(videoDB.OutputPath);

try
{
if (Path.GetExtension(videoDB.OutputPath).ToLower() == ".mp4" ||
Path.GetExtension(videoDB.OutputPath).ToLower() == ".webm")
{
// Disable Subtitles if Output is MP4
foreach (Subtitle.SubtitleTracks subtitleTracks in ListBoxSubtitleTracks.Items)
{
subtitleTracks.Active = false;
subtitleTracks.Enabled = false;
}
}
}
catch { }
}
}

Expand Down
17 changes: 11 additions & 6 deletions NotEnoughAV1Encodes/Views/ProgramSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,20 @@
<GroupBox Margin="10,10,0,0" mah:ControlsHelper.ContentCharacterCasing="Normal" Height="122" VerticalAlignment="Top" Header="{lex:Loc LabelTempPath}" HorizontalAlignment="Left" Width="299">
<Grid>
<TextBox x:Name="TextBoxTempPath" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Top" Width="249" Margin="0,10,0,0"/>
<Button x:Name="ButtonSelectTempPath" Content="{lex:Loc ButtonSelectBGImage}" HorizontalAlignment="Left" Margin="158,0,0,6" VerticalAlignment="Bottom" Height="21" Width="101" mah:ControlsHelper.ContentCharacterCasing="Normal" Click="ButtonSelectTempPath_Click"/>
<Button x:Name="ButtonSelectTempPathReset" Content="{lex:Loc ButtonResetBGImage}" HorizontalAlignment="Left" Margin="10,0,0,6" VerticalAlignment="Bottom" Height="21" Width="101" mah:ControlsHelper.ContentCharacterCasing="Normal" Click="ButtonSelectTempPathReset_Click"/>
<Button x:Name="ButtonSelectTempPath" Content="{lex:Loc ButtonSelectBGImage}" HorizontalAlignment="Left" Margin="168,0,0,6" VerticalAlignment="Bottom" Height="21" Width="101" mah:ControlsHelper.ContentCharacterCasing="Normal" Click="ButtonSelectTempPath_Click"/>
<Button x:Name="ButtonSelectTempPathReset" Content="{lex:Loc ButtonResetBGImage}" HorizontalAlignment="Left" Margin="20,0,0,6" VerticalAlignment="Bottom" Height="21" Width="101" mah:ControlsHelper.ContentCharacterCasing="Normal" Click="ButtonSelectTempPathReset_Click"/>
</Grid>
</GroupBox>
<GroupBox Margin="314,10,0,0" mah:ControlsHelper.ContentCharacterCasing="Normal" Height="122" VerticalAlignment="Top" Header="{lex:Loc LabelDefaultOutputLocation}" HorizontalAlignment="Left" Width="299">
<GroupBox Margin="314,10,0,0" mah:ControlsHelper.ContentCharacterCasing="Normal" Height="122" VerticalAlignment="Top" Header="{lex:Loc LabelDefaultOutputLocation}" HorizontalAlignment="Left" Width="430">
<Grid>
<TextBox x:Name="TextBoxDefaultOutPath" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Top" Width="249" Margin="0,10,0,0"/>
<Button x:Name="ButtonSelectDefaultOutPath" Content="{lex:Loc ButtonSelectBGImage}" HorizontalAlignment="Left" Margin="158,0,0,6" VerticalAlignment="Bottom" Height="21" Width="101" mah:ControlsHelper.ContentCharacterCasing="Normal" Click="ButtonSelectDefaultOutPath_Click"/>
<Button x:Name="ButtonSelectDefaultOutPathReset" Content="{lex:Loc ButtonResetBGImage}" HorizontalAlignment="Left" Margin="10,0,0,6" VerticalAlignment="Bottom" Height="21" Width="101" mah:ControlsHelper.ContentCharacterCasing="Normal" Click="ButtonSelectDefaultOutPathReset_Click"/>
<TextBox x:Name="TextBoxDefaultOutPath" HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Top" Width="294" Margin="10,10,0,0"/>
<Button x:Name="ButtonSelectDefaultOutPath" Content="{lex:Loc ButtonSelectBGImage}" HorizontalAlignment="Left" Margin="309,0,0,10" VerticalAlignment="Bottom" Height="21" Width="101" mah:ControlsHelper.ContentCharacterCasing="Normal" Click="ButtonSelectDefaultOutPath_Click"/>
<Button x:Name="ButtonSelectDefaultOutPathReset" Content="{lex:Loc ButtonResetBGImage}" HorizontalAlignment="Left" Margin="10,0,0,10" VerticalAlignment="Bottom" Height="21" Width="101" mah:ControlsHelper.ContentCharacterCasing="Normal" Click="ButtonSelectDefaultOutPathReset_Click"/>
<ComboBox x:Name="ComboBoxDefaultOutContainer" HorizontalAlignment="Left" Margin="309,10,0,0" VerticalAlignment="Top" Width="101" SelectedIndex="0">
<ComboBoxItem Content=".mkv"/>
<ComboBoxItem Content=".webm"/>
<ComboBoxItem Content=".mp4"/>
</ComboBox>
</Grid>
</GroupBox>
</Grid>
Expand Down
9 changes: 9 additions & 0 deletions NotEnoughAV1Encodes/Views/ProgramSettings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ public ProgramSettings(Settings settingsDB)
"fr-FR" => 6,
_ => 0,
};

ComboBoxDefaultOutContainer.SelectedIndex = settingsDB.DefaultOutContainer switch
{
".mkv" => 0,
".webm" => 1,
".mp4" => 2,
_ => 0,
};
}

private void ButtonSelectBGImage_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -115,6 +123,7 @@ private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEven
settingsDBTemp.Theme = ComboBoxBaseTheme.Text + "." + ComboBoxAccentTheme.Text;
settingsDBTemp.TempPath = TextBoxTempPath.Text;
settingsDBTemp.DefaultOutPath = TextBoxDefaultOutPath.Text;
settingsDBTemp.DefaultOutContainer = ComboBoxDefaultOutContainer.Text;
settingsDBTemp.PriorityNormal = ComboBoxProcessPriority.SelectedIndex == 0;
}

Expand Down
2 changes: 2 additions & 0 deletions NotEnoughAV1Encodes/resources/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class Settings
public string TempPath { get; set; } = Path.GetTempPath();
/// <summary>Specifies the default Output Folder</summary>
public string DefaultOutPath { get; set; } = "";
/// <summary>Specifies the default Output Container</summary>
public string DefaultOutContainer { get; set; } = ".mkv";
/// <summary>Toggles Logging functionality</summary>
public bool Logging { get; set; } = true;
/// <summary>Toggles Auto Resume Pause functionality</summary>
Expand Down

0 comments on commit 2333c02

Please sign in to comment.