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

Bump to v1.2.7 #16

Merged
merged 12 commits into from
Sep 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Crunchyroll-Downloader/AboutWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<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"/>
<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"/>
<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"/>
<Label Grid.Row="3" x:Name="label_4" Content="Version : v1.2.6c" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Foreground="White" Height="26" Width="295"/>
<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"/>
<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"/>
</Grid>
</Window>
22 changes: 13 additions & 9 deletions Crunchyroll-Downloader/DownloadWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,25 @@ namespace CrunchyrollDownloader
public partial class DownloadWindow : Window
{

public string MyString { get; set; }

public DownloadWindow()
{
Closing += new System.ComponentModel.CancelEventHandler(Window_Closing);
//var machin = new Program();
//dl_label.Content = machin.DlStatus;

//download_bar.IsIndeterminate = true;
InitializeComponent();

//download_bar.Value = 1;
//dl_status.progress = "1";


//download_bar.Value = double.Parse(dl_status.progress);

}

dl_label.Content = this.MyString;

//download_bar.Value = 1;
//dl_status.progress = "1";


//download_bar.Value = double.Parse(dl_status.progress);

}

void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) => e.Cancel = true;
}
Expand Down
2 changes: 1 addition & 1 deletion Crunchyroll-Downloader/LoginWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private void button_login_Click(object sender, RoutedEventArgs e)

var process = new Process();
// Configure the process using the StartInfo properties.
process.StartInfo.FileName = @"C:\ProgramData\Crunchy-DL\login\login.exe";
process.StartInfo.FileName = @"C:\ProgramData\Crunchy-DL\login.exe";
process.StartInfo.Arguments = $"{username} {password}";
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
Expand Down
193 changes: 73 additions & 120 deletions Crunchyroll-Downloader/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Windows.Forms;
using MessageBox = System.Windows.MessageBox;

namespace CrunchyrollDownloader
{
Expand All @@ -29,63 +31,38 @@ public MainWindow()
{
if (File.Exists(@"C:\ProgramData\Crunchy-DL\youtube-dl.exe"))
{
if (Directory.Exists(@"C:\ProgramData\Crunchy-DL\login"))
if (File.Exists(@"C:\ProgramData\Crunchy-DL\login.exe"))
{
if (File.Exists(@"C:\ProgramData\Crunchy-DL\login\v1.2.3.txt"))
{
InitializeComponent();
CheckCookie();
}
else
{
File.Delete(@"C:\ProgramData\Crunchy-DL\login.zip");
Directory.Delete(@"C:\ProgramData\Crunchy-DL\login", true);
client.DownloadFile("http://download.tucr.tk/login.zip", @"C:\ProgramData\Crunchy-DL\login.zip");
zip.ExtractZip(actualFolder + @"\login.zip", actualFolder, "");
InitializeComponent();
CheckCookie();
}

InitializeComponent();
CheckCookie();
}
else
{
if (File.Exists(@"C:\ProgramData\Crunchy-DL\login.zip"))
{
zip.ExtractZip(actualFolder + @"\login.zip", actualFolder, "");
InitializeComponent();
CheckCookie();
}
else
{
client.DownloadFile("http://download.tucr.tk/login.zip", @"C:\ProgramData\Crunchy-DL\login.zip");
zip.ExtractZip(actualFolder + @"\login.zip", actualFolder, "");
InitializeComponent();
CheckCookie();
}
MessageBox.Show("Dependencies seems corrupted or missing, click OK to re-download them.", "Important Note", MessageBoxButton.OK, MessageBoxImage.Information);
Directory.Delete(actualFolder, true);
InstallAll();
}
}
else
{
client.DownloadFile("https://yt-dl.org/downloads/latest/youtube-dl.exe", @"C:\ProgramData\Crunchy-DL\youtube-dl.exe");
UpdateYTDL();
InitializeComponent();
CheckCookie();
MessageBox.Show("Dependencies seems corrupted or missing, click OK to re-download them.", "Important Note", MessageBoxButton.OK, MessageBoxImage.Information);
Directory.Delete(actualFolder, true);
InstallAll();
}
}
else
{
if (File.Exists(@"C:\ProgramData\Crunchy-DL\ffmpeg.zip"))
{
zip.ExtractZip(actualFolder + @"\ffmpeg.zip", actualFolder, "");
InitializeComponent();
CheckCookie();
MessageBox.Show("Dependencies seems corrupted or missing, click OK to re-download them.", "Important Note", MessageBoxButton.OK, MessageBoxImage.Information);
Directory.Delete(actualFolder, true);
InstallAll();
}
else
{
client.DownloadFile("http://download.tucr.tk/ffmpeg.zip", @"C:\ProgramData\Crunchy-DL\ffmpeg.zip");
zip.ExtractZip(actualFolder + @"\ffmpeg.zip", actualFolder, "");
InitializeComponent();
CheckCookie();
MessageBox.Show("Dependencies seems corrupted or missing, click OK to re-download them.", "Important Note", MessageBoxButton.OK, MessageBoxImage.Information);
Directory.Delete(actualFolder, true);
InstallAll();
}
}
}
Expand Down Expand Up @@ -119,85 +96,61 @@ private void UpdateYTDL()
process.WaitForExit(); // Waits here for the process to exit.
}

