Skip to content

Commit

Permalink
Merge pull request #813 from ywmoyue/dev
Browse files Browse the repository at this point in the history
4.7.3
  • Loading branch information
ywmoyue authored Sep 16, 2024
2 parents 6a86d7e + 6ea4e7b commit 0b12b2f
Show file tree
Hide file tree
Showing 33 changed files with 245 additions and 58 deletions.
Binary file modified document/_img/contributors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions document/install-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
<link rel="stylesheet" href="https://support.microsoft.com/css/fonts/site-fonts.css?v=4M_1wOASateOs9zdphCtIqMvtKo366Gf6pkOjDqzkYo">

# Biliuwp-lite安装教程
- [Windows10 安装教程](install-readme.md#Windows10)
- [Windows11 安装教程](install-readme.md#Windows11)
- [Windows10 安装教程(脚本安装方式)](install-readme.md#Windows10)
- [Windows11 安装教程(Appx直接安装方式/不推荐)](install-readme.md#Windows11)
- [常见问题](install-readme.md#其他问题)
- [网络/代理问题](install-readme.md#网络代理问题)
## 安装要求系统版本信息

- Windows10 1903及以上

- 4.6.x 版本更新 4.7.x, 需要卸载并重启系统后使用脚本方式安装
- 4.7.x第一次安装需要使用脚本方式安装

## Windows10

Expand Down
1 change: 1 addition & 0 deletions src/BiliLite.UWP/BiliLite.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
<Compile Include="Models\Functions\ToggleFullscreenShortcutFunction.cs" />
<Compile Include="Models\Functions\ToggleFullWindowShortcutFunction.cs" />
<Compile Include="Models\Functions\ToggleMiniWindowShortcutFunction.cs" />
<Compile Include="Pages\IScrollRecorablePage.cs" />
<Compile Include="Services\BiliLiteDbContext.cs" />
<Compile Include="ViewModels\Common\MainPageViewModel.cs" />
<Compile Include="ViewModels\Common\PieControlViewModel.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/BiliLite.UWP/BiliLite.UWP.csproj.native
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@
<Compile Include="Models\Functions\ToggleFullscreenShortcutFunction.cs" />
<Compile Include="Models\Functions\ToggleFullWindowShortcutFunction.cs" />
<Compile Include="Models\Functions\ToggleMiniWindowShortcutFunction.cs" />
<Compile Include="Pages\IScrollRecorablePage.cs" />
<Compile Include="Services\BiliLiteDbContext.cs" />
<Compile Include="ViewModels\Common\PieControlViewModel.cs" />
<Compile Include="ViewModels\Settings\CDNServerItemViewModel.cs" />
Expand Down
14 changes: 14 additions & 0 deletions src/BiliLite.UWP/Controls/MyAdaptiveGridView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public ICommand LoadMoreCommand
}
public bool CanLoadMore { get; set; } = false;

public double ScrollPosition => scrollViewer.VerticalOffset;

public double LoadMoreBottomOffset
{
get { return Convert.ToDouble(GetValue(LoadMoreBottomOffsetProperty)); }
Expand Down Expand Up @@ -88,5 +90,17 @@ private void ScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEven
}

}

public void ScrollTo(double offset)
{
scrollViewer.ScrollToVerticalOffset(offset);
}

public async Task ScrollRecover()
{
var position = ScrollPosition;
await Task.Delay(50);
ScrollTo(position);
}
}
}
4 changes: 2 additions & 2 deletions src/BiliLite.UWP/Controls/PlayerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,12 @@
<StackPanel>
<Grid Visibility="{Binding ShowTitlePart}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25"></ColumnDefinition>
<ColumnDefinition MinWidth="25"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding TitlePage}"
VerticalAlignment="Center"
Width="25">
MinWidth="25">
</TextBlock>
<TextBlock Grid.Column="1"
Text="{Binding TitlePart}"
Expand Down
8 changes: 8 additions & 0 deletions src/BiliLite.UWP/Controls/Settings/PlaySettingsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@
<ToggleSwitch x:Name="swPlayerSettingAutoFullWindows" ></ToggleSwitch>
</controls:SettingsCard>

<controls:SettingsCard Header="默认最大音质"
Description="不指定音质或找不到指定音质时,默认使用最大音质">
<controls:SettingsCard.HeaderIcon>
<font:FontAwesome Icon="Solid_Music"></font:FontAwesome>
</controls:SettingsCard.HeaderIcon>
<ToggleSwitch x:Name="SwitchEnableDefaultMaxSoundQuality" ></ToggleSwitch>
</controls:SettingsCard>

<controls:SettingsCard Header="双击播放器全屏"
Description="默认双击暂停">
<controls:SettingsCard.HeaderIcon>
Expand Down
10 changes: 10 additions & 0 deletions src/BiliLite.UWP/Controls/Settings/PlaySettingsControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ private void LoadPlayer()
SettingService.SetValue(SettingConstants.Player.AUTO_FULL_WINDOW, swPlayerSettingAutoFullWindows.IsOn);
});
});
//默认最大音质
SwitchEnableDefaultMaxSoundQuality.IsOn = SettingService.GetValue(SettingConstants.Player.ENABLE_DEFAULT_MAX_SOUND_QUALITY,
SettingConstants.Player.DEFAULT_ENABLE_DEFAULT_MAX_SOUND_QUALITY);
SwitchEnableDefaultMaxSoundQuality.Loaded += (sender, e) =>
{
SwitchEnableDefaultMaxSoundQuality.Toggled += (obj, args) =>
{
SettingService.SetValue(SettingConstants.Player.ENABLE_DEFAULT_MAX_SOUND_QUALITY, SwitchEnableDefaultMaxSoundQuality.IsOn);
};
};
//自动全屏
swPlayerSettingAutoFullScreen.IsOn = SettingService.GetValue<bool>(SettingConstants.Player.AUTO_FULL_SCREEN, false);
swPlayerSettingAutoFullScreen.Loaded += new RoutedEventHandler((sender, e) =>
Expand Down
14 changes: 10 additions & 4 deletions src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,20 @@
</ComboBox>
</controls:SettingsCard>

<controls:SettingsCard Header="快速收藏"
<controls:SettingsExpander Header="快速收藏"
Description="点击收藏按钮直接收藏视频到默认收藏夹">
<controls:SettingsCard.HeaderIcon>
<controls:SettingsExpander.HeaderIcon>
<font:FontAwesome Icon="Solid_Heart"></font:FontAwesome>
</controls:SettingsCard.HeaderIcon>
</controls:SettingsExpander.HeaderIcon>
<ToggleSwitch x:Name="SwitchQuickDoFav" >
</ToggleSwitch>
</controls:SettingsCard>

<controls:SettingsExpander.Items>
<controls:SettingsCard Header="默认收藏夹">
<TextBox x:Name="DefaultUseFav"></TextBox>
</controls:SettingsCard>
</controls:SettingsExpander.Items>
</controls:SettingsExpander>

<controls:SettingsCard Header="使用浏览器打开无法处理的链接"
Description="比如B站以外的链接">
Expand Down
10 changes: 10 additions & 0 deletions src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ private void LoadUI()
};
};

