From e23eb8e2c886470099536742ce1a7d776cbe00ce Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Mon, 28 Aug 2023 20:21:10 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=88=96=E9=9D=9E=E5=A4=A7=E4=BC=9A=E5=91=98=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=B8=8D=E5=88=B0=E6=97=A0=E6=8D=9F=E9=9F=B3=E8=B4=A8?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=92=AD=E6=94=BE=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/BiliLite.UWP.csproj | 2 +- .../Playurl/{BiliPayUrlRequest.cs => BiliPlayUrlRequest.cs} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/BiliLite.UWP/Modules/Player/Playurl/{BiliPayUrlRequest.cs => BiliPlayUrlRequest.cs} (99%) diff --git a/src/BiliLite.UWP/BiliLite.UWP.csproj b/src/BiliLite.UWP/BiliLite.UWP.csproj index 7f6cbd48..af08494a 100644 --- a/src/BiliLite.UWP/BiliLite.UWP.csproj +++ b/src/BiliLite.UWP/BiliLite.UWP.csproj @@ -456,7 +456,7 @@ - + diff --git a/src/BiliLite.UWP/Modules/Player/Playurl/BiliPayUrlRequest.cs b/src/BiliLite.UWP/Modules/Player/Playurl/BiliPlayUrlRequest.cs similarity index 99% rename from src/BiliLite.UWP/Modules/Player/Playurl/BiliPayUrlRequest.cs rename to src/BiliLite.UWP/Modules/Player/Playurl/BiliPlayUrlRequest.cs index 5ed8ae67..6ea9969f 100644 --- a/src/BiliLite.UWP/Modules/Player/Playurl/BiliPayUrlRequest.cs +++ b/src/BiliLite.UWP/Modules/Player/Playurl/BiliPlayUrlRequest.cs @@ -158,7 +158,7 @@ private async Task ParseBiliPlayUrlInfoAudioDash(BiliPlayUrlQualit }); } // 处理无损音质 - if (flacAudio != null && flacAudio.Display) + if (flacAudio is { Display: true, Audio: { } }) { var audio = flacAudio.Audio; audio.baseUrl = await HandleUrl(audio.baseUrl, audio.backupUrl, userAgent, referer, isProxy); @@ -175,7 +175,7 @@ private async Task ParseBiliPlayUrlInfoAudioDash(BiliPlayUrlQualit } // 处理杜比音效 - if (dolbyAudio != null && dolbyAudio.Audio!=null&& dolbyAudio.Audio.Count>0) + if (dolbyAudio is { Audio: { } } && dolbyAudio.Audio.Count > 0) { var audio = dolbyAudio.Audio[0]; audio.baseUrl = await HandleUrl(audio.baseUrl, audio.backupUrl, userAgent, referer, isProxy); From 8542ae25e34d12a1f14675160cfb40de6f4cab33 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Tue, 29 Aug 2023 22:07:34 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AF=92=E9=9C=9C?= =?UTF-8?q?=E5=BC=B9=E5=B9=95=E4=BD=BF=EF=BC=8C=E4=BF=AE=E5=A4=8D6?= =?UTF-8?q?=E5=88=86=E9=92=9F=E6=97=A0=E5=BC=B9=E5=B9=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/BiliLite.UWP.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BiliLite.UWP/BiliLite.UWP.csproj b/src/BiliLite.UWP/BiliLite.UWP.csproj index af08494a..d708ad63 100644 --- a/src/BiliLite.UWP/BiliLite.UWP.csproj +++ b/src/BiliLite.UWP/BiliLite.UWP.csproj @@ -1030,7 +1030,7 @@ 10.1.1 - 1.0.1 + 1.0.2 1.0.0 From 5bb3f2ccbbbef9e89bef934ee2ac811bec6744d3 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Wed, 30 Aug 2023 20:43:49 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Services/GlobalLogger.cs | 5 +++++ src/BiliLite.UWP/Services/ILogger.cs | 3 +++ src/BiliLite.UWP/Services/LogService.cs | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/BiliLite.UWP/Services/GlobalLogger.cs b/src/BiliLite.UWP/Services/GlobalLogger.cs index bf2657af..8cc0886a 100644 --- a/src/BiliLite.UWP/Services/GlobalLogger.cs +++ b/src/BiliLite.UWP/Services/GlobalLogger.cs @@ -24,6 +24,11 @@ public void Debug(string message, Exception ex = null, [CallerMemberName] string LogService.Log(message, LogType.Debug, ex, methodName, m_typeName); } + public void Warn(string message, Exception ex = null, [CallerMemberName] string methodName = null) + { + LogService.Log(message, LogType.Warn, ex, methodName, m_typeName); + } + public void Error(string message, Exception ex = null, [CallerMemberName] string methodName = null) { LogService.Log(message, LogType.Error, ex, methodName, m_typeName); diff --git a/src/BiliLite.UWP/Services/ILogger.cs b/src/BiliLite.UWP/Services/ILogger.cs index 5d17dc2e..d620a0c6 100644 --- a/src/BiliLite.UWP/Services/ILogger.cs +++ b/src/BiliLite.UWP/Services/ILogger.cs @@ -12,6 +12,9 @@ public interface ILogger public void Debug(string message, Exception ex = null, [CallerMemberName] string methodName = null); + public void Warn(string message, Exception ex = null, [CallerMemberName] string methodName = null); + + public void Error(string message, Exception ex = null, [CallerMemberName] string methodName = null); public void Fatal(string message, Exception ex = null, [CallerMemberName] string methodName = null); diff --git a/src/BiliLite.UWP/Services/LogService.cs b/src/BiliLite.UWP/Services/LogService.cs index 554f0bfe..4f1cb956 100644 --- a/src/BiliLite.UWP/Services/LogService.cs +++ b/src/BiliLite.UWP/Services/LogService.cs @@ -48,8 +48,10 @@ public static void Init() FileName = storageFolder.Path + @"\log\" + DateTime.Now.ToString("yyyyMMdd") + ".log", Layout = "${longdate}|${level:uppercase=true}|${threadid}|${event-properties:item=type}.${event-properties:item=method}|${message}|${exception:format=Message,StackTrace}" }; - config.AddRule(LogLevel.Info, LogLevel.Info, logfile); + config.AddRule(LogLevel.Trace, LogLevel.Trace, logfile); config.AddRule(LogLevel.Debug, LogLevel.Debug, logfile); + config.AddRule(LogLevel.Info, LogLevel.Info, logfile); + config.AddRule(LogLevel.Warn, LogLevel.Warn, logfile); config.AddRule(LogLevel.Error, LogLevel.Error, logfile); config.AddRule(LogLevel.Fatal, LogLevel.Fatal, logfile); LogManager.Configuration = config; From 6dfeb5e86a6c8d802b531698dba0c73e0b22ceb8 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Wed, 30 Aug 2023 20:44:59 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E8=A7=86=E9=A2=91=E5=88=87=E6=8D=A2=E5=89=A7?= =?UTF-8?q?=E9=9B=86=E6=97=B6=E5=BC=B9=E7=AA=97=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Controls/PlayerControl.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs b/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs index a758db1a..baf89ecc 100644 --- a/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs +++ b/src/BiliLite.UWP/Controls/PlayerControl.xaml.cs @@ -2523,7 +2523,7 @@ private async void Player_ChangeEngine(object sender, ChangePlayerEngine e) { if (!e.need_change) { - ShowErrorDialog(e.message + "[ChangeEngine]"); + _logger.Warn($"[ChangeEngine] {e.message}"); return; } VideoLoading.Visibility = Visibility.Visible; From a6446f66fe841d6c2f8eab772f2245bc3865991e Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Wed, 30 Aug 2023 20:55:48 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E9=A1=B5=E8=A7=86=E9=A2=91=E6=97=B6=E9=95=BF?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Converters/ProgressToTimeConverter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BiliLite.UWP/Converters/ProgressToTimeConverter.cs b/src/BiliLite.UWP/Converters/ProgressToTimeConverter.cs index 54597580..fd6e70b6 100644 --- a/src/BiliLite.UWP/Converters/ProgressToTimeConverter.cs +++ b/src/BiliLite.UWP/Converters/ProgressToTimeConverter.cs @@ -18,6 +18,7 @@ public object Convert(object value, Type targetType, object parameter, string la return ts.ToString(ts.TotalHours>=1? @"hh\:mm\:ss" : @"mm\:ss"); } case int _: + case long _: { var ts = TimeSpan.FromSeconds(System.Convert.ToDouble(value)); return ts.ToString(ts.TotalHours >= 1 ? @"hh\:mm\:ss" : @"mm\:ss"); From 7d4783e692a17c9234ae24e007d0be40a8872477 Mon Sep 17 00:00:00 2001 From: GD_ Slime <1289744583@qq.com> Date: Thu, 31 Aug 2023 22:12:37 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=97=B4=E4=B8=AD=E8=B6=85=E7=BA=A7=E7=95=99=E8=A8=80?= =?UTF-8?q?(SuperChat)=E7=9A=84=E5=8F=91=E9=80=81=E4=BA=BA=E5=90=8D?= =?UTF-8?q?=E5=AD=97=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98.=20?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E4=BD=BF=E5=90=8D=E5=AD=97,=20=E9=87=91?= =?UTF-8?q?=E9=A2=9D,=20=E5=86=85=E5=AE=B9=E9=83=BD=E5=8F=98=E5=BE=97?= =?UTF-8?q?=E5=8F=AF=E5=A4=8D=E5=88=B6.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Pages/LiveDetailPage.xaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BiliLite.UWP/Pages/LiveDetailPage.xaml b/src/BiliLite.UWP/Pages/LiveDetailPage.xaml index 355209f4..96526367 100644 --- a/src/BiliLite.UWP/Pages/LiveDetailPage.xaml +++ b/src/BiliLite.UWP/Pages/LiveDetailPage.xaml @@ -892,12 +892,12 @@ - - + + - + From 8beeab2137c65e91e7f8d6c37bfd0fee7f668425 Mon Sep 17 00:00:00 2001 From: GD_ Slime <1289744583@qq.com> Date: Fri, 1 Sep 2023 09:44:39 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=9C=A8?= =?UTF-8?q?=E6=9F=90=E4=BA=9Bup=E4=B8=BB=E7=9A=84=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E4=B8=8B=E6=97=A0=E6=8E=A8=E8=8D=90=E8=A7=86=E9=A2=91=E5=92=8C?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=88=86=E4=BA=AB=E7=9A=84=E9=94=99=E8=AF=AF?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs | 11 +++++++++++ .../ViewModels/Video/VideoDetailPageViewModel.cs | 14 +++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs index 125944e2..fc012fac 100644 --- a/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs +++ b/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs @@ -29,6 +29,17 @@ public ApiModel DetailWebInterface(string id, bool isBvId) return api; } + public ApiModel RelatesWebInterface(string id, bool isBvId) + { + ApiModel api = new ApiModel() + { + method = RestSharp.Method.Get, + baseUrl = $"https://api.bilibili.com/x/web-interface/archive/related", + parameter = $"&{(isBvId ? "bvid=" : "aid=")}{id}" + }; + return api; + } + public ApiModel DetailProxy(string id, bool isbvid) { ApiModel api = new ApiModel() diff --git a/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs b/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs index 5f33d40e..7ec2567c 100644 --- a/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs +++ b/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs @@ -227,9 +227,21 @@ public async Task LoadVideoDetail(string id, bool isbvid = false) { // 通过web获取视频详情 var webResult = await videoAPI.DetailWebInterface(id, isbvid).Request(); - if (webResult.status) + // 通过web获取推荐视频 + var webRelatesResult = await videoAPI.RelatesWebInterface(id, isbvid).Request(); + if (webResult.status && webRelatesResult.status) { data = await webResult.GetJson>(); + data.data.ShortLink = "https://b23.tv/" + data.data.Bvid; + + // 解析推荐视频 + var relatesData = await webRelatesResult.GetJson>>(); + if (!relatesData.success) + { + throw new CustomizedErrorException(relatesData.message); + } + data.data.Relates = relatesData.data; + needGetUserReq = true; } } From dd6c82fe612be569cc0868239d20bd7814112456 Mon Sep 17 00:00:00 2001 From: GD_ Slime <1289744583@qq.com> Date: Fri, 1 Sep 2023 09:44:39 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=9C=A8?= =?UTF-8?q?=E6=9F=90=E4=BA=9Bup=E4=B8=BB=E7=9A=84=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E4=B8=8B=E6=97=A0=E6=8E=A8=E8=8D=90=E8=A7=86=E9=A2=91=E5=92=8C?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=88=86=E4=BA=AB=E7=9A=84=E9=94=99=E8=AF=AF?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs | 11 +++++++++++ .../ViewModels/Video/VideoDetailPageViewModel.cs | 14 +++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs b/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs index 125944e2..fc012fac 100644 --- a/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs +++ b/src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs @@ -29,6 +29,17 @@ public ApiModel DetailWebInterface(string id, bool isBvId) return api; } + public ApiModel RelatesWebInterface(string id, bool isBvId) + { + ApiModel api = new ApiModel() + { + method = RestSharp.Method.Get, + baseUrl = $"https://api.bilibili.com/x/web-interface/archive/related", + parameter = $"&{(isBvId ? "bvid=" : "aid=")}{id}" + }; + return api; + } + public ApiModel DetailProxy(string id, bool isbvid) { ApiModel api = new ApiModel() diff --git a/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs b/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs index 5f33d40e..7ec2567c 100644 --- a/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs +++ b/src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs @@ -227,9 +227,21 @@ public async Task LoadVideoDetail(string id, bool isbvid = false) { // 通过web获取视频详情 var webResult = await videoAPI.DetailWebInterface(id, isbvid).Request(); - if (webResult.status) + // 通过web获取推荐视频 + var webRelatesResult = await videoAPI.RelatesWebInterface(id, isbvid).Request(); + if (webResult.status && webRelatesResult.status) { data = await webResult.GetJson>(); + data.data.ShortLink = "https://b23.tv/" + data.data.Bvid; + + // 解析推荐视频 + var relatesData = await webRelatesResult.GetJson>>(); + if (!relatesData.success) + { + throw new CustomizedErrorException(relatesData.message); + } + data.data.Relates = relatesData.data; + needGetUserReq = true; } } From ca5f63eeb838cd8932033658fcb2f4dacca40cee Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Fri, 1 Sep 2023 17:28:36 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E6=AF=94=E4=BE=8B=E5=90=8E=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=8F=98=E5=8C=96=E4=B8=8D=E4=BC=9A=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=94=BB=E9=9D=A2=E5=A4=A7=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Controls/Player.xaml.cs | 1 - src/BiliLite.UWP/Controls/PlayerControl.xaml.cs | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/BiliLite.UWP/Controls/Player.xaml.cs b/src/BiliLite.UWP/Controls/Player.xaml.cs index ff178faa..2ce9783e 100644 --- a/src/BiliLite.UWP/Controls/Player.xaml.cs +++ b/src/BiliLite.UWP/Controls/Player.xaml.cs @@ -1064,7 +1064,6 @@ public async Task PlayVideoUseSYEngine(List