mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
10
lib/models/common/account_type.dart
Normal file
10
lib/models/common/account_type.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
enum AccountType {
|
||||
main,
|
||||
heartbeat,
|
||||
recommend,
|
||||
video,
|
||||
}
|
||||
|
||||
extension AccountTypeExt on AccountType {
|
||||
String get title => const ['主账号', '记录观看', '推荐', '视频取流'][index];
|
||||
}
|
||||
13
lib/models/common/avatar_badge_type.dart
Normal file
13
lib/models/common/avatar_badge_type.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum BadgeType { none, vip, person, institution }
|
||||
|
||||
extension BadgeTypeExt on BadgeType {
|
||||
String get desc => const ['', '大会员', '认证个人', '认证机构'][index];
|
||||
Color get color => const [
|
||||
Colors.transparent,
|
||||
Color(0xFFFF6699),
|
||||
Color(0xFFFFCC00),
|
||||
Colors.lightBlueAccent
|
||||
][index];
|
||||
}
|
||||
5
lib/models/common/dynamic/dynamic_badge_mode.dart
Normal file
5
lib/models/common/dynamic/dynamic_badge_mode.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
enum DynamicBadgeMode { hidden, point, number }
|
||||
|
||||
extension DynamicBadgeModeExt on DynamicBadgeMode {
|
||||
String get description => const ['隐藏', '红点', '数字'][index];
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
enum DynamicsType {
|
||||
enum DynamicsTabType {
|
||||
all,
|
||||
video,
|
||||
pgc,
|
||||
@@ -6,7 +6,7 @@ enum DynamicsType {
|
||||
up,
|
||||
}
|
||||
|
||||
extension BusinessTypeExtension on DynamicsType {
|
||||
extension DynamicsTabTypeExt on DynamicsTabType {
|
||||
String get values => const ['all', 'video', 'pgc', 'article', 'up'][index];
|
||||
String get labels => const ['全部', '投稿', '番剧', '专栏', 'UP'][index];
|
||||
}
|
||||
@@ -14,31 +14,31 @@ extension BusinessTypeExtension on DynamicsType {
|
||||
const List tabsConfig = [
|
||||
{
|
||||
'tag': 'all',
|
||||
'value': DynamicsType.all,
|
||||
'value': DynamicsTabType.all,
|
||||
'label': '全部',
|
||||
'enabled': true,
|
||||
},
|
||||
{
|
||||
'tag': 'video',
|
||||
'value': DynamicsType.video,
|
||||
'value': DynamicsTabType.video,
|
||||
'label': '投稿',
|
||||
'enabled': true,
|
||||
},
|
||||
{
|
||||
'tag': 'pgc',
|
||||
'value': DynamicsType.pgc,
|
||||
'value': DynamicsTabType.pgc,
|
||||
'label': '番剧',
|
||||
'enabled': true,
|
||||
},
|
||||
{
|
||||
'tag': 'article',
|
||||
'value': DynamicsType.article,
|
||||
'value': DynamicsTabType.article,
|
||||
'label': '专栏',
|
||||
'enabled': true,
|
||||
},
|
||||
{
|
||||
'tag': 'up',
|
||||
'value': DynamicsType.up,
|
||||
'value': DynamicsTabType.up,
|
||||
'label': 'UP',
|
||||
'enabled': true,
|
||||
},
|
||||
@@ -5,6 +5,6 @@ enum UpPanelPosition {
|
||||
rightDrawer,
|
||||
}
|
||||
|
||||
extension UpPanelPositionDesc on UpPanelPosition {
|
||||
extension UpPanelPositionExt on UpPanelPosition {
|
||||
String get labels => const ['左侧常驻', '右侧常驻', '左侧抽屉', '右侧抽屉'][index];
|
||||
}
|
||||
5
lib/models/common/episode_panel_type.dart
Normal file
5
lib/models/common/episode_panel_type.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
enum EpisodeType { part, season, bangumi }
|
||||
|
||||
extension EpisodeTypeExt on EpisodeType {
|
||||
String get title => const ['分P', '合集', '番剧'][index];
|
||||
}
|
||||
19
lib/models/common/fav_type.dart
Normal file
19
lib/models/common/fav_type.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:PiliPlus/pages/fav/article/view.dart';
|
||||
import 'package:PiliPlus/pages/fav/note/view.dart';
|
||||
import 'package:PiliPlus/pages/fav/pgc/view.dart';
|
||||
import 'package:PiliPlus/pages/fav/video/view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum FavTabType { video, bangumi, cinema, article, note }
|
||||
|
||||
extension FavTabTypeExt on FavTabType {
|
||||
String get title => const ['视频', '追番', '追剧', '专栏', '笔记'][index];
|
||||
|
||||
Widget get page => switch (this) {
|
||||
FavTabType.video => const FavVideoPage(),
|
||||
FavTabType.bangumi => const FavPgcPage(type: 1),
|
||||
FavTabType.cinema => const FavPgcPage(type: 2),
|
||||
FavTabType.article => const FavArticlePage(),
|
||||
FavTabType.note => const FavNotePage(),
|
||||
};
|
||||
}
|
||||
6
lib/models/common/follow_order_type.dart
Normal file
6
lib/models/common/follow_order_type.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
enum FollowOrderType { def, attention }
|
||||
|
||||
extension FollowOrderTypeExt on FollowOrderType {
|
||||
String get type => const ['', 'attention'][index];
|
||||
String get title => const ['最近关注', '最常访问'][index];
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
enum BusinessType {
|
||||
enum HistoryBusinessType {
|
||||
// 普通视频
|
||||
archive,
|
||||
// 剧集(番剧 / 影视)
|
||||
@@ -13,7 +13,7 @@ enum BusinessType {
|
||||
showBadge
|
||||
}
|
||||
|
||||
extension BusinessTypeExtension on BusinessType {
|
||||
extension HistoryBusinessTypeExt on HistoryBusinessType {
|
||||
String get type =>
|
||||
const ['archive', 'pgc', 'live', 'article-list', 'article'][index];
|
||||
// 隐藏时长
|
||||
@@ -12,9 +12,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
|
||||
enum TabType { live, rcmd, hot, rank, bangumi, cinema }
|
||||
enum HomeTabType { live, rcmd, hot, rank, bangumi, cinema }
|
||||
|
||||
extension TabTypeDesc on TabType {
|
||||
extension HomeTabTypeExt on HomeTabType {
|
||||
String get description => const ['直播', '推荐', '热门', '分区', '番剧', '影视'][index];
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ List get tabsConfig => [
|
||||
size: 15,
|
||||
),
|
||||
'label': '直播',
|
||||
'type': TabType.live,
|
||||
'type': HomeTabType.live,
|
||||
'ctr': Get.find<LiveController>,
|
||||
'page': const LivePage(),
|
||||
},
|
||||
@@ -35,7 +35,7 @@ List get tabsConfig => [
|
||||
size: 15,
|
||||
),
|
||||
'label': '推荐',
|
||||
'type': TabType.rcmd,
|
||||
'type': HomeTabType.rcmd,
|
||||
'ctr': Get.find<RcmdController>,
|
||||
'page': const RcmdPage(),
|
||||
},
|
||||
@@ -45,7 +45,7 @@ List get tabsConfig => [
|
||||
size: 15,
|
||||
),
|
||||
'label': '热门',
|
||||
'type': TabType.hot,
|
||||
'type': HomeTabType.hot,
|
||||
'ctr': Get.find<HotController>,
|
||||
'page': const HotPage(),
|
||||
},
|
||||
@@ -55,7 +55,7 @@ List get tabsConfig => [
|
||||
size: 15,
|
||||
),
|
||||
'label': '分区',
|
||||
'type': TabType.rank,
|
||||
'type': HomeTabType.rank,
|
||||
'ctr': Get.find<RankController>,
|
||||
'page': const RankPage(),
|
||||
},
|
||||
@@ -65,9 +65,9 @@ List get tabsConfig => [
|
||||
size: 15,
|
||||
),
|
||||
'label': '番剧',
|
||||
'type': TabType.bangumi,
|
||||
'type': HomeTabType.bangumi,
|
||||
'ctr': Get.find<BangumiController>,
|
||||
'page': const BangumiPage(tabType: TabType.bangumi),
|
||||
'page': const BangumiPage(tabType: HomeTabType.bangumi),
|
||||
},
|
||||
{
|
||||
'icon': Icon(
|
||||
@@ -75,8 +75,8 @@ List get tabsConfig => [
|
||||
size: 15,
|
||||
),
|
||||
'label': '影视',
|
||||
'type': TabType.cinema,
|
||||
'type': HomeTabType.cinema,
|
||||
'ctr': Get.find<BangumiController>,
|
||||
'page': const BangumiPage(tabType: TabType.cinema),
|
||||
'page': const BangumiPage(tabType: HomeTabType.cinema),
|
||||
},
|
||||
];
|
||||
17
lib/models/common/image_preview_type.dart
Normal file
17
lib/models/common/image_preview_type.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
enum SourceType { fileImage, networkImage, livePhoto }
|
||||
|
||||
class SourceModel {
|
||||
final SourceType sourceType;
|
||||
final String url;
|
||||
final String? liveUrl;
|
||||
final int? width;
|
||||
final int? height;
|
||||
|
||||
const SourceModel({
|
||||
this.sourceType = SourceType.networkImage,
|
||||
required this.url,
|
||||
this.liveUrl,
|
||||
this.width,
|
||||
this.height,
|
||||
});
|
||||
}
|
||||
12
lib/models/common/later_view_type.dart
Normal file
12
lib/models/common/later_view_type.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:PiliPlus/pages/later/child_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum LaterViewType { all, toView, unfinished, viewed }
|
||||
|
||||
extension LaterViewTypeExt on LaterViewType {
|
||||
int get type => index;
|
||||
|
||||
String get title => const ['全部', '未看', '未看完', '已看完'][index];
|
||||
|
||||
Widget get page => LaterViewChildPage(laterViewType: this);
|
||||
}
|
||||
1
lib/models/common/member/contribute_type.dart
Normal file
1
lib/models/common/member/contribute_type.dart
Normal file
@@ -0,0 +1 @@
|
||||
enum ContributeType { video, charging, season, series, bangumi }
|
||||
1
lib/models/common/member/profile_type.dart
Normal file
1
lib/models/common/member/profile_type.dart
Normal file
@@ -0,0 +1 @@
|
||||
enum ProfileType { uname, sign, sex, birthday }
|
||||
5
lib/models/common/member/tab_type.dart
Normal file
5
lib/models/common/member/tab_type.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
enum MemberTabType { none, home, dynamic, contribute, favorite, bangumi }
|
||||
|
||||
extension MemberTabTypeExt on MemberTabType {
|
||||
String get title => const ['默认', '主页', '动态', '投稿', '收藏', '番剧'][index];
|
||||
}
|
||||
27
lib/models/common/msg/msg_type.dart
Normal file
27
lib/models/common/msg/msg_type.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
enum MsgType {
|
||||
invalid(value: 0, label: "空空的~"),
|
||||
text(value: 1, label: "文本消息"),
|
||||
pic(value: 2, label: "图片消息"),
|
||||
audio(value: 3, label: "语音消息"),
|
||||
share(value: 4, label: "分享消息"),
|
||||
revoke(value: 5, label: "撤回消息"),
|
||||
customFace(value: 6, label: "自定义表情"),
|
||||
shareV2(value: 7, label: "分享v2消息"),
|
||||
sysCancel(value: 8, label: "系统撤销"),
|
||||
miniProgram(value: 9, label: "小程序"),
|
||||
notifyMsg(value: 10, label: "业务通知"),
|
||||
archiveCard(value: 11, label: "投稿卡片"),
|
||||
articleCard(value: 12, label: "专栏卡片"),
|
||||
picCard(value: 13, label: "图片卡片"),
|
||||
commonShare(value: 14, label: "异形卡片"),
|
||||
autoReplyPush(value: 16, label: "自动回复推送"),
|
||||
notifyText(value: 18, label: "文本提示");
|
||||
|
||||
final int value;
|
||||
final String label;
|
||||
const MsgType({required this.value, required this.label});
|
||||
static MsgType parse(int value) {
|
||||
return MsgType.values
|
||||
.firstWhere((e) => e.value == value, orElse: () => MsgType.invalid);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,3 @@
|
||||
enum DynamicBadgeMode { hidden, point, number }
|
||||
|
||||
extension DynamicBadgeModeDesc on DynamicBadgeMode {
|
||||
String get description => const ['隐藏', '红点', '数字'][index];
|
||||
}
|
||||
|
||||
enum MsgUnReadType { pm, reply, at, like, sysMsg }
|
||||
|
||||
extension MsgUnReadTypeExt on MsgUnReadType {
|
||||
1
lib/models/common/publish_panel_type.dart
Normal file
1
lib/models/common/publish_panel_type.dart
Normal file
@@ -0,0 +1 @@
|
||||
enum PanelType { none, keyboard, emoji }
|
||||
14
lib/models/common/reply/reply_option_type.dart
Normal file
14
lib/models/common/reply/reply_option_type.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
|
||||
enum ReplyOptionType { allow, close, choose }
|
||||
|
||||
extension ReplyOptionTypeExt on ReplyOptionType {
|
||||
String get title => const ['允许评论', '关闭评论', '精选评论'][index];
|
||||
|
||||
IconData get iconData => switch (this) {
|
||||
ReplyOptionType.allow => MdiIcons.commentTextOutline,
|
||||
ReplyOptionType.close => MdiIcons.commentOffOutline,
|
||||
ReplyOptionType.choose => MdiIcons.commentProcessingOutline
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
enum ReplySortType { time, like }
|
||||
|
||||
extension ReplySortTypeExtension on ReplySortType {
|
||||
extension ReplySortTypeExt on ReplySortType {
|
||||
String get title => const ['最新评论', '最热评论'][index];
|
||||
String get label => const ['最新', '最热'][index];
|
||||
}
|
||||
1
lib/models/common/settings_type.dart
Normal file
1
lib/models/common/settings_type.dart
Normal file
@@ -0,0 +1 @@
|
||||
enum SettingsType { normal, sw1tch, divider }
|
||||
@@ -1,17 +1,17 @@
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
import 'package:PiliPlus/common/widgets/pair.dart';
|
||||
import 'package:PiliPlus/models/common/sponsor_block/segment_type.dart';
|
||||
import 'package:PiliPlus/models/common/sponsor_block/skip_type.dart';
|
||||
|
||||
class SegmentModel {
|
||||
SegmentModel({
|
||||
// ignore: non_constant_identifier_names
|
||||
required this.UUID,
|
||||
required this.segmentType,
|
||||
required this.segment,
|
||||
required this.skipType,
|
||||
this.hasSkipped,
|
||||
});
|
||||
// ignore: non_constant_identifier_names
|
||||
String UUID;
|
||||
SegmentType segmentType;
|
||||
Pair<int, int> segment;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:PiliPlus/models/common/sponsor_block/action_type.dart';
|
||||
@@ -9,12 +11,9 @@ enum SegmentType {
|
||||
intro,
|
||||
outro,
|
||||
preview,
|
||||
// ignore: constant_identifier_names
|
||||
music_offtopic,
|
||||
// ignore: constant_identifier_names
|
||||
poi_highlight,
|
||||
filler,
|
||||
// ignore: constant_identifier_names
|
||||
exclusive_access
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
//https://github.com/yujincheng08/BiliRoaming/blob/master/app/src/main/res/values/strings_raw.xml
|
||||
//https://github.com/yujincheng08/BiliRoaming/blob/master/app/src/main/res/values/arrays.xml
|
||||
|
||||
enum CDNService {
|
||||
baseUrl,
|
||||
backupUrl,
|
||||
30
lib/models/common/video/audio_quality.dart
Normal file
30
lib/models/common/video/audio_quality.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
enum AudioQuality { k64, k132, k192, dolby, hiRes }
|
||||
|
||||
extension AudioQualityExt on AudioQuality {
|
||||
static const List<int> _codeList = [
|
||||
30216,
|
||||
30232,
|
||||
30280,
|
||||
30250,
|
||||
30251,
|
||||
];
|
||||
int get code => _codeList[index];
|
||||
|
||||
static AudioQuality? fromCode(int code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return AudioQuality.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String get description => const [
|
||||
'64K',
|
||||
'132K',
|
||||
'192K',
|
||||
'杜比全景声',
|
||||
'Hi-Res无损',
|
||||
][index];
|
||||
}
|
||||
@@ -8,7 +8,7 @@ enum LiveQuality {
|
||||
flunt,
|
||||
}
|
||||
|
||||
extension LiveQualityCode on LiveQuality {
|
||||
extension LiveQualityExt on LiveQuality {
|
||||
static const List<int> _codeList = [
|
||||
30000,
|
||||
20000,
|
||||
21
lib/models/common/video/subtitle_pref_type.dart
Normal file
21
lib/models/common/video/subtitle_pref_type.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
enum SubtitlePrefType { off, on, withoutAi, auto }
|
||||
|
||||
extension SubtitlePrefTypeExt on SubtitlePrefType {
|
||||
String get description => const [
|
||||
'默认不显示字幕',
|
||||
'优先选择非自动生成(ai)字幕',
|
||||
'跳过自动生成(ai)字幕,选择第一个可用字幕',
|
||||
'静音时等同第二项,非静音时等同第三项'
|
||||
][index];
|
||||
|
||||
static const List<String> _codeList = ['off', 'on', 'withoutAi', 'auto'];
|
||||
String get code => _codeList[index];
|
||||
|
||||
static SubtitlePrefType? fromCode(String code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return SubtitlePrefType.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
34
lib/models/common/video/video_decode_type.dart
Normal file
34
lib/models/common/video/video_decode_type.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
enum VideoDecodeFormatType {
|
||||
DVH1,
|
||||
AV1,
|
||||
HEVC,
|
||||
AVC,
|
||||
}
|
||||
|
||||
extension VideoDecodeFormatTypeExt on VideoDecodeFormatType {
|
||||
String get description => const ['DVH1', 'AV1', 'HEVC', 'AVC'][index];
|
||||
|
||||
static const List<String> _codeList = ['dvh1', 'av01', 'hev1', 'avc1'];
|
||||
String get code => _codeList[index];
|
||||
|
||||
static VideoDecodeFormatType? fromCode(String code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return VideoDecodeFormatType.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static VideoDecodeFormatType? fromString(String val) {
|
||||
var result = VideoDecodeFormatType.values.first;
|
||||
for (var i in _codeList) {
|
||||
if (val.startsWith(i)) {
|
||||
result = VideoDecodeFormatType.values[_codeList.indexOf(i)];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
55
lib/models/common/video/video_quality.dart
Normal file
55
lib/models/common/video/video_quality.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
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];
|
||||
}
|
||||
19
lib/models/common/webview_menu_type.dart
Normal file
19
lib/models/common/webview_menu_type.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
enum WebviewMenuItem {
|
||||
refresh,
|
||||
copy,
|
||||
openInBrowser,
|
||||
clearCache,
|
||||
resetCookie,
|
||||
goBack,
|
||||
}
|
||||
|
||||
extension WebviewMenuItemExt on WebviewMenuItem {
|
||||
String get title => const [
|
||||
'刷新',
|
||||
'复制链接',
|
||||
'浏览器中打开',
|
||||
'清除缓存',
|
||||
'重新设置Cookie',
|
||||
'返回',
|
||||
][index];
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
enum VideoQuality {
|
||||
speed240,
|
||||
fluent360,
|
||||
clear480,
|
||||
high720,
|
||||
high72060,
|
||||
high1080,
|
||||
high1080plus,
|
||||
high108060,
|
||||
super4K,
|
||||
hdr,
|
||||
dolbyVision,
|
||||
super8k
|
||||
}
|
||||
|
||||
extension VideoQualityCode 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;
|
||||
}
|
||||
}
|
||||
|
||||
extension VideoQualityDesc on VideoQuality {
|
||||
static const List<String> _descList = [
|
||||
'240P 极速',
|
||||
'360P 流畅',
|
||||
'480P 清晰',
|
||||
'720P 高清',
|
||||
'720P60 高帧率',
|
||||
'1080P 高清',
|
||||
'1080P+ 高码率',
|
||||
'1080P60 高帧率',
|
||||
'4K 超清',
|
||||
'HDR 真彩色',
|
||||
'杜比视界',
|
||||
'8K 超高清'
|
||||
];
|
||||
String get description => _descList[index];
|
||||
}
|
||||
|
||||
enum AudioQuality { k64, k132, k192, dolby, hiRes }
|
||||
|
||||
extension AudioQualityCode on AudioQuality {
|
||||
static const List<int> _codeList = [
|
||||
30216,
|
||||
30232,
|
||||
30280,
|
||||
30250,
|
||||
30251,
|
||||
];
|
||||
int get code => _codeList[index];
|
||||
|
||||
static AudioQuality? fromCode(int code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return AudioQuality.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
extension AudioQualityDesc on AudioQuality {
|
||||
static const List<String> _descList = [
|
||||
'64K',
|
||||
'132K',
|
||||
'192K',
|
||||
'杜比全景声',
|
||||
'Hi-Res无损',
|
||||
];
|
||||
String get description => _descList[index];
|
||||
}
|
||||
|
||||
enum VideoDecodeFormats {
|
||||
DVH1,
|
||||
AV1,
|
||||
HEVC,
|
||||
AVC,
|
||||
}
|
||||
|
||||
extension VideoDecodeFormatsDesc on VideoDecodeFormats {
|
||||
static const List<String> _descList = ['DVH1', 'AV1', 'HEVC', 'AVC'];
|
||||
String get description => _descList[index];
|
||||
}
|
||||
|
||||
extension VideoDecodeFormatsCode on VideoDecodeFormats {
|
||||
static const List<String> _codeList = ['dvh1', 'av01', 'hev1', 'avc1'];
|
||||
String get code => _codeList[index];
|
||||
|
||||
static VideoDecodeFormats? fromCode(String code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return VideoDecodeFormats.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static VideoDecodeFormats? fromString(String val) {
|
||||
var result = VideoDecodeFormats.values.first;
|
||||
for (var i in _codeList) {
|
||||
if (val.startsWith(i)) {
|
||||
result = VideoDecodeFormats.values[_codeList.indexOf(i)];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
enum SubtitlePreference { off, on, withoutAi, auto }
|
||||
|
||||
extension SubtitlePreferenceDesc on SubtitlePreference {
|
||||
static const List<String> _descList = [
|
||||
'默认不显示字幕',
|
||||
'优先选择非自动生成(ai)字幕',
|
||||
'跳过自动生成(ai)字幕,选择第一个可用字幕',
|
||||
'静音时等同第二项,非静音时等同第三项'
|
||||
];
|
||||
String get description => _descList[index];
|
||||
}
|
||||
|
||||
extension SubtitlePreferenceCode on SubtitlePreference {
|
||||
static const List<String> _codeList = ['off', 'on', 'withoutAi', 'auto'];
|
||||
String get code => _codeList[index];
|
||||
|
||||
static SubtitlePreference? fromCode(String code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return SubtitlePreference.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/models/video/play/quality.dart';
|
||||
import 'package:PiliPlus/models/common/video/audio_quality.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_quality.dart';
|
||||
|
||||
class PlayUrlModel {
|
||||
PlayUrlModel({
|
||||
|
||||
Reference in New Issue
Block a user