diff --git a/DownKyi/Languages/Default.xaml b/DownKyi/Languages/Default.xaml index 9be0a8b..71c49b6 100644 --- a/DownKyi/Languages/Default.xaml +++ b/DownKyi/Languages/Default.xaml @@ -119,6 +119,7 @@ 视频 优先下载的视频编码: 优先下载的视频画质: + 优先下载的视频音质: 下载FLV视频后转码为mp4 使用默认下载目录 默认下载目录: diff --git a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs index 6391106..6f30107 100644 --- a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs +++ b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs @@ -1,4 +1,5 @@ -using DownKyi.Core.FileName; +using DownKyi.Core.BiliApi.BiliUtils; +using DownKyi.Core.FileName; using DownKyi.Core.Settings; using DownKyi.Events; using DownKyi.Models; @@ -50,6 +51,20 @@ namespace DownKyi.ViewModels.Settings set => SetProperty(ref selectedVideoQuality, value); } + private List audioQualityList; + public List AudioQualityList + { + get => audioQualityList; + set => SetProperty(ref audioQualityList, value); + } + + private string selectedAudioQuality; + public string SelectedAudioQuality + { + get => selectedAudioQuality; + set => SetProperty(ref selectedAudioQuality, value); + } + private bool isTranscodingFlvToMp4; public bool IsTranscodingFlvToMp4 { @@ -104,12 +119,20 @@ namespace DownKyi.ViewModels.Settings VideoCodecs = new List { "H.264/AVC", - "H.265/HEVC" + "H.265/HEVC", }; // 优先下载画质 VideoQualityList = new ResolutionService().GetResolution(); + // 优先下载音质 + AudioQualityList = new List + { + "64K", + "132K", + "192K", + }; + // 文件命名格式 SelectedFileName = new ObservableCollection(); OptionalFields = new ObservableCollection(); @@ -143,6 +166,10 @@ namespace DownKyi.ViewModels.Settings int quality = SettingsManager.GetInstance().GetQuality(); SelectedVideoQuality = VideoQualityList.FirstOrDefault(t => { return t.Id == quality; }); + // 优先下载音质 + int audioQuality = SettingsManager.GetInstance().GetAudioQuality(); + SelectedAudioQuality = Constant.AudioQuality[audioQuality]; + // 是否下载flv视频后转码为mp4 AllowStatus isTranscodingFlvToMp4 = SettingsManager.GetInstance().IsTranscodingFlvToMp4(); IsTranscodingFlvToMp4 = isTranscodingFlvToMp4 == AllowStatus.YES; @@ -200,6 +227,20 @@ namespace DownKyi.ViewModels.Settings PublishTip(isSucceed); } + // 优先下载音质事件 + private DelegateCommand audioQualityCommand; + public DelegateCommand AudioQualityCommand => audioQualityCommand ?? (audioQualityCommand = new DelegateCommand(ExecuteAudioQualityCommand)); + + /// + /// 优先下载音质事件 + /// + /// + private void ExecuteAudioQualityCommand(string parameter) + { + bool isSucceed = SettingsManager.GetInstance().SetAudioQuality(Constant.AudioQualityId[parameter]); + PublishTip(isSucceed); + } + // 是否下载flv视频后转码为mp4事件 private DelegateCommand isTranscodingFlvToMp4Command; public DelegateCommand IsTranscodingFlvToMp4Command => isTranscodingFlvToMp4Command ?? (isTranscodingFlvToMp4Command = new DelegateCommand(ExecuteIsTranscodingFlvToMp4Command)); diff --git a/DownKyi/Views/Settings/ViewVideo.xaml b/DownKyi/Views/Settings/ViewVideo.xaml index 1938bfd..7a9bf48 100644 --- a/DownKyi/Views/Settings/ViewVideo.xaml +++ b/DownKyi/Views/Settings/ViewVideo.xaml @@ -54,6 +54,27 @@ + + + + + + + + + + + +