Files
PiliPlus/lib/models/video/play/subtitle.dart
bggRGjQaUbCoE f36f8d69fc refa: subtitle
Closes #553

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-28 16:13:21 +08:00

24 lines
683 B
Dart

enum SubtitlePreference { off, on, withoutAi }
extension SubtitlePreferenceDesc on SubtitlePreference {
static final List<String> _descList = [
'默认不显示字幕',
'选择第一个可用字幕',
'跳过自动生成(ai)字幕,选择第一个可用字幕'
];
get description => _descList[index];
}
extension SubtitlePreferenceCode on SubtitlePreference {
static final List<String> _codeList = ['off', 'on', 'withoutAi'];
String get code => _codeList[index];
static SubtitlePreference? fromCode(String code) {
final index = _codeList.indexOf(code);
if (index != -1) {
return SubtitlePreference.values[index];
}
return null;
}
}