Skip to content

Commit

Permalink
Update youtube downloader when the program starts
Browse files Browse the repository at this point in the history
  • Loading branch information
bertyhell committed Nov 20, 2015
1 parent 159d583 commit 797fced
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 18 deletions.
5 changes: 0 additions & 5 deletions PlaylistDownloader/PlaylistDownloader.sln.DotSettings.user

This file was deleted.

35 changes: 23 additions & 12 deletions PlaylistDownloader/PlaylistDownloader/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,29 @@ protected override void OnDoWork(DoWorkEventArgs args)

try
{
//execute for both processes
Parallel.ForEach(_playlist, po, item =>
{
try
{
DownloadPlaylistItem(item, po);
//ConvertPlaylistItem(item, po);
}
catch (InvalidOperationException) { } //ignore exceptions when aborting download
catch (Win32Exception) { } //ignore process exception if killed during process exiting
});
}
// Parallal execution
Parallel.ForEach(_playlist, po, item =>
{
try
{
DownloadPlaylistItem(item, po);
//ConvertPlaylistItem(item, po);
}
catch (InvalidOperationException) { } //ignore exceptions when aborting download
catch (Win32Exception) { } //ignore process exception if killed during process exiting
});
// Serial execution
//foreach (PlaylistItem item in _playlist)
//{
// try
// {
// DownloadPlaylistItem(item, po);
// //ConvertPlaylistItem(item, po);
// }
// catch (InvalidOperationException) { } //ignore exceptions when aborting download
// catch (Win32Exception) { } //ignore process exception if killed during process exiting
//}
}
catch (OperationCanceledException) { } //ignore exceptions caused by canceling paralel.foreach loop
}

Expand Down
16 changes: 15 additions & 1 deletion PlaylistDownloader/PlaylistDownloader/SettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,21 @@ public SettingsWindow()
IsIndeterminate = false;
IsEditPanelVisible = true;
NumberOfResultsInput = "20";
}

// Update youtube-dl.exe
new Process
{
StartInfo =
{
FileName = "youtube-dl.exe",
Arguments = " -U",
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
RedirectStandardOutput = true,
UseShellExecute = false
}
}.Start();
}

public string PlayList
{
Expand Down

0 comments on commit 797fced

Please sign in to comment.