opt: model (#851)

* opt: readlist model

* opt: video item model
This commit is contained in:
My-Responsitories
2025-05-11 17:00:24 +08:00
committed by GitHub
parent c899ea95e1
commit 8d34e6f340
15 changed files with 130 additions and 397 deletions

View File

@@ -1,55 +1,23 @@
enum VideoQuality {
speed240,
fluent360,
clear480,
high720,
high72060,
high1080,
high1080plus,
high108060,
super4K,
hdr,
dolbyVision,
super8k
}
extension VideoQualityExt on VideoQuality {
static const List<int> _codeList = [
6,
16,
32,
64,
74,
80,
112,
116,
120,
125,
126,
127,
];
int get code => _codeList[index];
static VideoQuality? fromCode(int code) {
final index = _codeList.indexOf(code);
if (index != -1) {
return VideoQuality.values[index];
}
return null;
}
String get description => const [
'240P 极速',
'360P 流畅',
'480P 清晰',
'720P 高清',
'720P60 高帧率',
'1080P 高清',
'1080P+ 高码率',
'1080P60 高帧率',
'4K 超清',
'HDR 真彩色',
'杜比视界',
'8K 超高清'
][index];
speed240(6, '240P 极速'),
fluent360(16, '360P 流畅'),
clear480(32, '480P 清晰'),
high720(64, '720P 高清'),
high72060(74, '720P60 高帧率'),
high1080(80, '1080P 高清'),
high1080plus(112, '1080P+ 高码率'),
high108060(116, '1080P60 高帧率'),
super4K(120, '4K 超清'),
hdr(125, 'HDR 真彩色'),
dolbyVision(126, '杜比视界'),
super8k(127, '8K 超高清');
final int code;
final String description;
const VideoQuality(this.code, this.description);
static final _codeMap = {for (var i in values) i.code: i};
static VideoQuality fromCode(int code) => _codeMap[code]!;
}