增加音质选择设置

croire 3 years ago
parent 2ccdff96a8
commit 31d82a9309

@ -119,6 +119,7 @@
<system:String x:Key="Video">视频</system:String> <system:String x:Key="Video">视频</system:String>
<system:String x:Key="FirstVideoCodecs">优先下载的视频编码:</system:String> <system:String x:Key="FirstVideoCodecs">优先下载的视频编码:</system:String>
<system:String x:Key="FirstVideoQuality">优先下载的视频画质:</system:String> <system:String x:Key="FirstVideoQuality">优先下载的视频画质:</system:String>
<system:String x:Key="FirstAudioQuality">优先下载的视频音质:</system:String>
<system:String x:Key="IsTranscodingFlvToMp4">下载FLV视频后转码为mp4</system:String> <system:String x:Key="IsTranscodingFlvToMp4">下载FLV视频后转码为mp4</system:String>
<system:String x:Key="IsUseDefaultDirectory">使用默认下载目录</system:String> <system:String x:Key="IsUseDefaultDirectory">使用默认下载目录</system:String>
<system:String x:Key="DefaultDirectory">默认下载目录:</system:String> <system:String x:Key="DefaultDirectory">默认下载目录:</system:String>

@ -1,4 +1,5 @@
using DownKyi.Core.FileName; using DownKyi.Core.BiliApi.BiliUtils;
using DownKyi.Core.FileName;
using DownKyi.Core.Settings; using DownKyi.Core.Settings;
using DownKyi.Events; using DownKyi.Events;
using DownKyi.Models; using DownKyi.Models;
@ -50,6 +51,20 @@ namespace DownKyi.ViewModels.Settings
set => SetProperty(ref selectedVideoQuality, value); set => SetProperty(ref selectedVideoQuality, value);
} }
private List<string> audioQualityList;
public List<string> AudioQualityList
{
get => audioQualityList;
set => SetProperty(ref audioQualityList, value);
}
private string selectedAudioQuality;
public string SelectedAudioQuality
{
get => selectedAudioQuality;
set => SetProperty(ref selectedAudioQuality, value);
}
private bool isTranscodingFlvToMp4; private bool isTranscodingFlvToMp4;
public bool IsTranscodingFlvToMp4 public bool IsTranscodingFlvToMp4
{ {
@ -104,12 +119,20 @@ namespace DownKyi.ViewModels.Settings
VideoCodecs = new List<string> VideoCodecs = new List<string>
{ {
"H.264/AVC", "H.264/AVC",
"H.265/HEVC" "H.265/HEVC",
}; };
// 优先下载画质 // 优先下载画质
VideoQualityList = new ResolutionService().GetResolution(); VideoQualityList = new ResolutionService().GetResolution();
// 优先下载音质
AudioQualityList = new List<string>
{
"64K",
"132K",
"192K",
};
// 文件命名格式 // 文件命名格式
SelectedFileName = new ObservableCollection<DisplayFileNamePart>(); SelectedFileName = new ObservableCollection<DisplayFileNamePart>();
OptionalFields = new ObservableCollection<DisplayFileNamePart>(); OptionalFields = new ObservableCollection<DisplayFileNamePart>();
@ -143,6 +166,10 @@ namespace DownKyi.ViewModels.Settings
int quality = SettingsManager.GetInstance().GetQuality(); int quality = SettingsManager.GetInstance().GetQuality();
SelectedVideoQuality = VideoQualityList.FirstOrDefault(t => { return t.Id == quality; }); SelectedVideoQuality = VideoQualityList.FirstOrDefault(t => { return t.Id == quality; });
// 优先下载音质
int audioQuality = SettingsManager.GetInstance().GetAudioQuality();
SelectedAudioQuality = Constant.AudioQuality[audioQuality];
// 是否下载flv视频后转码为mp4 // 是否下载flv视频后转码为mp4
AllowStatus isTranscodingFlvToMp4 = SettingsManager.GetInstance().IsTranscodingFlvToMp4(); AllowStatus isTranscodingFlvToMp4 = SettingsManager.GetInstance().IsTranscodingFlvToMp4();
IsTranscodingFlvToMp4 = isTranscodingFlvToMp4 == AllowStatus.YES; IsTranscodingFlvToMp4 = isTranscodingFlvToMp4 == AllowStatus.YES;
@ -200,6 +227,20 @@ namespace DownKyi.ViewModels.Settings
PublishTip(isSucceed); PublishTip(isSucceed);
} }
// 优先下载音质事件
private DelegateCommand<string> audioQualityCommand;
public DelegateCommand<string> AudioQualityCommand => audioQualityCommand ?? (audioQualityCommand = new DelegateCommand<string>(ExecuteAudioQualityCommand));
/// <summary>
/// 优先下载音质事件
/// </summary>
/// <param name="parameter"></param>
private void ExecuteAudioQualityCommand(string parameter)
{
bool isSucceed = SettingsManager.GetInstance().SetAudioQuality(Constant.AudioQualityId[parameter]);
PublishTip(isSucceed);
}
// 是否下载flv视频后转码为mp4事件 // 是否下载flv视频后转码为mp4事件
private DelegateCommand isTranscodingFlvToMp4Command; private DelegateCommand isTranscodingFlvToMp4Command;
public DelegateCommand IsTranscodingFlvToMp4Command => isTranscodingFlvToMp4Command ?? (isTranscodingFlvToMp4Command = new DelegateCommand(ExecuteIsTranscodingFlvToMp4Command)); public DelegateCommand IsTranscodingFlvToMp4Command => isTranscodingFlvToMp4Command ?? (isTranscodingFlvToMp4Command = new DelegateCommand(ExecuteIsTranscodingFlvToMp4Command));

@ -54,6 +54,27 @@
</ComboBox> </ComboBox>
</StackPanel> </StackPanel>
<StackPanel Margin="0,20,0,0" Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource BrushTextDark}"
Text="{DynamicResource FirstAudioQuality}" />
<ComboBox
Name="nameAudioQualityList"
Width="120"
VerticalContentAlignment="Center"
ItemsSource="{Binding AudioQualityList}"
SelectedItem="{Binding SelectedAudioQuality}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding AudioQualityCommand}" CommandParameter="{Binding ElementName=nameAudioQualityList, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>
</StackPanel>
<CheckBox <CheckBox
Margin="0,20,0,0" Margin="0,20,0,0"
HorizontalAlignment="Left" HorizontalAlignment="Left"

Loading…
Cancel
Save