From aebc6223729efa18f1f71a0e34a9ca32bca53e84 Mon Sep 17 00:00:00 2001 From: yaobiao <1315508912@qq.com> Date: Sun, 17 Dec 2023 18:34:12 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0nuget.config?= =?UTF-8?q?=E6=96=B9=E4=BE=BF=E6=89=BE=E5=88=B0nuget=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nuget.config | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/nuget.config diff --git a/src/nuget.config b/src/nuget.config new file mode 100644 index 0000000..3357aef --- /dev/null +++ b/src/nuget.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From ddba2d7d4fbcd7dbb2bd2c1e26bc76f1d6da6922 Mon Sep 17 00:00:00 2001 From: yaobiao <1315508912@qq.com> Date: Sun, 17 Dec 2023 18:35:13 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=90=88=E9=9B=86?= =?UTF-8?q?=E5=B0=81=E9=9D=A2=E9=94=99=E8=AF=AF=20#964?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DownKyi/Services/VideoInfoService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DownKyi/Services/VideoInfoService.cs b/src/DownKyi/Services/VideoInfoService.cs index ed9738b..2f9ce60 100644 --- a/src/DownKyi/Services/VideoInfoService.cs +++ b/src/DownKyi/Services/VideoInfoService.cs @@ -151,7 +151,7 @@ namespace DownKyi.Services Bvid = episode.Bvid, Cid = episode.Cid, EpisodeId = -1, - FirstFrame = episode.Page.FirstFrame, + FirstFrame = episode.Arc.Pic, Order = order, Name = episode.Title, Duration = "N/A" From 2789488733227d3f80ae6aa5f28cb7fcdcd5f69c Mon Sep 17 00:00:00 2001 From: yaobiao <1315508912@qq.com> Date: Mon, 18 Dec 2023 23:24:47 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BF=AE=E6=94=B9?= =?UTF-8?q?user-agent=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/Settings/ViewNetworkViewModel.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/DownKyi/ViewModels/Settings/ViewNetworkViewModel.cs b/src/DownKyi/ViewModels/Settings/ViewNetworkViewModel.cs index eba6594..2d512f0 100644 --- a/src/DownKyi/ViewModels/Settings/ViewNetworkViewModel.cs +++ b/src/DownKyi/ViewModels/Settings/ViewNetworkViewModel.cs @@ -371,16 +371,19 @@ namespace DownKyi.ViewModels.Settings } // 设置UserAgent事件 - private DelegateCommand userAgentCommand; - public DelegateCommand UserAgentCommand => userAgentCommand ?? (userAgentCommand = new DelegateCommand(ExecuteUserAgentCommand)); + private DelegateCommand userAgentCommand; + public DelegateCommand UserAgentCommand => userAgentCommand ?? (userAgentCommand = new DelegateCommand(ExecuteUserAgentCommand)); /// /// 设置UserAgent事件 /// - private void ExecuteUserAgentCommand() + private void ExecuteUserAgentCommand(string ua) { - bool isSucceed = SettingsManager.GetInstance().SetUserAgent(UserAgent); - PublishTip(isSucceed); + if (ua != null) + { + bool isSucceed = SettingsManager.GetInstance().SetUserAgent(ua); + PublishTip(isSucceed); + } } // 下载器选择事件 From c7655ee66b85f2bbc3fdb6f7949e503f61d98b05 Mon Sep 17 00:00:00 2001 From: yaobiao <1315508912@qq.com> Date: Mon, 25 Dec 2023 21:22:43 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E9=87=8D=E5=A4=8D=E4=B8=8B=E8=BD=BD=E6=8F=90=E9=86=92?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E4=BB=A5=E5=9C=A8=E8=AE=BE=E7=BD=AE=E4=B8=AD?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=AF=8F=E6=AC=A1=E8=AF=A2=E9=97=AE=E3=80=81?= =?UTF-8?q?=E6=80=BB=E6=98=AF=E9=87=8D=E5=A4=8D=E4=B8=8B=E8=BD=BD=E6=88=96?= =?UTF-8?q?=E8=80=85=E8=B7=B3=E8=BF=87=20#976=20#957=20#942=20#939?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DownKyi.Core/DownKyi.Core.csproj | 1 + .../Settings/Models/BasicSettings.cs | 1 + .../Settings/RepeatDownloadStrategy.cs | 9 ++++ .../Settings/SettingsManager.Basic.cs | 30 ++++++++++++ src/DownKyi/DownKyi.csproj | 1 + src/DownKyi/Languages/Default.xaml | 4 ++ .../Models/RepeatDownloadStrategyDisplay.cs | 10 ++++ .../Services/Download/AddToDownloadService.cs | 42 +++++++++++----- .../ViewModels/Settings/ViewBasicViewModel.cs | 48 +++++++++++++++++++ src/DownKyi/Views/Settings/ViewBasic.xaml | 20 ++++++++ 10 files changed, 153 insertions(+), 13 deletions(-) create mode 100644 src/DownKyi.Core/Settings/RepeatDownloadStrategy.cs create mode 100644 src/DownKyi/Models/RepeatDownloadStrategyDisplay.cs diff --git a/src/DownKyi.Core/DownKyi.Core.csproj b/src/DownKyi.Core/DownKyi.Core.csproj index 7012acb..a6ac3ea 100644 --- a/src/DownKyi.Core/DownKyi.Core.csproj +++ b/src/DownKyi.Core/DownKyi.Core.csproj @@ -308,6 +308,7 @@ + diff --git a/src/DownKyi.Core/Settings/Models/BasicSettings.cs b/src/DownKyi.Core/Settings/Models/BasicSettings.cs index 43eea04..f04f7ee 100644 --- a/src/DownKyi.Core/Settings/Models/BasicSettings.cs +++ b/src/DownKyi.Core/Settings/Models/BasicSettings.cs @@ -11,5 +11,6 @@ public ParseScope ParseScope { get; set; } = ParseScope.NOT_SET; public AllowStatus IsAutoDownloadAll { get; set; } = AllowStatus.NONE; public DownloadFinishedSort DownloadFinishedSort { get; set; } = DownloadFinishedSort.NOT_SET; + public RepeatDownloadStrategy RepeatDownloadStrategy { get; set; } = RepeatDownloadStrategy.Ask; } } diff --git a/src/DownKyi.Core/Settings/RepeatDownloadStrategy.cs b/src/DownKyi.Core/Settings/RepeatDownloadStrategy.cs new file mode 100644 index 0000000..fdb2447 --- /dev/null +++ b/src/DownKyi.Core/Settings/RepeatDownloadStrategy.cs @@ -0,0 +1,9 @@ +namespace DownKyi.Core.Settings +{ + public enum RepeatDownloadStrategy + { + Ask, + ReDownload, + JumpOver + } +} \ No newline at end of file diff --git a/src/DownKyi.Core/Settings/SettingsManager.Basic.cs b/src/DownKyi.Core/Settings/SettingsManager.Basic.cs index ccf618f..3f84893 100644 --- a/src/DownKyi.Core/Settings/SettingsManager.Basic.cs +++ b/src/DownKyi.Core/Settings/SettingsManager.Basic.cs @@ -19,6 +19,9 @@ // 下载完成列表排序 private readonly DownloadFinishedSort finishedSort = DownloadFinishedSort.DOWNLOAD; + + // 重复下载策略 + private readonly RepeatDownloadStrategy _repeatDownloadStrategy = RepeatDownloadStrategy.Ask; /// /// 获取下载完成后的操作 @@ -182,5 +185,32 @@ return SetSettings(); } + /// + /// 获取重复下载策略 + /// + /// + public RepeatDownloadStrategy GetRepeatDownloadStrategy() + { + appSettings = GetSettings(); + if (appSettings.Basic.RepeatDownloadStrategy == RepeatDownloadStrategy.Ask) + { + // 第一次获取,先设置默认值 + SetRepeatDownloadStrategy(_repeatDownloadStrategy); + return _repeatDownloadStrategy; + } + + return appSettings.Basic.RepeatDownloadStrategy; + } + + /// + /// 设置重复下载策略 + /// + /// + /// + public bool SetRepeatDownloadStrategy(RepeatDownloadStrategy repeatDownloadStrategy) + { + appSettings.Basic.RepeatDownloadStrategy = repeatDownloadStrategy; + return SetSettings(); + } } } diff --git a/src/DownKyi/DownKyi.csproj b/src/DownKyi/DownKyi.csproj index 32eca1c..5063eb6 100644 --- a/src/DownKyi/DownKyi.csproj +++ b/src/DownKyi/DownKyi.csproj @@ -116,6 +116,7 @@ + diff --git a/src/DownKyi/Languages/Default.xaml b/src/DownKyi/Languages/Default.xaml index 566dfbb..8dba54b 100644 --- a/src/DownKyi/Languages/Default.xaml +++ b/src/DownKyi/Languages/Default.xaml @@ -195,6 +195,10 @@ 监听剪贴板 视频自动解析 视频解析范围: + 重复下载策略: + 每次询问 + 重新下载 + 跳过重复项 解析后自动下载已解析视频 网络 diff --git a/src/DownKyi/Models/RepeatDownloadStrategyDisplay.cs b/src/DownKyi/Models/RepeatDownloadStrategyDisplay.cs new file mode 100644 index 0000000..2ad85e9 --- /dev/null +++ b/src/DownKyi/Models/RepeatDownloadStrategyDisplay.cs @@ -0,0 +1,10 @@ +using DownKyi.Core.Settings; + +namespace DownKyi.Models +{ + public class RepeatDownloadStrategyDisplay + { + public string Name { get; set; } + public RepeatDownloadStrategy RepeatDownloadStrategy { get; set; } + } +} \ No newline at end of file diff --git a/src/DownKyi/Services/Download/AddToDownloadService.cs b/src/DownKyi/Services/Download/AddToDownloadService.cs index 8133af9..70affbe 100644 --- a/src/DownKyi/Services/Download/AddToDownloadService.cs +++ b/src/DownKyi/Services/Download/AddToDownloadService.cs @@ -279,21 +279,37 @@ namespace DownKyi.Services.Download { //eventAggregator.GetEvent().Publish($"{page.Name}{DictionaryResource.GetString("TipAlreadyToAddDownloaded")}"); //isDownloaded = true; - - AlertService alertService = new AlertService(dialogService); - ButtonResult result = alertService.ShowInfo(DictionaryResource.GetString("TipAlreadyToAddDownloaded2")); - if (result == ButtonResult.OK) + var repeatDownloadStrategy = SettingsManager.GetInstance().GetRepeatDownloadStrategy(); + switch (repeatDownloadStrategy) { - App.PropertyChangeAsync(() => + case RepeatDownloadStrategy.Ask: { - App.DownloadedList.Remove(item); - }); - - isDownloaded = false; - } - else - { - isDownloaded = true; + AlertService alertService = new AlertService(dialogService); + ButtonResult result = alertService.ShowInfo(DictionaryResource.GetString("TipAlreadyToAddDownloaded2")); + if (result == ButtonResult.OK) + { + App.PropertyChangeAsync(() => + { + App.DownloadedList.Remove(item); + }); + + isDownloaded = false; + } + else + { + isDownloaded = true; + } + break; + } + case RepeatDownloadStrategy.ReDownload: + isDownloaded = false; + break; + case RepeatDownloadStrategy.JumpOver: + isDownloaded = true; + break; + default: + isDownloaded = true; + break; } break; diff --git a/src/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs b/src/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs index 3f2ce2b..7610b20 100644 --- a/src/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs +++ b/src/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs @@ -73,6 +73,22 @@ namespace DownKyi.ViewModels.Settings get => autoDownloadAll; set => SetProperty(ref autoDownloadAll, value); } + + private List _repeatDownloadStrategy; + + public List RepeatDownloadStrategy + { + get => _repeatDownloadStrategy; + set => SetProperty(ref _repeatDownloadStrategy, value); + } + + private RepeatDownloadStrategyDisplay _selectedRepeatDownloadStrategy; + + public RepeatDownloadStrategyDisplay SelectedRepeatDownloadStrategy + { + get => _selectedRepeatDownloadStrategy; + set => SetProperty(ref _selectedRepeatDownloadStrategy, value); + } #endregion @@ -89,6 +105,14 @@ namespace DownKyi.ViewModels.Settings new ParseScopeDisplay{ Name = DictionaryResource.GetString("ParseCurrentSection"), ParseScope = ParseScope.CURRENT_SECTION }, new ParseScopeDisplay{ Name = DictionaryResource.GetString("ParseAll"), ParseScope = ParseScope.ALL } }; + + // 重复下载策略 + RepeatDownloadStrategy = new List + { + new RepeatDownloadStrategyDisplay { Name = DictionaryResource.GetString("RepeatDownloadAsk"), RepeatDownloadStrategy = Core.Settings.RepeatDownloadStrategy.Ask }, + new RepeatDownloadStrategyDisplay { Name = DictionaryResource.GetString("RepeatDownloadReDownload"), RepeatDownloadStrategy = Core.Settings.RepeatDownloadStrategy.ReDownload }, + new RepeatDownloadStrategyDisplay { Name = DictionaryResource.GetString("RepeatDownloadReJumpOver"), RepeatDownloadStrategy = Core.Settings.RepeatDownloadStrategy.JumpOver } + }; #endregion @@ -123,6 +147,10 @@ namespace DownKyi.ViewModels.Settings // 解析后是否自动下载解析视频 AllowStatus isAutoDownloadAll = SettingsManager.GetInstance().IsAutoDownloadAll(); AutoDownloadAll = isAutoDownloadAll == AllowStatus.YES; + + // 重复下载策略 + var repeatDownloadStrategy = SettingsManager.GetInstance().GetRepeatDownloadStrategy(); + SelectedRepeatDownloadStrategy = RepeatDownloadStrategy.FirstOrDefault(t => t.RepeatDownloadStrategy == repeatDownloadStrategy); isOnNavigatedTo = false; } @@ -218,6 +246,26 @@ namespace DownKyi.ViewModels.Settings bool isSucceed = SettingsManager.GetInstance().IsAutoDownloadAll(isAutoDownloadAll); PublishTip(isSucceed); } + + // 解析范围事件 + private DelegateCommand _repeatDownloadStrategyCommand; + + public DelegateCommand RepeatDownloadStrategyCommand => _repeatDownloadStrategyCommand ?? (_repeatDownloadStrategyCommand = new DelegateCommand(ExecuteRepeatDownloadStrategyCommand)); + + /// + /// 解析范围事件 + /// + /// + private void ExecuteRepeatDownloadStrategyCommand(object parameter) + { + if (!(parameter is RepeatDownloadStrategyDisplay repeatDownloadStrategy)) + { + return; + } + + var isSucceed = SettingsManager.GetInstance().SetRepeatDownloadStrategy(repeatDownloadStrategy.RepeatDownloadStrategy); + PublishTip(isSucceed); + } #endregion diff --git a/src/DownKyi/Views/Settings/ViewBasic.xaml b/src/DownKyi/Views/Settings/ViewBasic.xaml index f6f6d57..e81493a 100644 --- a/src/DownKyi/Views/Settings/ViewBasic.xaml +++ b/src/DownKyi/Views/Settings/ViewBasic.xaml @@ -112,7 +112,27 @@ Foreground="{DynamicResource BrushTextDark}" IsChecked="{Binding AutoDownloadAll, Mode=TwoWay}" Style="{StaticResource CheckBoxStyle}" /> + + + + + + + + + + From c78a74ca86247d2956bd6bbd485757ec878c25f6 Mon Sep 17 00:00:00 2001 From: yaobiao <1315508912@qq.com> Date: Thu, 25 Jan 2024 22:43:37 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E6=96=87=E4=BB=B6=E5=91=BD=E5=90=8D?= =?UTF-8?q?av=E6=A0=87=E7=AD=BE=E6=B7=BB=E5=8A=A0av=E7=9A=84=E5=89=8D?= =?UTF-8?q?=E7=BC=80=E4=BD=BF=E6=84=8F=E4=B9=89=E6=9B=B4=E5=8A=A0=E6=98=8E?= =?UTF-8?q?=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DownKyi.Core/FileName/FileName.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DownKyi.Core/FileName/FileName.cs b/src/DownKyi.Core/FileName/FileName.cs index 356a9e0..e16ce19 100644 --- a/src/DownKyi.Core/FileName/FileName.cs +++ b/src/DownKyi.Core/FileName/FileName.cs @@ -163,7 +163,7 @@ namespace DownKyi.Core.FileName path += videoPublishTime; break; case FileNamePart.AVID: - path += avid; + path += $"av{avid}"; break; case FileNamePart.BVID: path += bvid;