Skip to content

Commit

Permalink
[Feature] Proxy, Chapters, DynamicRange Tag, About
Browse files Browse the repository at this point in the history
  • Loading branch information
Kannagi authored and Kannagi committed Nov 29, 2022
1 parent 119672e commit b42bf51
Show file tree
Hide file tree
Showing 17 changed files with 426 additions and 59 deletions.
16 changes: 15 additions & 1 deletion languages/en-US/yt-dlp-gui.lang
Expand Up @@ -9,10 +9,17 @@ Main:
About: About...
# Tab Formats
Formats: Formats
Chapters: Chapters
ChaptersNone: "[None]"
ChaptersAll: "[All]"
ChaptersSplite: "[Split by Chapters]"
Video: Video
Audio: Audio
Subtitle: Subtitle
SubtitleIgnore: "[Ignore]"
SubtitleNone: "[None]"
VideoRes: Resolution
VideoDynamicRange: DR
VideoFPS: FPS
VideoExt: Ext.
VideoCodec: Codec
Expand All @@ -21,7 +28,7 @@ Main:
AudioExt: Ext.
AudioCodec: Codec
AudioSize: FileSize
# Tab Formats
# Tab Advance
Advance: Advance
EmbedSubs: Embed Subtitles
EmbedSubsEnabled: Enabled
Expand All @@ -37,6 +44,9 @@ Main:
RememberWindowState: Remember Window State
RememberWindowPosition: Position
RememberWindowSize: Size
Proxy: Proxy
ProxyEnabled: Enabled
ProxyHelper: "socks5://user:pass@127.0.0.1:1080/"
Cookie: Cookie
CookieWhenNeeded: When Needed
CookieNever: Never
Expand All @@ -61,6 +71,10 @@ About:
About: About
Website: Website
Authors: Authors
# Extended information can be modified arbitrarily
Extends:
Localization Author: カンナギ Kannagi
Localization Website: https://github.com/Kannagi0303/yt-dlp-gui
Releases:
Releases: Releases
Loading: Loading...
Expand Down
16 changes: 15 additions & 1 deletion languages/zh-TW/yt-dlp-gui.lang
Expand Up @@ -9,10 +9,17 @@ Main:
About: 關於...
# Tab Formats
Formats: 格式
Chapters: 章節
ChaptersNone: "[無]"
ChaptersAll: "[所有]"
ChaptersSplite: "[按照章節分割]"
Video: 視頻
Audio: 音頻
Subtitle: 字幕
SubtitleIgnore: "[不使用]"
SubtitleNone: "[無]"
VideoRes: 解析度
VideoDynamicRange: 色彩
VideoFPS: 幀率
VideoExt: 格式
VideoCodec: 編碼
Expand All @@ -21,7 +28,7 @@ Main:
AudioExt: 格式
AudioCodec: 編碼
AudioSize: 容量
# Tab Formats
# Tab Advance
Advance: 進階
EmbedSubs: 內嵌字幕
EmbedSubsEnabled: 啟用
Expand All @@ -37,6 +44,9 @@ Main:
RememberWindowState: 記憶視窗
RememberWindowPosition: 位置
RememberWindowSize: 尺寸
Proxy: 代理
ProxyEnabled: 啟用
ProxyHelper: "socks5://user:pass@127.0.0.1:1080/"
Cookie: Cookie
CookieWhenNeeded: 當需要時
CookieNever: 不使用
Expand All @@ -61,6 +71,10 @@ About:
About: 關於
Website: 網站
Authors: 作者
# Extended information can be modified arbitrarily
Extends:
繁中作者: カンナギ Kannagi
繁中網址: https://github.com/Kannagi0303/yt-dlp-gui
Releases:
Releases: 發行版本
Loading: 讀取中...
Expand Down
2 changes: 1 addition & 1 deletion yt-dlp-gui/App.xaml.cs
Expand Up @@ -8,7 +8,7 @@ namespace yt_dlp_gui {
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application {
public static string CurrentVersion = "2022.11.14";
public static string CurrentVersion = "2022.11.29";
public static Lang Lang { get; set; } = new();
private void Application_Startup(object sender, StartupEventArgs e) {
var args = e.Args.ToList();
Expand Down
27 changes: 16 additions & 11 deletions yt-dlp-gui/Controls/Duration.cs
Expand Up @@ -6,22 +6,27 @@ namespace yt_dlp_gui.Controls {
public abstract class Duration {
// Visible -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
public static readonly DependencyProperty SecsProperty
= DependencyProperty.RegisterAttached("Secs", typeof(double), typeof(Duration),
new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, SecsChanged));
= DependencyProperty.RegisterAttached("Secs", typeof(double?), typeof(Duration),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, SecsChanged));
private static void SecsChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e) {
var (d, v) = (dpo as TextBlock, GetSecs(dpo));
TimeSpan ts = TimeSpan.FromSeconds(v);
if (ts.Days > 0) {
d.Text = ts.ToString("d'.'hh':'mm':'ss");
} else if (ts.Hours > 0) {
d.Text = ts.ToString("h':'mm':'ss");
if (v.HasValue) {
TimeSpan ts = TimeSpan.FromSeconds(v.Value);
if (ts.Days > 0) {
d.Text = ts.ToString("d'.'hh':'mm':'ss");
} else if (ts.Hours > 0) {
d.Text = ts.ToString("h':'mm':'ss");
} else {
d.Text = ts.ToString("mm':'ss");
}
} else {
d.Text = ts.ToString("mm':'ss");
d.Text = "";
}
}
public static void SetSecs(DependencyObject dpo, double value)
public static void SetSecs(DependencyObject dpo, double? value)
=> dpo.SetValue(SecsProperty, value);
public static double GetSecs(DependencyObject dpo)
=> (double)dpo.GetValue(SecsProperty);
public static double? GetSecs(DependencyObject dpo)
=> (double?)dpo.GetValue(SecsProperty);

}
}
14 changes: 13 additions & 1 deletion yt-dlp-gui/Controls/TextView.xaml.cs
Expand Up @@ -26,6 +26,9 @@ public partial class TextView : UserControl, ITextView {
public static readonly DependencyProperty SyntaxProperty = DependencyProperty.RegisterAttached(
"Syntax", typeof(string), typeof(TextView),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, onSyntaxChanged));
public static readonly DependencyProperty EnableHyperlinksProperty = DependencyProperty.RegisterAttached(
"EnableHyperlinks", typeof(bool), typeof(TextView),
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, onLinkChanged));
private static void onTextChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e) {
var d = (dpo as TextView);
if (d != null) {
Expand All @@ -40,6 +43,11 @@ public partial class TextView : UserControl, ITextView {
var n = e.NewValue?.ToString() ?? "";
//d?.LoadDefinition(n);
}
private static void onLinkChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e) {
var d = (dpo as TextView);
d.textView.Options.EnableHyperlinks = d.EnableHyperlinks;
d.textView.Options.RequireControlModifierForHyperlinkClick = !d.EnableHyperlinks;
}
public string Text {
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
Expand All @@ -52,6 +60,10 @@ public partial class TextView : UserControl, ITextView {
get => (bool)GetValue(MultilineProperty);
set => SetValue(MultilineProperty, value);
}
public bool EnableHyperlinks {
get => (bool)GetValue(EnableHyperlinksProperty);
set => SetValue(EnableHyperlinksProperty, value);
}
public IHighlightingDefinition SyntaxDefinition {
set {
textView.LineTransformers.Clear();
Expand All @@ -61,7 +73,7 @@ public partial class TextView : UserControl, ITextView {
public TextView() {
InitializeComponent();
textView.Document = new TextDocument();
textView.Options.EnableHyperlinks = false;
textView.Options.EnableHyperlinks = EnableHyperlinks;
}
}
public interface ITextView {
Expand Down
15 changes: 15 additions & 0 deletions yt-dlp-gui/Models/Chapters.cs
@@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.ComponentModel;

namespace yt_dlp_gui.Models {
public enum ChaptersType {
None, Split, Segment
}
public class Chapters : INotifyPropertyChanged {
public event PropertyChangedEventHandler? PropertyChanged;
public decimal start_time { get; set; } = 0;
public string title { get; set; } = string.Empty;
public decimal end_time { get; set; } = 0;
public ChaptersType type { get; set; } = ChaptersType.Segment;
}
}
14 changes: 13 additions & 1 deletion yt-dlp-gui/Models/Lang.cs
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Collections.Generic;
using System.ComponentModel;

namespace yt_dlp_gui.Models {
public class Lang :INotifyPropertyChanged {
Expand All @@ -20,10 +21,17 @@ public class LangMain :INotifyPropertyChanged {
public string About { get; set; } = "About...";
//Tab Format
public string Formats { get; set; } = "Formats";
public string Chapters { get; set; } = "Chapters";
public string ChaptersNone { get; set; } = "[None]";
public string ChaptersAll { get; set; } = "[All]";
public string ChaptersSplite { get; set; } = "[Split by Chapters]";
public string Video { get; set; } = "Video";
public string Audio { get; set; } = "Audio";
public string Subtitle { get; set; } = "Subtitle";
public string SubtitleIgnore { get; set; } = "[Ignore]";
public string SubtitleNone { get; set; } = "[None]";
public string VideoRes { get; set; } = "Resolution";
public string VideoDynamicRange { get; set; } = "DR";
public string VideoFPS { get; set; } = "FPS";
public string VideoExt { get; set; } = "Ext.";
public string VideoCodec { get; set; } = "Codec";
Expand All @@ -48,6 +56,9 @@ public class LangMain :INotifyPropertyChanged {
public string RememberWindowState { get; set; } = "Remember Window State";
public string RememberWindowPosition { get; set; } = "Position";
public string RememberWindowSize { get; set; } = "Size";
public string Proxy { get; set; } = "Proxy";
public string ProxyEnabled { get; set; } = "Enabled";
public string ProxyHelper { get; set; } = "socks5://user:pass@127.0.0.1:1080/";
public string Cookie { get; set; } = "Cookie";
public string CookieWhenNeeded { get; set; } = "When Needed";
public string CookieNever { get; set; } = "Never";
Expand Down Expand Up @@ -76,6 +87,7 @@ public class LangAbout :INotifyPropertyChanged {
public string About { get; set; } = "About";
public string Website { get; set; } = "Website";
public string Authors { get; set; } = "Authors";
public Dictionary<string, string> Extends { get; set; } = new();
}
public class LangReleases :INotifyPropertyChanged {
public event PropertyChangedEventHandler? PropertyChanged;
Expand Down
1 change: 1 addition & 0 deletions yt-dlp-gui/Models/Video.cs
Expand Up @@ -16,5 +16,6 @@ public class Video : INotifyPropertyChanged {
public List<Format> requested_formats { get; set; } = new();
public string _filename { get; set; } = string.Empty;
public bool is_live { get; set; } = false;
public List<Chapters>? chapters { get; set; } = null;
}
}

0 comments on commit b42bf51

Please sign in to comment.