diff --git a/DownKyi.Core/FileName/FileName.cs b/DownKyi.Core/FileName/FileName.cs index 23d9c1d..2e8684d 100644 --- a/DownKyi.Core/FileName/FileName.cs +++ b/DownKyi.Core/FileName/FileName.cs @@ -15,6 +15,15 @@ namespace DownKyi.Core.FileName private string videoQuality = "VIDEO_QUALITY"; private string videoCodec = "VIDEO_CODEC"; + private string videoPublishTime = "VIDEO_PUBLISH_TIME"; + + private long avid = -1; + private string bvid = "BVID"; + private long cid = -1; + + private long upMid = -1; + private string upName = "UP_NAME"; + private FileName(List nameParts) { this.nameParts = nameParts; @@ -73,6 +82,42 @@ namespace DownKyi.Core.FileName return this; } + public FileName SetVideoPublishTime(string videoPublishTime) + { + this.videoPublishTime = videoPublishTime; + return this; + } + + public FileName SetAvid(long avid) + { + this.avid = avid; + return this; + } + + public FileName SetBvid(string bvid) + { + this.bvid = bvid; + return this; + } + + public FileName SetCid(long cid) + { + this.cid = cid; + 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; @@ -112,6 +157,24 @@ namespace DownKyi.Core.FileName case FileNamePart.VIDEO_CODEC: path += videoCodec; break; + case FileNamePart.VIDEO_PUBLISH_TIME: + path += videoPublishTime; + break; + case FileNamePart.AVID: + path += avid; + break; + case FileNamePart.BVID: + path += bvid; + break; + 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 551829c..059e408 100644 --- a/DownKyi.Core/FileName/FileNamePart.cs +++ b/DownKyi.Core/FileName/FileNamePart.cs @@ -12,6 +12,15 @@ VIDEO_QUALITY, VIDEO_CODEC, + VIDEO_PUBLISH_TIME, + + AVID, + BVID, + CID, + + UP_MID, + UP_NAME, + // 斜杠 SLASH = 100, diff --git a/DownKyi/Languages/Default.xaml b/DownKyi/Languages/Default.xaml index ea63788..a590212 100644 --- a/DownKyi/Languages/Default.xaml +++ b/DownKyi/Languages/Default.xaml @@ -214,7 +214,10 @@ 音质 画质 视频编码 + 视频发布时间 空格 + UP主ID + UP主昵称 恢复默认 弹幕 diff --git a/DownKyi/Services/BangumiInfoService.cs b/DownKyi/Services/BangumiInfoService.cs index 270c0d4..a11443f 100644 --- a/DownKyi/Services/BangumiInfoService.cs +++ b/DownKyi/Services/BangumiInfoService.cs @@ -99,6 +99,32 @@ 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, + }; + } + + // 视频发布时间 + DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 + DateTime dateTime = startTime.AddSeconds(episode.PubTime); + page.PublishTime = dateTime.ToString("yyyy-MM-dd"); + pages.Add(page); } diff --git a/DownKyi/Services/CheeseInfoService.cs b/DownKyi/Services/CheeseInfoService.cs index 359e11a..a49e925 100644 --- a/DownKyi/Services/CheeseInfoService.cs +++ b/DownKyi/Services/CheeseInfoService.cs @@ -67,6 +67,32 @@ 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, + }; + } + + // 视频发布时间 + DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 + DateTime dateTime = startTime.AddSeconds(episode.ReleaseDate); + page.PublishTime = dateTime.ToString("yyyy-MM-dd"); + pages.Add(page); } diff --git a/DownKyi/Services/Download/AddToDownloadService.cs b/DownKyi/Services/Download/AddToDownloadService.cs index 939dcf6..f4b4ad3 100644 --- a/DownKyi/Services/Download/AddToDownloadService.cs +++ b/DownKyi/Services/Download/AddToDownloadService.cs @@ -294,7 +294,13 @@ namespace DownKyi.Services.Download .SetVideoZone(videoInfoView.VideoZone.Split('>')[0]) .SetAudioQuality(page.AudioQualityFormat) .SetVideoQuality(page.VideoQuality == null ? "" : page.VideoQuality.QualityFormat) - .SetVideoCodec(page.VideoQuality == null ? "" : page.VideoQuality.SelectedVideoCodec.Contains("AVC") ? "AVC" : page.VideoQuality.SelectedVideoCodec.Contains("HEVC") ? "HEVC" : page.VideoQuality.SelectedVideoCodec.Contains("Dolby") ? "Dolby Vision" : ""); + .SetVideoCodec(page.VideoQuality == null ? "" : page.VideoQuality.SelectedVideoCodec.Contains("AVC") ? "AVC" : page.VideoQuality.SelectedVideoCodec.Contains("HEVC") ? "HEVC" : page.VideoQuality.SelectedVideoCodec.Contains("Dolby") ? "Dolby Vision" : "") + .SetVideoPublishTime(page.PublishTime) + .SetAvid(page.Avid) + .SetBvid(page.Bvid) + .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..bd927a3 100644 --- a/DownKyi/Services/VideoInfoService.cs +++ b/DownKyi/Services/VideoInfoService.cs @@ -83,6 +83,24 @@ 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, + }; + } + + // 视频发布时间 + DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 + DateTime dateTime = startTime.AddSeconds(videoView.Pubdate); + videoPage.PublishTime = dateTime.ToString("yyyy-MM-dd"); + videoPages.Add(videoPage); } diff --git a/DownKyi/ViewModels/PageViewModels/VideoPage.cs b/DownKyi/ViewModels/PageViewModels/VideoPage.cs index 24b1fb0..b7660d0 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.Logging; using DownKyi.Core.Utils; @@ -18,6 +19,8 @@ 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 PublishTime { get; set; } public string FirstFrame { get; set; } diff --git a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs index a36ac6d..002d20f 100644 --- a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs +++ b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs @@ -469,6 +469,24 @@ namespace DownKyi.ViewModels.Settings case FileNamePart.VIDEO_CODEC: display = DictionaryResource.GetString("DisplayVideoCodec"); break; + case FileNamePart.VIDEO_PUBLISH_TIME: + display = DictionaryResource.GetString("DisplayVideoPublishTime"); + break; + case FileNamePart.AVID: + display = "avid"; + break; + case FileNamePart.BVID: + display = "bvid"; + break; + 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)