Skip to content

Commit

Permalink
more updates
Browse files Browse the repository at this point in the history
yt-dlp is now the default youtube-dl branch, but you will have to change the fork to select it again.
generic progress downloader form to show some download progress for youtube-dl and ffmpeg.
also you can download ffmpeg now.
  • Loading branch information
murrty committed Sep 13, 2022
1 parent 1f5972e commit 042ac95
Show file tree
Hide file tree
Showing 26 changed files with 1,526 additions and 902 deletions.
27 changes: 17 additions & 10 deletions Controls/ExtendedProgressBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,14 @@ public bool ShowTextDropShadow {
get => base.Style;
set {
base.Style = value;
if (_ShowInTaskbar && _ContainerParent != null) {
SetStateInTaskbar();
SetValueInTaskbar();
}
if (value != ProgressBarStyle.Marquee && this.IsHandleCreated) {
NativeMethods.SendMessage(Handle, PBM_SETSTATE, (IntPtr)_ProgressState, IntPtr.Zero);
if (this.IsHandleCreated) {
if (_ShowInTaskbar && _ContainerParent != null) {
SetStateInTaskbar();
SetValueInTaskbar();
}
if (value != ProgressBarStyle.Marquee) {
NativeMethods.SendMessage(Handle, PBM_SETSTATE, (IntPtr)_ProgressState, IntPtr.Zero);
}
}
}
}
Expand Down Expand Up @@ -403,9 +405,10 @@ protected override void OnHandleCreated(EventArgs e) {
base.OnHandleCreated(e);
TextGraphics = CreateGraphics();
TextSize = TextGraphics.MeasureString(Text, Font);
if (ProgressState != ProgressBarState.Normal) {
NativeMethods.SendMessage(Handle, PBM_SETSTATE, (nint)ProgressState, IntPtr.Zero);
SetStateInTaskbar();
if (DesignMode) {
if (ProgressState != ProgressBarState.Normal) {
NativeMethods.SendMessage(Handle, PBM_SETSTATE, (nint)ProgressState, IntPtr.Zero);
}
}
}

Expand Down Expand Up @@ -455,7 +458,11 @@ protected override void WndProc(ref Message m) {

#region Events
internal void ExtendedProgressBar_Shown(object sender, EventArgs e) {
if (_ShowInTaskbar) {
if (ProgressState != ProgressBarState.Normal) {
NativeMethods.SendMessage(Handle, PBM_SETSTATE, (nint)ProgressState, IntPtr.Zero);
}

if (ShowInTaskbar) {
if (Style != ProgressBarStyle.Marquee) {
SetValueInTaskbar();
}
Expand Down
20 changes: 10 additions & 10 deletions youtube-dl-gui-updater/Classes/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public static class Language {
public static string lbExceptionDescription { get; private set; }
public static string rtbExceptionDetails { get; private set; }
public static string btnExceptionGithub { get; private set; }
public static string tpExceptionDetails { get; private set; }
public static string tpExceptionExtraInfo { get; private set; }
public static string tabExceptionDetails { get; private set; }
public static string tabExceptionExtraInfo { get; private set; }

public static string frmUpdater { get; private set; }
public static string lbUpdaterHeader { get; private set; }
Expand Down Expand Up @@ -51,8 +51,8 @@ public static class InternalEnglish {
public const string lbExceptionDescription = "Below is the error that occured. Feel free to open a new issue and report it.";
public const string rtbExceptionDetails = "Feel free to copy + paste this entire text wall into a new issue on Github";
public const string btnExceptionGithub = "Github";
public const string tpExceptionDetails = "Exception details";
public const string tpExceptionExtraInfo = "Extra info";
public const string tabExceptionDetails = "Exception details";
public const string tabExceptionExtraInfo = "Extra info";

public const string frmUpdater = "Updating";
public const string lbUpdaterHeader = "Updating youtube-dl-gui";
Expand Down Expand Up @@ -85,8 +85,8 @@ public static void LoadInternalEnglish() {
lbExceptionDescription = InternalEnglish.lbExceptionDescription;
rtbExceptionDetails = InternalEnglish.rtbExceptionDetails;
btnExceptionGithub = InternalEnglish.btnExceptionGithub;
tpExceptionDetails = InternalEnglish.tpExceptionDetails;
tpExceptionExtraInfo = InternalEnglish.tpExceptionExtraInfo;
tabExceptionDetails = InternalEnglish.tabExceptionDetails;
tabExceptionExtraInfo = InternalEnglish.tabExceptionExtraInfo;

frmUpdater = InternalEnglish.frmUpdater;
lbUpdaterHeader = InternalEnglish.lbUpdaterHeader;
Expand Down Expand Up @@ -163,11 +163,11 @@ public static bool LoadLanguage(string LanguageFile = null) {
case "btnexceptiongithub":
btnExceptionGithub = ReadValue;
continue;
case "tpexceptiondetails":
tpExceptionDetails = ReadValue;
case "tabexceptiondetails":
tabExceptionDetails = ReadValue;
continue;
case "tpexceptionextrainfo":
tpExceptionExtraInfo = ReadValue;
case "tabexceptionextrainfo":
tabExceptionExtraInfo = ReadValue;
continue;

case "frmupdater":
Expand Down
6 changes: 3 additions & 3 deletions youtube-dl-gui/Classes/DataClasses/DownloaderData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public string Duration {
if (DurationTime is not null) {
int hours = 0;
int minutes = 0;
long seconds = DurationTime.Value;
decimal seconds = DurationTime.Value;

while (seconds >= 60) {
minutes++;
Expand All @@ -133,7 +133,7 @@ public string Duration {
minutes -= 60;
}

return $"{(hours > 0 ? $"{hours:N0}:{minutes:00.##}" : $"{minutes}")}:{seconds:00.##}";
return $"{(hours > 0 ? $"{hours:N0}:{minutes:00.##}" : $"{minutes}")}:{Math.Round(seconds, MidpointRounding.ToEven):00.##}";
}

return DurationString.IsNullEmptyWhitespace() ? "???" : DurationString;
Expand Down Expand Up @@ -162,7 +162,7 @@ public string Duration {
public string DurationString { get; set; }

[DataMember(Name = "duration")]
public long? DurationTime { get; set; }
public decimal? DurationTime { get; set; }

[DataContract(Name = "formats")]
public class Format {
Expand Down
Loading

0 comments on commit 042ac95

Please sign in to comment.