From c1ea829215a19e9b47312a81c462e5a29548f07e Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sun, 6 Mar 2022 13:25:23 +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=9E=E8=A7=86=E9=A2=91=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi.Core/FileName/FileName.cs | 11 +++++++++++ DownKyi.Core/FileName/FileNamePart.cs | 2 ++ DownKyi/Languages/Default.xaml | 1 + DownKyi/Services/BangumiInfoService.cs | 5 +++++ DownKyi/Services/CheeseInfoService.cs | 5 +++++ DownKyi/Services/Download/AddToDownloadService.cs | 1 + DownKyi/Services/VideoInfoService.cs | 5 +++++ DownKyi/ViewModels/PageViewModels/VideoPage.cs | 1 + DownKyi/ViewModels/Settings/ViewVideoViewModel.cs | 3 +++ 9 files changed, 34 insertions(+) diff --git a/DownKyi.Core/FileName/FileName.cs b/DownKyi.Core/FileName/FileName.cs index 832a18d..2e8684d 100644 --- a/DownKyi.Core/FileName/FileName.cs +++ b/DownKyi.Core/FileName/FileName.cs @@ -15,6 +15,8 @@ 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; @@ -80,6 +82,12 @@ namespace DownKyi.Core.FileName return this; } + public FileName SetVideoPublishTime(string videoPublishTime) + { + this.videoPublishTime = videoPublishTime; + return this; + } + public FileName SetAvid(long avid) { this.avid = avid; @@ -149,6 +157,9 @@ 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; diff --git a/DownKyi.Core/FileName/FileNamePart.cs b/DownKyi.Core/FileName/FileNamePart.cs index c9fcd4e..059e408 100644 --- a/DownKyi.Core/FileName/FileNamePart.cs +++ b/DownKyi.Core/FileName/FileNamePart.cs @@ -12,6 +12,8 @@ VIDEO_QUALITY, VIDEO_CODEC, + VIDEO_PUBLISH_TIME, + AVID, BVID, CID, diff --git a/DownKyi/Languages/Default.xaml b/DownKyi/Languages/Default.xaml index 7842bf0..a590212 100644 --- a/DownKyi/Languages/Default.xaml +++ b/DownKyi/Languages/Default.xaml @@ -214,6 +214,7 @@ 音质 画质 视频编码 + 视频发布时间 空格 UP主ID UP主昵称 diff --git a/DownKyi/Services/BangumiInfoService.cs b/DownKyi/Services/BangumiInfoService.cs index 7e7d8b7..a11443f 100644 --- a/DownKyi/Services/BangumiInfoService.cs +++ b/DownKyi/Services/BangumiInfoService.cs @@ -120,6 +120,11 @@ namespace DownKyi.Services }; } + // 视频发布时间 + 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 b6bd13a..a49e925 100644 --- a/DownKyi/Services/CheeseInfoService.cs +++ b/DownKyi/Services/CheeseInfoService.cs @@ -88,6 +88,11 @@ namespace DownKyi.Services }; } + // 视频发布时间 + 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 d83d589..f4b4ad3 100644 --- a/DownKyi/Services/Download/AddToDownloadService.cs +++ b/DownKyi/Services/Download/AddToDownloadService.cs @@ -295,6 +295,7 @@ namespace DownKyi.Services.Download .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" : "") + .SetVideoPublishTime(page.PublishTime) .SetAvid(page.Avid) .SetBvid(page.Bvid) .SetCid(page.Cid) diff --git a/DownKyi/Services/VideoInfoService.cs b/DownKyi/Services/VideoInfoService.cs index e091048..bd927a3 100644 --- a/DownKyi/Services/VideoInfoService.cs +++ b/DownKyi/Services/VideoInfoService.cs @@ -96,6 +96,11 @@ namespace DownKyi.Services }; } + // 视频发布时间 + 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 6f5153d..2e2f802 100644 --- a/DownKyi/ViewModels/PageViewModels/VideoPage.cs +++ b/DownKyi/ViewModels/PageViewModels/VideoPage.cs @@ -18,6 +18,7 @@ namespace DownKyi.ViewModels.PageViewModels 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 39c6548..002d20f 100644 --- a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs +++ b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs @@ -469,6 +469,9 @@ 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;