Skip to content

Commit b42bf51

Browse files
KannagiKannagi
Kannagi
authored and
Kannagi
committed
[Feature] Proxy, Chapters, DynamicRange Tag, About
1 parent 119672e commit b42bf51

File tree

17 files changed

+426
-59
lines changed

17 files changed

+426
-59
lines changed

languages/en-US/yt-dlp-gui.lang

+15-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ Main:
99
About: About...
1010
# Tab Formats
1111
Formats: Formats
12+
Chapters: Chapters
13+
ChaptersNone: "[None]"
14+
ChaptersAll: "[All]"
15+
ChaptersSplite: "[Split by Chapters]"
1216
Video: Video
1317
Audio: Audio
1418
Subtitle: Subtitle
19+
SubtitleIgnore: "[Ignore]"
20+
SubtitleNone: "[None]"
1521
VideoRes: Resolution
22+
VideoDynamicRange: DR
1623
VideoFPS: FPS
1724
VideoExt: Ext.
1825
VideoCodec: Codec
@@ -21,7 +28,7 @@ Main:
2128
AudioExt: Ext.
2229
AudioCodec: Codec
2330
AudioSize: FileSize
24-
# Tab Formats
31+
# Tab Advance
2532
Advance: Advance
2633
EmbedSubs: Embed Subtitles
2734
EmbedSubsEnabled: Enabled
@@ -37,6 +44,9 @@ Main:
3744
RememberWindowState: Remember Window State
3845
RememberWindowPosition: Position
3946
RememberWindowSize: Size
47+
Proxy: Proxy
48+
ProxyEnabled: Enabled
49+
ProxyHelper: "socks5://user:[email protected]:1080/"
4050
Cookie: Cookie
4151
CookieWhenNeeded: When Needed
4252
CookieNever: Never
@@ -61,6 +71,10 @@ About:
6171
About: About
6272
Website: Website
6373
Authors: Authors
74+
# Extended information can be modified arbitrarily
75+
Extends:
76+
Localization Author: カンナギ Kannagi
77+
Localization Website: https://github.com/Kannagi0303/yt-dlp-gui
6478
Releases:
6579
Releases: Releases
6680
Loading: Loading...

languages/zh-TW/yt-dlp-gui.lang

+15-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ Main:
99
About: 關於...
1010
# Tab Formats
1111
Formats: 格式
12+
Chapters: 章節
13+
ChaptersNone: "[無]"
14+
ChaptersAll: "[所有]"
15+
ChaptersSplite: "[按照章節分割]"
1216
Video: 視頻
1317
Audio: 音頻
1418
Subtitle: 字幕
19+
SubtitleIgnore: "[不使用]"
20+
SubtitleNone: "[無]"
1521
VideoRes: 解析度
22+
VideoDynamicRange: 色彩
1623
VideoFPS: 幀率
1724
VideoExt: 格式
1825
VideoCodec: 編碼
@@ -21,7 +28,7 @@ Main:
2128
AudioExt: 格式
2229
AudioCodec: 編碼
2330
AudioSize: 容量
24-
# Tab Formats
31+
# Tab Advance
2532
Advance: 進階
2633
EmbedSubs: 內嵌字幕
2734
EmbedSubsEnabled: 啟用
@@ -37,6 +44,9 @@ Main:
3744
RememberWindowState: 記憶視窗
3845
RememberWindowPosition: 位置
3946
RememberWindowSize: 尺寸
47+
Proxy: 代理
48+
ProxyEnabled: 啟用
49+
ProxyHelper: "socks5://user:[email protected]:1080/"
4050
Cookie: Cookie
4151
CookieWhenNeeded: 當需要時
4252
CookieNever: 不使用
@@ -61,6 +71,10 @@ About:
6171
About: 關於
6272
Website: 網站
6373
Authors: 作者
74+
# Extended information can be modified arbitrarily
75+
Extends:
76+
繁中作者: カンナギ Kannagi
77+
繁中網址: https://github.com/Kannagi0303/yt-dlp-gui
6478
Releases:
6579
Releases: 發行版本
6680
Loading: 讀取中...

