Skip to content

Commit

Permalink
Merge pull request #295 from ywmoyue/dev
Browse files Browse the repository at this point in the history
4.6.13
  • Loading branch information
ywmoyue authored Sep 1, 2023
2 parents 9b48557 + ca5f63e commit 81ef2b2
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/BiliLite.UWP/BiliLite.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@
<Compile Include="Modules\Live\LiveRecommendVM.cs" />
<Compile Include="Modules\Other\FindMoreVM.cs" />
<Compile Include="Modules\Player\InteractionVideoVM.cs" />
<Compile Include="Modules\Player\Playurl\BiliPayUrlRequest.cs" />
<Compile Include="Modules\Player\Playurl\BiliPlayUrlRequest.cs" />
<Compile Include="Modules\Player\Playurl\BiliPlayUrl.cs" />
<Compile Include="Models\Common\Video\PlayUrlInfos\BiliFlvPlayUrlInfo.cs" />
<Compile Include="Modules\RegionDetailVM.cs" />
Expand Down Expand Up @@ -1030,7 +1030,7 @@
<Version>10.1.1</Version>
</PackageReference>
<PackageReference Include="DanmakuFrostMaster.muyan">
<Version>1.0.1</Version>
<Version>1.0.2</Version>
</PackageReference>
<PackageReference Include="FFmpegInteropX">
<Version>1.0.0</Version>
Expand Down
1 change: 0 additions & 1 deletion src/BiliLite.UWP/Controls/Player.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,6 @@ public async Task<PlayerOpenResult> PlayVideoUseSYEngine(List<BiliFlvPlayUrlInfo

public void SetRatioMode(int mode)
{

switch (mode)
{
case 0:
Expand Down
5 changes: 4 additions & 1 deletion src/BiliLite.UWP/Controls/PlayerControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -2808,7 +2808,10 @@ public void PlayerSettingABPlaySetPointB_Click(object sender, RoutedEventArgs e)

private void Player_SizeChanged(object sender, SizeChangedEventArgs e)
{
// 更新弹幕
m_danmakuController.UpdateSize(SplitView.ActualWidth, SplitView.ActualHeight);
// 更新画面比例
Player.SetRatioMode(PlayerSettingRatio.SelectedIndex);
}
}
}
1 change: 1 addition & 0 deletions src/BiliLite.UWP/Converters/ProgressToTimeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
11 changes: 11 additions & 0 deletions src/BiliLite.UWP/Models/Requests/Api/VideoAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private async Task<BiliDashItem> 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);
Expand All @@ -175,7 +175,7 @@ private async Task<BiliDashItem> 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);
Expand Down
6 changes: 3 additions & 3 deletions src/BiliLite.UWP/Pages/LiveDetailPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -892,12 +892,12 @@
</Grid>

<StackPanel VerticalAlignment="Center" Grid.Column="1">
<TextBlock FontSize="12" Foreground="Black" Text="{x:Bind username}"></TextBlock>
<TextBlock Foreground="Black">¥<Run Text="{x:Bind Path=price}"/> <Run Foreground="Gray" FontSize="12" Text="("/><Run Foreground="Gray" FontSize="12" Text="{x:Bind Path=price_gold,Converter={StaticResource numberToStringConvert}}"/><Run Foreground="Gray" FontSize="12" Text="金瓜子)"/></TextBlock>
<TextBlock Foreground="Black" Text="{Binding username}" IsTextSelectionEnabled="True"></TextBlock>
<TextBlock Foreground="Black" IsTextSelectionEnabled="True">¥<Run Text="{x:Bind Path=price}"/> <Run Foreground="Gray" FontSize="12" Text="("/><Run Foreground="Gray" FontSize="12" Text="{x:Bind Path=price_gold,Converter={StaticResource numberToStringConvert}}"/><Run Foreground="Gray" FontSize="12" Text="金瓜子)"/></TextBlock>
</StackPanel>
</Grid>
<Grid Padding="12" Background="{x:Bind Path=background_bottom_color,Mode=OneWay,Converter={StaticResource colorConvert}}">
<TextBlock TextWrapping="Wrap" FontSize="14" Foreground="white" Text="{x:Bind Path=message}"></TextBlock>
<TextBlock TextWrapping="Wrap" FontSize="14" Foreground="white" Text="{x:Bind Path=message}" IsTextSelectionEnabled="True"></TextBlock>
</Grid>
</StackPanel>
</Flyout>
Expand Down
5 changes: 5 additions & 0 deletions src/BiliLite.UWP/Services/GlobalLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/BiliLite.UWP/Services/ILogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/BiliLite.UWP/Services/LogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 13 additions & 1 deletion src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ApiDataModel<VideoDetailModel>>();
data.data.ShortLink = "https://b23.tv/" + data.data.Bvid;

// 解析推荐视频
var relatesData = await webRelatesResult.GetJson<ApiDataModel<List<VideoDetailRelatesModel>>>();
if (!relatesData.success)
{
throw new CustomizedErrorException(relatesData.message);
}
data.data.Relates = relatesData.data;

needGetUserReq = true;
}
}
Expand Down

0 comments on commit 81ef2b2

Please sign in to comment.