public string dl_label { get; private set; }

private void InstallAll()
{
//var machin = new Program();
var viewerThread = new Thread(() =>
var viewerThread = new Thread(() =>
{
var download_window = new DownloadWindow();
download_window.MyString = dl_label;
download_window.Show();
download_window.Activate();
download_window.Closed += (s, e) =>
Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Normal);
Dispatcher.Run();
});
viewerThread.SetApartmentState(ApartmentState.STA); // needs to be STA or throws exception
var actualFolder = @"C:\ProgramData\Crunchy-DL";
var zip = new FastZip();
MessageBox.Show("Youtube-DL & FFmpeg not detected, downloading ...", "Important Note", MessageBoxButton.OK, MessageBoxImage.Information);
Directory.CreateDirectory(@"C:\ProgramData\Crunchy-DL");
//machin.DlStatus = "Downloading Youtube-DL";
string dl_url = "https://yt-dl.org/downloads/latest/youtube-dl.exe";
string dl_path = @"C:\ProgramData\Crunchy-DL\youtube-dl.exe";
viewerThread.Start();
startDownload(dl_url, dl_path);
//viewerThread.Abort();
//machin.DlStatus = "Downloading FFmpeg";
dl_url = "http://download.tucr.tk/ffmpeg.zip";
dl_path = @"C:\ProgramData\Crunchy-DL\ffmpeg.zip";
//viewerThread.Start();
startDownload(dl_url, dl_path);
//viewerThread.Abort();
//machin.DlStatus = "Downloading CrunchyrollAuth";
dl_url = "http://download.tucr.tk/login.zip";
dl_path = @"C:\ProgramData\Crunchy-DL\login.zip";
//viewerThread.Start();
startDownload(dl_url, dl_path);
//viewerThread.Abort();

//machin.DlStatus = "Extracting ...";
//viewerThread.Start();
zip.ExtractZip(actualFolder + @"\ffmpeg.zip", actualFolder, "");
zip.ExtractZip(actualFolder + @"\login.zip", actualFolder, "");
UpdateYTDL();
MessageBox.Show("youtube-dl and FFmpeg are now installed.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
viewerThread.Abort();
InitializeComponent();
CheckCookie();

}
var actualFolder = @"C:\ProgramData\Crunchy-DL";
using (var client = new WebClient())
{
var zip = new FastZip();
//MessageBox.Show("Dependencies not detected, downloading ...", "Important Note", MessageBoxButton.OK, MessageBoxImage.Information);
Directory.CreateDirectory(@"C:\ProgramData\Crunchy-DL");
//dl_label="[1/3] Downloading dependencies : Youtube-DL ...";
viewerThread.Start();
client.DownloadFile("https://yt-dl.org/downloads/latest/youtube-dl.exe", @"C:\ProgramData\Crunchy-DL\youtube-dl.exe");
//viewerThread.Abort();
//dl_label = "[2/3] Downloading dependencies : FFmpeg ...";
//viewerThread.Start();
client.DownloadFile("https://raw.githubusercontent.com/skid9000/Crunchyroll-Downloader/develop/FFmpeg/ffmpeg.zip", @"C:\ProgramData\Crunchy-DL\ffmpeg.zip");
client.DownloadFile("https://raw.githubusercontent.com/skid9000/Crunchyroll-Downloader/develop/FFmpeg/ffplay.zip", @"C:\ProgramData\Crunchy-DL\ffplay.zip");
client.DownloadFile("https://raw.githubusercontent.com/skid9000/Crunchyroll-Downloader/develop/FFmpeg/ffprobe.zip", @"C:\ProgramData\Crunchy-DL\ffprobe.zip");
//viewerThread.Abort();
//dl_label = "[3/3] Downloading dependencies : Crunchyroll-Auth ...";
//viewerThread.Start();
client.DownloadFile("https://github.com/skid9000/CrunchyrollAuth/releases/download/1.0/login.exe", @"C:\ProgramData\Crunchy-DL\login.exe");
//viewerThread.Abort();

private void startDownload(string dl_url, string dl_path)
{
WebClient client = new WebClient();
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
client.DownloadFile(new Uri(dl_url), dl_path);
}
void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
double bytesIn = double.Parse(e.BytesReceived.ToString());
double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
double percentage = bytesIn / totalBytes * 100;
int lol = int.Parse(Math.Truncate(percentage).ToString());
string lol2 = lol.ToString();
}
void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
return;
//dl_label = "Extracting ...";
//viewerThread.Start();
zip.ExtractZip(actualFolder + @"\ffmpeg.zip", actualFolder, "");
zip.ExtractZip(actualFolder + @"\ffplay.zip", actualFolder, "");
zip.ExtractZip(actualFolder + @"\ffprobe.zip", actualFolder, "");
viewerThread.Abort();
MessageBox.Show("youtube-dl and FFmpeg are now installed.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
InitializeComponent();
CheckCookie();
}
}

