Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

Commit 8f99a86

Browse files
author
Skid
committed
Fix my stupidity, and also #17
1 parent d96e19b commit 8f99a86

File tree

2 files changed

+59
-57
lines changed

2 files changed

+59
-57
lines changed

Crunchyroll-Downloader/AboutWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<Label Grid.Row="0" x:Name="label_1" Content="This tool is under the AGPLv3 license." HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Foreground="White" Height="26" Width="207"/>
2020
<Label Grid.Row="1" x:Name="label_2" Content="All informations on github." HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Foreground="White" Height="26" Width="151"/>
2121
<Label Grid.Row="2" x:Name="label_3" Content="https://github.com/skid9000/Crunchyroll-Downloader" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Foreground="White" Height="26" Width="295"/>
22-
<Label Grid.Row="3" x:Name="label_4" Content="Version : v1.2.7" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Foreground="White" Height="26" Width="295"/>
22+
<Label Grid.Row="3" x:Name="label_4" Content="Version : v1.2.7c" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Foreground="White" Height="26" Width="295"/>
2323
<Button Grid.Row="4" x:Name="button" Content="Update Youtube-DL" HorizontalAlignment="Left" Margin="10,15,0,0" VerticalAlignment="Top" Height="34" Width="372" Click="button_Click"/>
2424
</Grid>
2525
</Window>

Crunchyroll-Downloader/Program.cs

Lines changed: 58 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ public class Program
1313
public string Format { get; set; }
1414
public string SavePath { get; set; }
1515
public string Quality { get; set; }
16-
public string MkvStatus { get; set; }
17-
public string DlStatus { get; set; }
16+
public string MkvStatus { get; set; }
17+
public string DlStatus { get; set; }
1818

19-
/// <summary>
20-
/// Downloadings a file.
21-
/// </summary>
22-
public void Downloading()
19+
/// <summary>
20+
/// Downloadings a file.
21+
/// </summary>
22+
public void Downloading()
2323
{
2424
var dl_status = new Program();
2525
var process = new Process();
@@ -28,59 +28,61 @@ public void Downloading()
2828
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
2929
// process.StartInfo.RedirectStandardOutput = true;
3030

31-
if (MkvStatus == "1")
32-
{
33-
if (STState == "1")
34-
{
35-
if (Quality == "best")
36-
process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f best --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
37-
else
38-
process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
39-
}
40-
else
41-
{
42-
if (Quality == "best")
43-
process.StartInfo.Arguments = $"-f best --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
44-
else
45-
process.StartInfo.Arguments = $"-f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
46-
}
47-
}
48-
else
49-
{
50-
if (STState == "1")
51-
{
52-
if (Quality == "best")
53-
process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f best --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
54-
else
55-
process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
56-
}
57-
else
58-
{
59-
if (Quality == "best")
60-
process.StartInfo.Arguments = $"-f best --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
61-
else
62-
process.StartInfo.Arguments = $"-f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
63-
}
64-
}
31+
SavePath = SavePath + @"\%(title)s.%(ext)s";
32+
33+
if (MkvStatus == "1")
34+
{
35+
if (STState == "1")
36+
{
37+
if (Quality == "best")
38+
process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f best --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
39+
else
40+
process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
41+
}
42+
else
43+
{
44+
if (Quality == "best")
45+
process.StartInfo.Arguments = $"-f best --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
46+
else
47+
process.StartInfo.Arguments = $"-f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
48+
}
49+
}
50+
else
51+
{
52+
if (STState == "1")
53+
{
54+
if (Quality == "best")
55+
process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f best --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
56+
else
57+
process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
58+
}
59+
else
60+
{
61+
if (Quality == "best")
62+
process.StartInfo.Arguments = $"-f best --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
63+
else
64+
process.StartInfo.Arguments = $"-f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
65+
}
66+
}
6567

6668

67-
var viewerThread = new Thread(() =>
68-
{
69-
var download_window = new DownloadWindow();
70-
download_window.Show();
71-
download_window.Activate();
72-
download_window.Closed += (s, e) =>
73-
Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Normal);
74-
Dispatcher.Run();
75-
});
76-
viewerThread.SetApartmentState(ApartmentState.STA); // needs to be STA or throws exception
77-
viewerThread.Start();
69+
var viewerThread = new Thread(() =>
70+
{
71+
var download_window = new DownloadWindow();
72+
download_window.Show();
73+
download_window.Activate();
74+
download_window.Closed += (s, e) =>
75+
Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Normal);
76+
Dispatcher.Run();
77+
});
78+
viewerThread.SetApartmentState(ApartmentState.STA); // needs to be STA or throws exception
79+
viewerThread.Start();
7880

79-
process.Start();
80-
process.WaitForExit();// Waits here for the process to exit.
81-
viewerThread.Abort();
82-
MessageBox.Show("Download finished !", "Success !", MessageBoxButton.OK, MessageBoxImage.Information);
81+
process.Start();
82+
process.WaitForExit();// Waits here for the process to exit.
83+
viewerThread.Abort();
84+
MessageBox.Show("Download finished !", "Success !", MessageBoxButton.OK, MessageBoxImage.Information);
8385

84-
}
86+
}
8587
}
8688
}

0 commit comments

Comments
 (0)