diff --git a/src/App/Controls/Settings/PlayerModeSettingSection.xaml b/src/App/Controls/Settings/PlayerModeSettingSection.xaml index d28a05bd..22660be5 100644 --- a/src/App/Controls/Settings/PlayerModeSettingSection.xaml +++ b/src/App/Controls/Settings/PlayerModeSettingSection.xaml @@ -115,9 +115,6 @@ - - - diff --git a/src/Models/Models.Constants/App/SettingNames.cs b/src/Models/Models.Constants/App/SettingNames.cs index 451179d0..9f52c21e 100644 --- a/src/Models/Models.Constants/App/SettingNames.cs +++ b/src/Models/Models.Constants/App/SettingNames.cs @@ -38,7 +38,6 @@ public enum SettingNames PlaybackRate, DanmakuArea, DanmakuSpeed, - DisableP2PCdn, IsContinuePlay, IgnoreVersion, IsOnlyShowIndex, diff --git a/src/ViewModels/Components/PlayerDetailViewModel/PlayerDetailViewModel.Video.cs b/src/ViewModels/Components/PlayerDetailViewModel/PlayerDetailViewModel.Video.cs index fd3a7b5c..985ced57 100644 --- a/src/ViewModels/Components/PlayerDetailViewModel/PlayerDetailViewModel.Video.cs +++ b/src/ViewModels/Components/PlayerDetailViewModel/PlayerDetailViewModel.Video.cs @@ -2,7 +2,6 @@ using System; using System.Linq; -using System.Text.RegularExpressions; using System.Threading.Tasks; using Bili.Copilot.Libs.Provider; using Bili.Copilot.Libs.Toolkit; @@ -83,7 +82,6 @@ private async Task InitializeVideoMediaInformationAsync() { var view = _viewData as VideoPlayerView; _mediaInformation = await PlayerProvider.GetVideoMediaInformationAsync(view.Information.Identifier.Id, _currentPart.Id); - CheckVideoP2PUrls(); } private async Task InitializeOriginalVideoSourceAsync() @@ -173,57 +171,6 @@ private async Task SelectVideoFormatAsync(FormatInformation format) } } - private void CheckVideoP2PUrls() - { - if (!SettingsToolkit.ReadLocalSetting(SettingNames.DisableP2PCdn, false)) - { - return; - } - - // 剔除 P2P CDN URL - if (_mediaInformation.AudioSegments != null) - { - var cdnUrl = _mediaInformation.AudioSegments.Select(p => p.BaseUrl) - .Concat(_mediaInformation.AudioSegments.SelectMany(p => p.BackupUrls)) - .FirstOrDefault(p => Regex.IsMatch(p, "up[\\w-]+\\.bilivideo\\.com")); - var cdn = string.IsNullOrEmpty(cdnUrl) ? "upos-sz-mirrorcoso1.bilivideo.com" : new Uri(cdnUrl).Host; - - for (var i = 0; i < _mediaInformation.AudioSegments.Count(); i++) - { - var seg = _mediaInformation.AudioSegments[i]; - var url = new Uri(seg.BaseUrl); - if (url.Host.Contains(".mcdn.bilivideo.cn")) - { - var replacedUrl = seg.BaseUrl.Replace(url.Host, cdn) - .Replace($":{url.Port}", ":443"); - - seg.BaseUrl = replacedUrl; - } - } - } - - if (_mediaInformation.VideoSegments != null) - { - var cdnUrl = _mediaInformation.VideoSegments.Select(p => p.BaseUrl) - .Concat(_mediaInformation.VideoSegments.SelectMany(p => p.BackupUrls)) - .FirstOrDefault(p => Regex.IsMatch(p, "up[\\w-]+\\.bilivideo\\.com")); - var cdn = string.IsNullOrEmpty(cdnUrl) ? "upos-sz-mirrorcoso1.bilivideo.com" : new Uri(cdnUrl).Host; - - for (var i = 0; i < _mediaInformation.VideoSegments.Count(); i++) - { - var seg = _mediaInformation.VideoSegments[i]; - var url = new Uri(seg.BaseUrl); - if (url.Host.Contains(".mcdn.bilivideo.cn")) - { - var replacedUrl = seg.BaseUrl.Replace(url.Host, cdn) - .Replace($":{url.Port}", ":443"); - - seg.BaseUrl = replacedUrl; - } - } - } - } - [RelayCommand] private void SelectInteractionChoice(InteractionInformation info) { diff --git a/src/ViewModels/Views/SettingsPageViewModel/SettingsPageViewModel.Properties.cs b/src/ViewModels/Views/SettingsPageViewModel/SettingsPageViewModel.Properties.cs index 38bd8f00..d8211df6 100644 --- a/src/ViewModels/Views/SettingsPageViewModel/SettingsPageViewModel.Properties.cs +++ b/src/ViewModels/Views/SettingsPageViewModel/SettingsPageViewModel.Properties.cs @@ -28,9 +28,6 @@ public sealed partial class SettingsPageViewModel [ObservableProperty] private PlayerDisplayMode _defaultPlayerDisplayMode; - [ObservableProperty] - private bool _disableP2PCdn; - [ObservableProperty] private bool _isContinuePlay; diff --git a/src/ViewModels/Views/SettingsPageViewModel/SettingsPageViewModel.cs b/src/ViewModels/Views/SettingsPageViewModel/SettingsPageViewModel.cs index f0814dc4..e227a904 100644 --- a/src/ViewModels/Views/SettingsPageViewModel/SettingsPageViewModel.cs +++ b/src/ViewModels/Views/SettingsPageViewModel/SettingsPageViewModel.cs @@ -41,7 +41,6 @@ public void InitializeSettings() CheckTheme(); IsAutoPlayWhenLoaded = ReadSetting(SettingNames.IsAutoPlayWhenLoaded, true); IsAutoPlayNextRelatedVideo = ReadSetting(SettingNames.IsAutoPlayNextRelatedVideo, false); - DisableP2PCdn = ReadSetting(SettingNames.DisableP2PCdn, false); IsContinuePlay = ReadSetting(SettingNames.IsContinuePlay, true); IsAutoCloseWindowWhenEnded = ReadSetting(SettingNames.IsAutoCloseWindowWhenEnded, false); SingleFastForwardAndRewindSpan = ReadSetting(SettingNames.SingleFastForwardAndRewindSpan, 30d); @@ -83,9 +82,6 @@ private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) case nameof(DefaultPlayerDisplayMode): WriteSetting(SettingNames.DefaultPlayerDisplayMode, DefaultPlayerDisplayMode); break; - case nameof(DisableP2PCdn): - WriteSetting(SettingNames.DisableP2PCdn, DisableP2PCdn); - break; case nameof(IsContinuePlay): WriteSetting(SettingNames.IsContinuePlay, IsContinuePlay); break;