// 默认收藏夹
DefaultUseFav.Text = SettingService.GetValue(SettingConstants.UI.DEFAULT_USE_FAV, SettingConstants.UI.DEFAULT_USE_FAV_VALUE);
DefaultUseFav.Loaded += (sender, e) =>
{
DefaultUseFav.TextChanged += (obj, args) =>
{
SettingService.SetValue(SettingConstants.UI.DEFAULT_USE_FAV, DefaultUseFav.Text);
};
};

//动态显示
cbDetailDisplay.SelectedIndex = SettingService.GetValue<int>(SettingConstants.UI.DETAIL_DISPLAY, 0);
cbDetailDisplay.Loaded += new RoutedEventHandler((sender, e) =>
Expand Down
6 changes: 5 additions & 1 deletion src/BiliLite.UWP/Extensions/HttpResultsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
using Newtonsoft.Json.Linq;
using System;
using System.Threading.Tasks;
using BiliLite.Services;

namespace BiliLite.Extensions
{
public static class HttpResultsExtensions
{
private static readonly ILogger _logger = GlobalLogger.FromCurrentType();

public static async Task<T> GetJson<T>(this HttpResults httpResults)
{
return await Task.Run<T>(() =>
Expand Down Expand Up @@ -36,8 +39,9 @@ public static async Task<ApiDataModel<T>> GetData<T>(this HttpResults httpResult
{
return await GetJson<ApiDataModel<T>>(httpResults);
}
catch (Exception)
catch (Exception ex)
{
_logger.Error(ex.Message, ex);
return null;
}
}
Expand Down
24 changes: 24 additions & 0 deletions src/BiliLite.UWP/Models/Common/SettingConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ public class UI
[SettingDefaultValue]
public const bool DEFAULT_QUICK_DO_FAV = true;

/// <summary>
/// 默认收藏夹
/// </summary>
[SettingKey(typeof(string))]
public const string DEFAULT_USE_FAV = "DefaultUseFav";

/// <summary>
/// 默认收藏夹值
/// </summary>
[SettingDefaultValue]
public const string DEFAULT_USE_FAV_VALUE = "默认收藏夹";

/// <summary>
/// 隐藏赞助按钮
/// </summary>
Expand Down Expand Up @@ -606,6 +618,18 @@ public class Player
[SettingKey(typeof(int))]
public const string DEFAULT_SOUND_QUALITY = "PlayerDefaultSoundQuality";

/// <summary>
/// 启用默认最大音质
/// </summary>
[SettingKey(typeof(bool))]
public const string ENABLE_DEFAULT_MAX_SOUND_QUALITY = "PlayerEnableDefaultMaxSoundQuality";

/// <summary>
/// 默认不启用默认最大音质
/// </summary>
[SettingDefaultValue]
public const bool DEFAULT_ENABLE_DEFAULT_MAX_SOUND_QUALITY = false;

/// <summary>
/// 比例 int
/// </summary>
Expand Down
28 changes: 28 additions & 0 deletions src/BiliLite.UWP/Models/Common/Video/SoundQualityDictionary.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
using System.Collections.Generic;
using System.Linq;
using BiliLite.Models.Common.Video.PlayUrlInfos;
using BiliLite.Services;

namespace BiliLite.Models.Common.Video
{
public static class SoundQualityConstants
{
/// <summary>
/// 音质Id,音质名称
/// 根据音质大小从低到高排序
/// </summary>
private static Dictionary<int, string> m_dictionary = new Dictionary<int, string>()
{
{30216,"64K" },
Expand All @@ -20,5 +27,26 @@ public static Dictionary<int, string> Dictionary
return m_dictionary;
}
}

public static BiliDashAudioPlayUrlInfo GetDefaultAudio(List<BiliDashAudioPlayUrlInfo> audios)
{
var enableMaxQuality = SettingService.GetValue(
SettingConstants.Player.ENABLE_DEFAULT_MAX_SOUND_QUALITY,
SettingConstants.Player.DEFAULT_ENABLE_DEFAULT_MAX_SOUND_QUALITY
);

var preferredQualityIds = enableMaxQuality
? new[] { 30251, 30250, 30280, 30232, 30216 }
: new[] { 30280, 30232, 30216, 30251, 30250 };

foreach (var qualityId in preferredQualityIds)
{
var audio = audios.FirstOrDefault(x => x.QualityID == qualityId);
if (audio != null)
return audio;
}

return audios.FirstOrDefault();
}
}
}
6 changes: 5 additions & 1 deletion src/BiliLite.UWP/Models/Functions/InputKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public class InputKey
{ 220, "\\" },
{ 221, "]" },
{ 219, "[" },
{ 192, "`" }
{ 192, "`" },
{ 37, "←" },
{ 39, "→" },
{ 38, "↑" },
{ 40, "↓" }
};

public VirtualKey BoardKey { get; set; }
Expand Down
9 changes: 7 additions & 2 deletions src/BiliLite.UWP/Models/Requests/Api/PlayerAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using BiliLite.Models.Common;
using BiliLite.Services;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace BiliLite.Models.Requests.Api
Expand All @@ -24,7 +25,7 @@ public ApiModel VideoPlayUrl(string aid, string cid, int qn, bool dash, bool pro
need_cookie = true,
};
api.parameter += "&fourk=1&fnver=0&fnval=4048";

if (proxy)
{
api.parameter += $"&area={area}";
Expand All @@ -49,12 +50,16 @@ public ApiModel SeasonPlayUrl(string aid, string cid, string ep_id, int qn, int
{
api.parameter += $"&access_key={SettingService.Account.AccessKey}&mid={SettingService.Account.Profile.mid}";
}
api.parameter += "&fourk=1&fnver=0&fnval=4048";
api.parameter += "&fourk=1&fnver=0&fnval=12240";

api.parameter += ApiHelper.GetSign(api.parameter, AppKey);
if (proxy)
{
api.parameter += $"&area={area}";
api.headers = new Dictionary<string, string>()
{
{"referer","https://www.bilibili.com"}
};
}
return api;
}
Expand Down
3 changes: 2 additions & 1 deletion src/BiliLite.UWP/Models/Requests/Api/User/UserDetailAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public async Task<ApiModel> UserInfo(string mid)
{
method = RestSharp.Method.Get,
baseUrl = $"{ApiHelper.API_BASE_URL}/x/space/wbi/acc/info",
parameter = ApiHelper.MustParameter(AppKey, needAccesskey: true) + $"&mid={mid}",
parameter = $"mid={mid}",
need_cookie = true
};
api.parameter = await ApiHelper.GetWbiSign(api.parameter);
return api;
Expand Down
4 changes: 2 additions & 2 deletions src/BiliLite.UWP/Modules/Player/InteractionVideoVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public class InteractionEdgeInfoStoryListModel
public int node_id { get; set; }
public int edge_id { get; set; }
public string title { get; set; }
public int cid { get; set; }
public long cid { get; set; }
public int start_pos { get; set; }
public string cover { get; set; }
public int cursor { get; set; }
Expand All @@ -129,7 +129,7 @@ public class InteractionEdgeInfoChoiceModel
public string platform_action { get; set; }
public string native_action { get; set; }
public string condition { get; set; }
public int cid { get; set; }
public long cid { get; set; }
public string option { get; set; }
public int is_default { get; set; }
public string cover { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/BiliLite.UWP/Modules/Player/PlayerVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public class InteractionHistoryNodeModel
{
public int node_id { get; set; }
public string title { get; set; }
public int cid { get; set; }
public long cid { get; set; }
}

public class InteractionModel
Expand Down
4 changes: 2 additions & 2 deletions src/BiliLite.UWP/Modules/Player/Playurl/BiliPlayUrlRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ private async Task<BiliDashItem> ParseBiliPlayUrlInfoAudioDash(BiliPlayUrlQualit
if (audios.Any())
{
var audioQuality = info.AudioQualites.FirstOrDefault(x => x.QualityID == soundQualityId);
var defaultAudio = qn > 64 ? audios.LastOrDefault() : audios.FirstOrDefault();
info.CurrentAudioQuality = audioQuality ?? info.AudioQualites.FirstOrDefault(x => x.QualityID == defaultAudio.id);
var defaultAudio = SoundQualityConstants.GetDefaultAudio(info.AudioQualites);
info.CurrentAudioQuality = audioQuality ?? defaultAudio;
currentAudio = info.CurrentAudioQuality.Audio;
}
return currentAudio;
Expand Down
4 changes: 4 additions & 0 deletions src/BiliLite.UWP/NoTabMainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ private void btnBack_Click(object sender, RoutedEventArgs e)
{
frame.GoBack();
BackTitle();
if (frame.Content is IScrollRecoverablePage page)
{
page.ScrollRecover();
}
}
}

Expand Down
Loading

0 comments on commit 0b12b2f

Please sign in to comment.