yt-dlp-gui/App.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace yt_dlp_gui {
88
/// Interaction logic for App.xaml
99
/// </summary>
1010
public partial class App : Application {
11-
public static string CurrentVersion = "2022.11.14";
11+
public static string CurrentVersion = "2022.11.29";
1212
public static Lang Lang { get; set; } = new();
1313
private void Application_Startup(object sender, StartupEventArgs e) {
1414
var args = e.Args.ToList();

yt-dlp-gui/Controls/Duration.cs

+16-11
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,27 @@ namespace yt_dlp_gui.Controls {
66
public abstract class Duration {
77
// Visible -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
88
public static readonly DependencyProperty SecsProperty
9-
= DependencyProperty.RegisterAttached("Secs", typeof(double), typeof(Duration),
10-
new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, SecsChanged));
9+
= DependencyProperty.RegisterAttached("Secs", typeof(double?), typeof(Duration),
10+
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, SecsChanged));
1111
private static void SecsChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e) {
1212
var (d, v) = (dpo as TextBlock, GetSecs(dpo));
13-
TimeSpan ts = TimeSpan.FromSeconds(v);
14-
if (ts.Days > 0) {
15-
d.Text = ts.ToString("d'.'hh':'mm':'ss");
16-
} else if (ts.Hours > 0) {
17-
d.Text = ts.ToString("h':'mm':'ss");
13+
if (v.HasValue) {
14+
TimeSpan ts = TimeSpan.FromSeconds(v.Value);
15+
if (ts.Days > 0) {
16+
d.Text = ts.ToString("d'.'hh':'mm':'ss");
17+
} else if (ts.Hours > 0) {
18+
d.Text = ts.ToString("h':'mm':'ss");
19+
} else {
20+
d.Text = ts.ToString("mm':'ss");
21+
}
1822
} else {
19-
d.Text = ts.ToString("mm':'ss");
23+
d.Text = "";
2024
}
2125
}
22-
public static void SetSecs(DependencyObject dpo, double value)
26+
public static void SetSecs(DependencyObject dpo, double? value)
2327
=> dpo.SetValue(SecsProperty, value);
24-
public static double GetSecs(DependencyObject dpo)
25-
=> (double)dpo.GetValue(SecsProperty);
28+
public static double? GetSecs(DependencyObject dpo)
29+
=> (double?)dpo.GetValue(SecsProperty);
30+
2631
}
2732
}

yt-dlp-gui/Controls/TextView.xaml.cs

+13-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public partial class TextView : UserControl, ITextView {
2626
public static readonly DependencyProperty SyntaxProperty = DependencyProperty.RegisterAttached(
2727
"Syntax", typeof(string), typeof(TextView),
2828
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, onSyntaxChanged));
29+
public static readonly DependencyProperty EnableHyperlinksProperty = DependencyProperty.RegisterAttached(
30+
"EnableHyperlinks", typeof(bool), typeof(TextView),
31+
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, onLinkChanged));
2932
private static void onTextChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e) {
3033
var d = (dpo as TextView);
3134
if (d != null) {
@@ -40,6 +43,11 @@ private static void onSyntaxChanged(DependencyObject dpo, DependencyPropertyChan
4043
var n = e.NewValue?.ToString() ?? "";
4144
//d?.LoadDefinition(n);
4245
}
46+
private static void onLinkChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e) {
47+
var d = (dpo as TextView);
48+
d.textView.Options.EnableHyperlinks = d.EnableHyperlinks;
49+
d.textView.Options.RequireControlModifierForHyperlinkClick = !d.EnableHyperlinks;
50+
}
4351
public string Text {
4452
get => (string)GetValue(TextProperty);
4553
set => SetValue(TextProperty, value);
@@ -52,6 +60,10 @@ public bool Multiline {
5260
get => (bool)GetValue(MultilineProperty);
5361
set => SetValue(MultilineProperty, value);
5462
}
63+
public bool EnableHyperlinks {
64+
get => (bool)GetValue(EnableHyperlinksProperty);
65+
set => SetValue(EnableHyperlinksProperty, value);
66+
}
5567
public IHighlightingDefinition SyntaxDefinition {
5668
set {
5769
textView.LineTransformers.Clear();
@@ -61,7 +73,7 @@ public IHighlightingDefinition SyntaxDefinition {
6173
public TextView() {
6274
InitializeComponent();
6375
textView.Document = new TextDocument();
64-
textView.Options.EnableHyperlinks = false;
76+
textView.Options.EnableHyperlinks = EnableHyperlinks;
6577
}
6678
}
6779
public interface ITextView {

yt-dlp-gui/Models/Chapters.cs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Collections.Generic;
2+
using System.ComponentModel;
3+
4+
namespace yt_dlp_gui.Models {
5+
public enum ChaptersType {
6+
None, Split, Segment
7+
}
8+
public class Chapters : INotifyPropertyChanged {
9+
public event PropertyChangedEventHandler? PropertyChanged;
10+
public decimal start_time { get; set; } = 0;
11+
public string title { get; set; } = string.Empty;
12+
public decimal end_time { get; set; } = 0;
13+
public ChaptersType type { get; set; } = ChaptersType.Segment;
14+
}
15+
}

yt-dlp-gui/Models/Lang.cs

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.ComponentModel;
1+
using System.Collections.Generic;
2+
using System.ComponentModel;
23

34
namespace yt_dlp_gui.Models {
45
public class Lang :INotifyPropertyChanged {
@@ -20,10 +21,17 @@ public class LangMain :INotifyPropertyChanged {
2021
public string About { get; set; } = "About...";
2122
//Tab Format
2223
public string Formats { get; set; } = "Formats";
24+
public string Chapters { get; set; } = "Chapters";
25+
public string ChaptersNone { get; set; } = "[None]";
26+
public string ChaptersAll { get; set; } = "[All]";
27+
public string ChaptersSplite { get; set; } = "[Split by Chapters]";
2328
public string Video { get; set; } = "Video";
2429
public string Audio { get; set; } = "Audio";
2530
public string Subtitle { get; set; } = "Subtitle";
31+
public string SubtitleIgnore { get; set; } = "[Ignore]";
32+
public string SubtitleNone { get; set; } = "[None]";
2633
public string VideoRes { get; set; } = "Resolution";
34+
public string VideoDynamicRange { get; set; } = "DR";
2735
public string VideoFPS { get; set; } = "FPS";
2836
public string VideoExt { get; set; } = "Ext.";
2937
public string VideoCodec { get; set; } = "Codec";
@@ -48,6 +56,9 @@ public class LangMain :INotifyPropertyChanged {
4856
public string RememberWindowState { get; set; } = "Remember Window State";
4957
public string RememberWindowPosition { get; set; } = "Position";
5058
public string RememberWindowSize { get; set; } = "Size";
59+
public string Proxy { get; set; } = "Proxy";
60+
public string ProxyEnabled { get; set; } = "Enabled";
61+
public string ProxyHelper { get; set; } = "socks5://user:[email protected]:1080/";
5162
public string Cookie { get; set; } = "Cookie";
5263
public string CookieWhenNeeded { get; set; } = "When Needed";
5364
public string CookieNever { get; set; } = "Never";
@@ -76,6 +87,7 @@ public class LangAbout :INotifyPropertyChanged {
7687
public string About { get; set; } = "About";
7788
public string Website { get; set; } = "Website";
7889
public string Authors { get; set; } = "Authors";
90+
public Dictionary<string, string> Extends { get; set; } = new();
7991
}
8092
public class LangReleases :INotifyPropertyChanged {
8193
public event PropertyChangedEventHandler? PropertyChanged;

yt-dlp-gui/Models/Video.cs

+1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ public class Video : INotifyPropertyChanged {
1616
public List<Format> requested_formats { get; set; } = new();
1717
public string _filename { get; set; } = string.Empty;
1818
public bool is_live { get; set; } = false;
19+
public List<Chapters>? chapters { get; set; } = null;
1920
}
2021
}

0 commit comments

Comments
 (0)