Skip to content

Commit

Permalink
Add Option to mirror folder structure in batch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Feb 22, 2023
1 parent ad160ec commit 04e763b
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 2 deletions.
9 changes: 9 additions & 0 deletions NotEnoughAV1Encodes/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,13 @@ private void ButtonOpenSource_Click(object sender, RoutedEventArgs e)
if (batchFolderDialog.Quit)
{
List<string> files = batchFolderDialog.Files;
string inputPath = batchFolderDialog.Input;
string preset = batchFolderDialog.Preset;
string output = batchFolderDialog.Output;
int container = batchFolderDialog.Container;
bool presetBitdepth = batchFolderDialog.PresetBitdepth;
bool activatesubtitles = batchFolderDialog.ActivateSubtitles;
bool mirrorFolderStructure = batchFolderDialog.MirrorFolderStructure;

string outputContainer = "";
if (container == 0) outputContainer = ".mkv";
Expand Down Expand Up @@ -273,7 +275,14 @@ private void ButtonOpenSource_Click(object sender, RoutedEventArgs e)
string outname = PresetSettings.PresetBatchName;
outname = outname.Replace("{filename}", Path.GetFileNameWithoutExtension(file));
outname = outname.Replace("{presetname}", preset);

videoDB.OutputPath = Path.Combine(output, outname + outputContainer);
if (mirrorFolderStructure)
{
string relativePath = Path.GetRelativePath(inputPath, Path.GetDirectoryName(file));
videoDB.OutputPath = Path.Combine(output, relativePath, outname + outputContainer);
}

videoDB.OutputFileName = Path.GetFileName(videoDB.OutputPath);
videoDB.ParseMediaInfo(PresetSettings);

Expand Down
3 changes: 2 additions & 1 deletion NotEnoughAV1Encodes/Views/BatchFolderDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
lex:LocalizeDictionary.DesignCulture="en"
lex:ResxLocalizationProvider.DefaultAssembly="NotEnoughAV1Encodes"
lex:ResxLocalizationProvider.DefaultDictionary="Strings"
Title="NEAV1E" Height="500" Width="800" ResizeMode="NoResize">
Title="NEAV1E" Height="550" Width="800" ResizeMode="NoResize">
<Grid>
<GroupBox Header="{lex:Loc LabelSource}" Margin="10,10,10,0" mah:ControlsHelper.ContentCharacterCasing="Normal" Height="236" VerticalAlignment="Top">
<Grid>
Expand Down Expand Up @@ -67,5 +67,6 @@
</GroupBox>
<mah:ToggleSwitch x:Name="ToggleSwitchUsePresetBitDepth" Height="62" Header="{lex:Loc}" Margin="10,411,0,0" Width="241" VerticalAlignment="Top"/>
<mah:ToggleSwitch x:Name="ToggleSwitchActivateSubtitles" Height="62" Header="{lex:Loc}" Margin="254,409,0,0" Width="241" VerticalAlignment="Top" IsOn="True"/>
<mah:ToggleSwitch x:Name="ToggleSwitchMirrorFolderStructure" Height="62" Header="{lex:Loc}" Margin="10,466,0,0" Width="241" VerticalAlignment="Top"/>
</Grid>
</mah:MetroWindow>
8 changes: 7 additions & 1 deletion NotEnoughAV1Encodes/Views/BatchFolderDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ControlzEx.Theming;
using ControlzEx.Standard;
using ControlzEx.Theming;
using MahApps.Metro.Controls;
using System.Collections.Generic;
using System.IO;
Expand All @@ -12,6 +13,8 @@ public partial class BatchFolderDialog : MetroWindow
public bool Quit { get; set; }
public bool PresetBitdepth { get; set; }
public bool ActivateSubtitles { get; set; } = true;
public bool MirrorFolderStructure { get; set; }
public string Input { get; set; }
public string Preset { get; set; }
public string Output { get; set; }
public int Container { get; set; }
Expand All @@ -25,6 +28,8 @@ public BatchFolderDialog(string theme, string folderPath, bool subfolders)
InitializeComponent();
try { ThemeManager.Current.ChangeTheme(this, theme); } catch { }

Input = folderPath;

SearchOption searchOption = SearchOption.TopDirectoryOnly;
if (subfolders)
{
Expand Down Expand Up @@ -111,6 +116,7 @@ private void ButtonAddToQueue_Click(object sender, RoutedEventArgs e)
Output = TextBoxDestination.Text;
PresetBitdepth = ToggleSwitchUsePresetBitDepth.IsOn;
ActivateSubtitles = ToggleSwitchActivateSubtitles.IsOn;
MirrorFolderStructure = ToggleSwitchMirrorFolderStructure.IsOn;
Quit = true;
Close();
}
Expand Down
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 @@ -566,4 +566,7 @@ Please download and extract 7-zip to the following path:
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>Unterordner im Batch einbeziehen</value>
</data>
<data name="ToggleSwitchMirrorFolderStructure" xml:space="preserve">
<value>Ordnerstruktur spiegeln</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 @@ -566,4 +566,7 @@ Please download and extract 7-zip to the following path:
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>Inclure les sous-dossiers en batch</value>
</data>
<data name="ToggleSwitchMirrorFolderStructure" xml:space="preserve">
<value>Copier la structure des dossiers</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 @@ -521,4 +521,7 @@ Please download and extract 7-zip to the following path:
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>Includere le sottocartelle in Batch</value>
</data>
<data name="ToggleSwitchMirrorFolderStructure" xml:space="preserve">
<value>Copiare la struttura delle cartelle</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 @@ -530,4 +530,7 @@ Please download and extract 7-zip to the following path:
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>サブフォルダを一括で取り込む</value>
</data>
<data name="ToggleSwitchMirrorFolderStructure" 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 @@ -572,4 +572,7 @@ Please download and extract 7-zip to the following path:
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>Include Subfolders in Batch Mode</value>
</data>
<data name="ToggleSwitchMirrorFolderStructure" xml:space="preserve">
<value>Mirror Folder Structure</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 @@ -514,4 +514,7 @@ Please download and extract 7-zip to the following path:
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>Включение вложенных папок в пакетном режиме</value>
</data>
<data name="ToggleSwitchMirrorFolderStructure" 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 @@ -563,4 +563,7 @@
<data name="ToggleSwitchBatchSubFolders" xml:space="preserve">
<value>在批处理模式中包括子文件夹</value>
</data>
<data name="ToggleSwitchMirrorFolderStructure" xml:space="preserve">
<value>复制文件夹结构</value>
</data>
</root>

0 comments on commit 04e763b

Please sign in to comment.