Skip to content

Commit

Permalink
Add Option to include Subfolders in Batch Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Feb 22, 2023
1 parent d5e0ebc commit ad160ec
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NotEnoughAV1Encodes/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private void ButtonOpenSource_Click(object sender, RoutedEventArgs e)
}

// Batch Folder Input
Views.BatchFolderDialog batchFolderDialog = new(settingsDB.Theme, openSource.Path);
Views.BatchFolderDialog batchFolderDialog = new(settingsDB.Theme, openSource.Path, settingsDB.SubfolderBatch);
batchFolderDialog.ShowDialog();
if (batchFolderDialog.Quit)
{
Expand Down
10 changes: 8 additions & 2 deletions NotEnoughAV1Encodes/Views/BatchFolderDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ public partial class BatchFolderDialog : MetroWindow

private bool OutputSelected = false;

public BatchFolderDialog(string theme, string folderPath)
public BatchFolderDialog(string theme, string folderPath, bool subfolders)
{
InitializeComponent();
try { ThemeManager.Current.ChangeTheme(this, theme); } catch { }

SearchOption searchOption = SearchOption.TopDirectoryOnly;
if (subfolders)
{
searchOption = SearchOption.AllDirectories;
}

// "Video Files|*.mp4;*.mkv;*.webm;*.flv;*.avi;*.mov;*.wmv;
var files = Directory.EnumerateFiles(folderPath, "*.*", SearchOption.TopDirectoryOnly)
var files = Directory.EnumerateFiles(folderPath, "*.*", searchOption)
.Where(s => s.ToLower().EndsWith(".mp4") ||
s.ToLower().EndsWith(".mkv") ||
s.ToLower().EndsWith(".webm") ||
Expand Down
1 change: 1 addition & 0 deletions NotEnoughAV1Encodes/Views/ProgramSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<mah:ToggleSwitch Grid.Row="4" Grid.Column="0" x:Name="ToggleSwitchClearQueue" Header="{lex:Loc}" Height="53" Width="224" HorizontalAlignment="Center"/>
<mah:ToggleSwitch Grid.Row="0" Grid.Column="1" x:Name="ToggleSwitchAutoPauseResume" Header="{lex:Loc}" Height="53" Width="224" ToolTip="{lex:Loc ToggleSwitchAutoPauseResumeTooltip}" HorizontalAlignment="Center"/>
<mah:ToggleSwitch Grid.Row="1" Grid.Column="1" x:Name="ToggleSwitchInputSeeking" Header="{lex:Loc}" Height="53" Width="224" ToolTip="Faster PySceneDetect Seeking - chance of frame loss" HorizontalAlignment="Center"/>
<mah:ToggleSwitch Grid.Row="2" Grid.Column="1" x:Name="ToggleSwitchBatchSubFolders" Header="{lex:Loc}" Height="53" Width="224" HorizontalAlignment="Center"/>
</Grid>
</GroupBox>
<GroupBox Margin="511,10,10,0" Height="80" VerticalAlignment="Top">
Expand Down
2 changes: 2 additions & 0 deletions NotEnoughAV1Encodes/Views/ProgramSettings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public ProgramSettings(Settings settingsDB)
ToggleSwitchShutdown.IsOn = settingsDB.ShutdownAfterEncode;
ToggleSwitchLogging.IsOn = settingsDB.Logging;
ToggleSwitchClearQueue.IsOn = settingsDB.AutoClearQueue;
ToggleSwitchBatchSubFolders.IsOn = settingsDB.SubfolderBatch;
ComboBoxAccentTheme.SelectedIndex = settingsDB.AccentTheme;
ComboBoxBaseTheme.SelectedIndex = settingsDB.BaseTheme;
TextBoxTempPath.Text = settingsDB.TempPath;
Expand Down Expand Up @@ -120,6 +121,7 @@ private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEven
settingsDBTemp.ShutdownAfterEncode = ToggleSwitchShutdown.IsOn;
settingsDBTemp.Logging = ToggleSwitchLogging.IsOn;
settingsDBTemp.AutoClearQueue = ToggleSwitchClearQueue.IsOn;
settingsDBTemp.SubfolderBatch = ToggleSwitchBatchSubFolders.IsOn;
settingsDBTemp.BaseTheme = ComboBoxBaseTheme.SelectedIndex;
settingsDBTemp.AccentTheme = ComboBoxAccentTheme.SelectedIndex;
settingsDBTemp.Theme = ComboBoxBaseTheme.Text + "." + ComboBoxAccentTheme.Text;
Expand Down
2 changes: 2 additions & 0 deletions NotEnoughAV1Encodes/resources/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@ public class Settings
public bool UseInputSeeking { get; set; }
/// <summary>Sort Queue By...</summary>
public int SortQueueBy { get; set; }
/// <summary>Include Subfolders when opening a Batch Folder</summary>
public bool SubfolderBatch { get; set; }
}
}
9 changes: 9 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.Designer.cs

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

3 changes: 3 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -563,4 +563,7 @@ Please download and extract 7-zip to the following path:
<data name="SortByOutNameDesc" xml:space="preserve">
<value>Sortieren nach Ausgabe Name (absteigend)</value>
</data>
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>Unterordner im Batch einbeziehen</value>
</data>
</root>
3 changes: 3 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -563,4 +563,7 @@ Please download and extract 7-zip to the following path:
<data name="SortByOutNameDesc" xml:space="preserve">
<value>Trier par nom de sortie (desc)</value>
</data>
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>Inclure les sous-dossiers en batch</value>
</data>
</root>
3 changes: 3 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.it-IT.resx
Original file line number Diff line number Diff line change
Expand Up @@ -518,4 +518,7 @@ Please download and extract 7-zip to the following path:
<data name="SortByOutNameDesc" xml:space="preserve">
<value>Ordinamento per nome dell'uscita (discendente)</value>
</data>
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>Includere le sottocartelle in Batch</value>
</data>
</root>
3 changes: 3 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.ja-JP.resx
Original file line number Diff line number Diff line change
Expand Up @@ -527,4 +527,7 @@ Please download and extract 7-zip to the following path:
<data name="SortByOutNameDesc" xml:space="preserve">
<value>アウトネームで並び替え(降順)</value>
</data>
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>サブフォルダを一括で取り込む</value>
</data>
</root>
3 changes: 3 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -569,4 +569,7 @@ Please download and extract 7-zip to the following path:
<data name="SortByOutNameDesc" xml:space="preserve">
<value>Sort by Out Name (desc)</value>
</data>
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>Include Subfolders in Batch Mode</value>
</data>
</root>
3 changes: 3 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.ru-RU.resx
Original file line number Diff line number Diff line change
Expand Up @@ -511,4 +511,7 @@ Please download and extract 7-zip to the following path:
<data name="SortByOutNameDesc" xml:space="preserve">
<value>Сортировать по названию (по убыванию)</value>
</data>
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>Включение вложенных папок в пакетном режиме</value>
</data>
</root>
3 changes: 3 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -560,4 +560,7 @@
<data name="SortByOutNameDesc" xml:space="preserve">
<value>按名称排序(降)。</value>
</data>
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>在批处理模式中包括子文件夹</value>
</data>
</root>

0 comments on commit ad160ec

Please sign in to comment.