private void button_Save_Click(object sender, RoutedEventArgs e)
{
// Create OpenFileDialog
var dialog = new SaveFileDialog
{
DefaultExt = ".mp4",
Filter = "Mp4 | *.mp4"
};
var result = dialog.ShowDialog();
if (result ?? false)
save_TextBox.Text = dialog.FileName;
// Create OpenFileDialog
var dialog = new FolderBrowserDialog();
var result = dialog.ShowDialog();
save_TextBox.Text = dialog.SelectedPath;
}

private void button_Click(object sender, RoutedEventArgs e)
Expand All @@ -223,23 +176,23 @@ private void button_Click(object sender, RoutedEventArgs e)
else if (comboBox.Text == "Русский")
machin.Langue = "ruRU";

if (QualitycomboBox.Text == "Best (recommended)")
machin.Quality = "best";
else if (QualitycomboBox.Text == "1080p")
machin.Quality = "1080";
else if (QualitycomboBox.Text == "720p")
machin.Quality = "720";
else if (QualitycomboBox.Text == "480p")
machin.Quality = "480";
else if (QualitycomboBox.Text == "360p")
machin.Quality = "360";
if (QualitycomboBox.Text == "Best (recommended)")
machin.Quality = "best";
else if (QualitycomboBox.Text == "1080p")
machin.Quality = "1080";
else if (QualitycomboBox.Text == "720p")
machin.Quality = "720";
else if (QualitycomboBox.Text == "480p")
machin.Quality = "480";
else if (QualitycomboBox.Text == "360p")
machin.Quality = "360";

if (MkvcheckBox.IsChecked.Value == true)
machin.MkvStatus = "1";
else
machin.MkvStatus = "0";
if (MkvcheckBox.IsChecked.Value == true)
machin.MkvStatus = "1";
else
machin.MkvStatus = "0";

machin.Format = comboBox_Copy.Text;
machin.Format = comboBox_Copy.Text;
machin.Url = urlBox.Text;
machin.SavePath = save_TextBox.Text;
machin.STState = "0";
Expand Down Expand Up @@ -303,9 +256,9 @@ private void CheckBoxChanged()
{
comboBox.IsEnabled = checkBox.IsChecked.Value;
comboBox_Copy.IsEnabled = checkBox.IsChecked.Value;
MkvcheckBox.IsEnabled = checkBox.IsChecked.Value;
MkvcheckBox.IsEnabled = checkBox.IsChecked.Value;

}
}
private void checkBox_Checked(object sender, RoutedEventArgs e) => CheckBoxChanged();
private void checkBox_Unchecked(object sender, RoutedEventArgs e) => CheckBoxChanged();

Expand All @@ -322,5 +275,5 @@ private void button_logout_Click(object sender, RoutedEventArgs e)
button_login.IsEnabled = true;
button_logout.IsEnabled = false;
}
}
}
}
12 changes: 6 additions & 6 deletions Crunchyroll-Downloader/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ public void Downloading()
var process = new Process();
// Configure the process using the StartInfo properties.
process.StartInfo.FileName = @"C:\ProgramData\Crunchy-DL\youtube-dl.exe";
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
// process.StartInfo.RedirectStandardOutput = true;

if (MkvStatus == "1")
{
if (STState == "1")
{
if (Quality == "best")
process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f best --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
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}";
else
process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
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}";
}
else
{
if (Quality == "best")
process.StartInfo.Arguments = $"-f best --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
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}";
else
process.StartInfo.Arguments = $"-f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
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}";
}
}
else
Expand Down Expand Up @@ -83,4 +83,4 @@ public void Downloading()

}
}
}
}
4 changes: 2 additions & 2 deletions Crunchyroll-Downloader/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.6.0")]
[assembly: AssemblyFileVersion("1.2.6.0")]
[assembly: AssemblyVersion("1.2.7.0")]
[assembly: AssemblyFileVersion("1.2.7.0")]
[assembly: NeutralResourcesLanguage("en")]

Empty file added FFmpeg/README.md
Empty file.
Binary file added FFmpeg/ffmpeg.zip
Binary file not shown.
Binary file added FFmpeg/ffplay.zip
Binary file not shown.
Binary file added FFmpeg/ffprobe.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A little GUI to download crap from Crunchyroll.

***You need a premium Crunchyroll account to use this tool !***

Require at least [.NET FrameWork 4.7.1](https://www.microsoft.com/en-US/download/details.aspx?id=56116) and [Microsoft Visual C++ 2010 Redistributable Package (x86)](https://www.microsoft.com/en-US/download/details.aspx?id=5555)
Require at least [.NET FrameWork 4.7.1](https://www.microsoft.com/en-US/download/details.aspx?id=56116) and [Microsoft Visual C++ 2010 Redistributable Package (x86)](https://www.microsoft.com/en-US/download/details.aspx?id=5555) and now (thanks to CloudFlare -_-') [NodeJS](https://nodejs.org/dist/v8.11.4/node-v8.11.4-x64.msi).

This tool use [youtube-dl](https://github.com/rg3/youtube-dl), [ffmpeg](https://ffmpeg.org/) and [CrunchyrollAuth](https://github.com/skid9000/CrunchyrollAuth).

Expand Down