From 0257df9fbe9aa53565966201518176fd1675e33a Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sat, 5 Mar 2022 17:01:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=91=BD=E5=90=8D=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E6=96=B0=E5=A2=9EUP=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi.Core/FileName/FileName.cs | 21 +++++++++++++++++++ DownKyi.Core/FileName/FileNamePart.cs | 3 +++ DownKyi/Languages/Default.xaml | 2 ++ DownKyi/Services/BangumiInfoService.cs | 21 +++++++++++++++++++ DownKyi/Services/CheeseInfoService.cs | 21 +++++++++++++++++++ .../Services/Download/AddToDownloadService.cs | 4 +++- DownKyi/Services/VideoInfoService.cs | 13 ++++++++++++ .../ViewModels/PageViewModels/VideoPage.cs | 2 ++ .../ViewModels/Settings/ViewVideoViewModel.cs | 6 ++++++ 9 files changed, 92 insertions(+), 1 deletion(-) diff --git a/DownKyi.Core/FileName/FileName.cs b/DownKyi.Core/FileName/FileName.cs index 4d7d97d..832a18d 100644 --- a/DownKyi.Core/FileName/FileName.cs +++ b/DownKyi.Core/FileName/FileName.cs @@ -19,6 +19,9 @@ namespace DownKyi.Core.FileName private string bvid = "BVID"; private long cid = -1; + private long upMid = -1; + private string upName = "UP_NAME"; + private FileName(List nameParts) { this.nameParts = nameParts; @@ -95,6 +98,18 @@ namespace DownKyi.Core.FileName return this; } + public FileName SetUpMid(long upMid) + { + this.upMid = upMid; + return this; + } + + public FileName SetUpName(string upName) + { + this.upName = upName; + return this; + } + public string RelativePath() { string path = string.Empty; @@ -143,6 +158,12 @@ namespace DownKyi.Core.FileName case FileNamePart.CID: path += cid; break; + case FileNamePart.UP_MID: + path += upMid; + break; + case FileNamePart.UP_NAME: + path += upName; + break; } if (((int)part) >= 100) diff --git a/DownKyi.Core/FileName/FileNamePart.cs b/DownKyi.Core/FileName/FileNamePart.cs index ca9e6a4..c9fcd4e 100644 --- a/DownKyi.Core/FileName/FileNamePart.cs +++ b/DownKyi.Core/FileName/FileNamePart.cs @@ -16,6 +16,9 @@ BVID, CID, + UP_MID, + UP_NAME, + // 斜杠 SLASH = 100, diff --git a/DownKyi/Languages/Default.xaml b/DownKyi/Languages/Default.xaml index ea63788..7842bf0 100644 --- a/DownKyi/Languages/Default.xaml +++ b/DownKyi/Languages/Default.xaml @@ -215,6 +215,8 @@ 画质 视频编码 空格 + UP主ID + UP主昵称 恢复默认 弹幕 diff --git a/DownKyi/Services/BangumiInfoService.cs b/DownKyi/Services/BangumiInfoService.cs index 270c0d4..7e7d8b7 100644 --- a/DownKyi/Services/BangumiInfoService.cs +++ b/DownKyi/Services/BangumiInfoService.cs @@ -99,6 +99,27 @@ namespace DownKyi.Services Name = name, Duration = "N/A" }; + + // UP主信息 + if (bangumiSeason.UpInfo != null) + { + page.Owner = new Core.BiliApi.Models.VideoOwner + { + Name = bangumiSeason.UpInfo.Name, + Face = bangumiSeason.UpInfo.Avatar, + Mid = bangumiSeason.UpInfo.Mid, + }; + } + else + { + page.Owner = new Core.BiliApi.Models.VideoOwner + { + Name = "", + Face = "", + Mid = -1, + }; + } + pages.Add(page); } diff --git a/DownKyi/Services/CheeseInfoService.cs b/DownKyi/Services/CheeseInfoService.cs index 359e11a..b6bd13a 100644 --- a/DownKyi/Services/CheeseInfoService.cs +++ b/DownKyi/Services/CheeseInfoService.cs @@ -67,6 +67,27 @@ namespace DownKyi.Services Name = name, Duration = "N/A" }; + + // UP主信息 + if (cheeseView.UpInfo != null) + { + page.Owner = new Core.BiliApi.Models.VideoOwner + { + Name = cheeseView.UpInfo.Name, + Face = cheeseView.UpInfo.Avatar, + Mid = cheeseView.UpInfo.Mid, + }; + } + else + { + page.Owner = new Core.BiliApi.Models.VideoOwner + { + Name = "", + Face = "", + Mid = -1, + }; + } + pages.Add(page); } diff --git a/DownKyi/Services/Download/AddToDownloadService.cs b/DownKyi/Services/Download/AddToDownloadService.cs index b827aa0..d83d589 100644 --- a/DownKyi/Services/Download/AddToDownloadService.cs +++ b/DownKyi/Services/Download/AddToDownloadService.cs @@ -297,7 +297,9 @@ namespace DownKyi.Services.Download .SetVideoCodec(page.VideoQuality == null ? "" : page.VideoQuality.SelectedVideoCodec.Contains("AVC") ? "AVC" : page.VideoQuality.SelectedVideoCodec.Contains("HEVC") ? "HEVC" : page.VideoQuality.SelectedVideoCodec.Contains("Dolby") ? "Dolby Vision" : "") .SetAvid(page.Avid) .SetBvid(page.Bvid) - .SetCid(page.Cid); + .SetCid(page.Cid) + .SetUpMid(page.Owner.Mid) + .SetUpName(page.Owner.Name); string filePath = Path.Combine(directory, fileName.RelativePath()); // 视频类别 diff --git a/DownKyi/Services/VideoInfoService.cs b/DownKyi/Services/VideoInfoService.cs index 3bec45f..e091048 100644 --- a/DownKyi/Services/VideoInfoService.cs +++ b/DownKyi/Services/VideoInfoService.cs @@ -83,6 +83,19 @@ namespace DownKyi.Services Name = name, Duration = "N/A" }; + + // UP主信息 + videoPage.Owner = videoView.Owner; + if (videoPage.Owner == null) + { + videoPage.Owner = new Core.BiliApi.Models.VideoOwner + { + Name = "", + Face = "", + Mid = -1, + }; + } + videoPages.Add(videoPage); } diff --git a/DownKyi/ViewModels/PageViewModels/VideoPage.cs b/DownKyi/ViewModels/PageViewModels/VideoPage.cs index be645a9..6f5153d 100644 --- a/DownKyi/ViewModels/PageViewModels/VideoPage.cs +++ b/DownKyi/ViewModels/PageViewModels/VideoPage.cs @@ -1,4 +1,5 @@ using DownKyi.Core.BiliApi.BiliUtils; +using DownKyi.Core.BiliApi.Models; using DownKyi.Core.BiliApi.VideoStream.Models; using DownKyi.Core.Utils; using Prism.Commands; @@ -16,6 +17,7 @@ namespace DownKyi.ViewModels.PageViewModels public string Bvid { get; set; } public long Cid { get; set; } public long EpisodeId { get; set; } + public VideoOwner Owner { get; set; } public string FirstFrame { get; set; } diff --git a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs index e401f02..39c6548 100644 --- a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs +++ b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs @@ -478,6 +478,12 @@ namespace DownKyi.ViewModels.Settings case FileNamePart.CID: display = "cid"; break; + case FileNamePart.UP_MID: + display = DictionaryResource.GetString("DisplayUpMid"); + break; + case FileNamePart.UP_NAME: + display = DictionaryResource.GetString("DisplayUpName"); + break; } if (((int)item) >= 100)