Skip to content

Commit

Permalink
Added subfolder toggle
Browse files Browse the repository at this point in the history
Added subfolder creation toggle. Unchecked by default, if checked, makes folder based on channel name and ID
  • Loading branch information
Ruthalas committed Jun 27, 2020
1 parent 1253be2 commit fed94a1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Youtube Downloader Plus/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<CheckBox x:Name="cbDescription" Content="Download description (writes seperate file)" IsChecked="True"/>
</InlineUIContainer><LineBreak/><InlineUIContainer>
<CheckBox x:Name="cbThumbnail" Content="Download thumbnail (writes seperate file)" IsChecked="True"/>
</InlineUIContainer><LineBreak/><InlineUIContainer>
<CheckBox x:Name="cbSubFolder" Content="Create in Channel Subfolder" IsChecked="False"/>
</InlineUIContainer><LineBreak/><Run Text="Save Path: "/><LineBreak/><InlineUIContainer>
<TextBox x:Name="tbPath" Text="" Width="266" />
</InlineUIContainer><LineBreak/><LineBreak/><LineBreak/><LineBreak/><LineBreak/><InlineUIContainer>
Expand All @@ -37,7 +39,7 @@
<TextBlock Name="textBlock2" Background="lightgray" Padding="5,5,5,5" Text="Log Output:&#10;"/>
</ScrollViewer>
<!--<Button Name="btGetVersion" Content="yt-dl Version" HorizontalAlignment="Left" Margin="99,231,0,0" VerticalAlignment="Top" Width="75" Click="Get_Version" Grid.Column="1"/>-->
<Button Name="btBrowse" Content="Browse" HorizontalAlignment="Left" Margin="179,150,0,0" VerticalAlignment="Top" Width="75" Click="Browse_For_Folder" Grid.Column="1" RenderTransformOrigin="0.522,0.262"/>
<Button Name="btBrowse" Content="Browse" HorizontalAlignment="Left" Margin="179,165,0,0" VerticalAlignment="Top" Width="75" Click="Browse_For_Folder" Grid.Column="1" RenderTransformOrigin="0.522,0.262"/>
<Button Name="btRunDownload" Content="Download" HorizontalAlignment="Left" Margin="179,227,0,0" VerticalAlignment="Top" Width="75" Click="Run_Download" Grid.Column="1"/>
</Grid>
</TabItem>
Expand Down
19 changes: 16 additions & 3 deletions Youtube Downloader Plus/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
using System.Windows.Navigation;
using System.Windows.Shapes;

// I apologize if this is a pile of hot garbage
// This is my first time using both Visual Studio and WPF

namespace Youtube_Downloader_Plus
{
/// <summary>
Expand Down Expand Up @@ -89,9 +92,18 @@ private void Run_Download(object sender, RoutedEventArgs e)
string strCommandParameters = tbURL.Text;
// Add ignore errors command
strCommandParameters = strCommandParameters + " -i";
// Add output file-name formatting string
strCommandParameters = strCommandParameters + " -o \"%(uploader)s [%(channel_id)s]/%(upload_date)s - %(title)s - (%(duration)ss) [%(id)s].%(ext)s\"";
// Add quality parameters (for absolute best)
// Begin output structure
strCommandParameters = strCommandParameters + " -o";
// Build output path, adding subfolder if selected
if (cbSubFolder.IsChecked ?? false)
{
strCommandParameters = strCommandParameters + " \"%(uploader)s [%(channel_id)s]/%(upload_date)s - %(title)s - (%(duration)ss) [%(id)s].%(ext)s\"";
}
else
{
strCommandParameters = strCommandParameters + " \"%(upload_date)s - %(title)s - (%(duration)ss) [%(id)s].%(ext)s\"";
}
// Add quality parameters for absolute best, including the manifest allows youtube-dl to find 4k footage, which is stored differently
strCommandParameters = strCommandParameters + " -f bestvideo+bestaudio --youtube-include-dash-manifest";
// Add output container (MKV)
strCommandParameters = strCommandParameters + " --merge-output mkv";
Expand All @@ -112,6 +124,7 @@ private void Run_Download(object sender, RoutedEventArgs e)
strCommandParameters = strCommandParameters + " --all-subs --embed-subs";
}

// Uncomment the following line to display the final command. Useful for debugging.
//MessageBox.Show(strCommandParameters);

// Let's get this working directory sorted out. First let's get a variable set up for it.
Expand Down

0 comments on commit fed94a1

Please sign in to comment.