Added detection of already downloaded file
This commit is contained in:
9
YTdlp.cs
9
YTdlp.cs
@ -75,6 +75,7 @@ namespace ytdlp_gui
|
||||
|
||||
files = new List<string>();
|
||||
|
||||
this.already_downloaded_regex = new Regex(@"\[download\]\s+(.+) has already been downloaded");
|
||||
this.download_regex = new Regex(@"([0-9.]+)%\s+of\s+([0-9.]+)(\w+)\s+at\s+([0-9.]+)(\w+\/\w+)\sETA\s(\d+:\d+)");
|
||||
this.download_finish_regex = new Regex(@"([0-9.]+)%\s+of\s+([0-9.]+)(\w+)\s+in\s+(\d+:\d+:\d+)\s+at\s+([0-9.]+)(\w+\/\w+)");
|
||||
this.merge_regex = new Regex(@"Merging formats into ""(.+)""");
|
||||
@ -95,6 +96,13 @@ namespace ytdlp_gui
|
||||
}
|
||||
line = line.Trim();
|
||||
|
||||
Match match = this.already_downloaded_regex.Match(line);
|
||||
if (match.Success)
|
||||
{
|
||||
file = match.Groups[1].Value;
|
||||
break;
|
||||
}
|
||||
|
||||
if (line.StartsWith("[info] "))
|
||||
ProgInfo(line.Substring("[info] ".Length).TrimStart());
|
||||
|
||||
@ -189,6 +197,7 @@ namespace ytdlp_gui
|
||||
|
||||
private readonly Process process;
|
||||
private readonly CultureInfo ci;
|
||||
private readonly Regex already_downloaded_regex;
|
||||
private readonly Regex download_regex;
|
||||
private readonly Regex download_finish_regex;
|
||||
private readonly Regex merge_regex;
|
||||
|
||||
Reference in New Issue
Block a user