-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature-playerSubtitle'
- Loading branch information
Showing
11 changed files
with
460 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
enum SubtitleType { | ||
// 中文(中国) | ||
zhCN, | ||
// 中文(自动翻译) | ||
aizh, | ||
// 英语(自动生成) | ||
aien, | ||
} | ||
|
||
extension SubtitleTypeExtension on SubtitleType { | ||
String get description { | ||
switch (this) { | ||
case SubtitleType.zhCN: | ||
return '中文(中国)'; | ||
case SubtitleType.aizh: | ||
return '中文(自动翻译)'; | ||
case SubtitleType.aien: | ||
return '英语(自动生成)'; | ||
} | ||
} | ||
} | ||
|
||
extension SubtitleIdExtension on SubtitleType { | ||
String get id { | ||
switch (this) { | ||
case SubtitleType.zhCN: | ||
return 'zh-CN'; | ||
case SubtitleType.aizh: | ||
return 'ai-zh'; | ||
case SubtitleType.aien: | ||
return 'ai-en'; | ||
} | ||
} | ||
} | ||
|
||
extension SubtitleCodeExtension on SubtitleType { | ||
int get code { | ||
switch (this) { | ||
case SubtitleType.zhCN: | ||
return 1; | ||
case SubtitleType.aizh: | ||
return 2; | ||
case SubtitleType.aien: | ||
return 3; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class SubTitileContentModel { | ||
double? from; | ||
double? to; | ||
int? location; | ||
String? content; | ||
|
||
SubTitileContentModel({ | ||
this.from, | ||
this.to, | ||
this.location, | ||
this.content, | ||
}); | ||
|
||
SubTitileContentModel.fromJson(Map<String, dynamic> json) { | ||
from = json['from']; | ||
to = json['to']; | ||
location = json['location']; | ||
content = json['content']; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import 'package:get/get.dart'; | ||
import '../../common/subtitle_type.dart'; | ||
|
||
class SubTitlteModel { | ||
SubTitlteModel({ | ||
this.aid, | ||
this.bvid, | ||
this.cid, | ||
this.loginMid, | ||
this.loginMidHash, | ||
this.isOwner, | ||
this.name, | ||
this.subtitles, | ||
}); | ||
|
||
int? aid; | ||
String? bvid; | ||
int? cid; | ||
int? loginMid; | ||
String? loginMidHash; | ||
bool? isOwner; | ||
String? name; | ||
List<SubTitlteItemModel>? subtitles; | ||
|
||
factory SubTitlteModel.fromJson(Map<String, dynamic> json) => SubTitlteModel( | ||
aid: json["aid"], | ||
bvid: json["bvid"], | ||
cid: json["cid"], | ||
loginMid: json["login_mid"], | ||
loginMidHash: json["login_mid_hash"], | ||
isOwner: json["is_owner"], | ||
name: json["name"], | ||
subtitles: json["subtitle"] != null | ||
? json["subtitle"]["subtitles"] | ||
.map<SubTitlteItemModel>((x) => SubTitlteItemModel.fromJson(x)) | ||
.toList() | ||
: [], | ||
); | ||
} | ||
|
||
class SubTitlteItemModel { | ||
SubTitlteItemModel({ | ||
this.id, | ||
this.lan, | ||
this.lanDoc, | ||
this.isLock, | ||
this.subtitleUrl, | ||
this.type, | ||
this.aiType, | ||
this.aiStatus, | ||
this.title, | ||
this.code, | ||
this.content, | ||
this.body, | ||
}); | ||
|
||
int? id; | ||
String? lan; | ||
String? lanDoc; | ||
bool? isLock; | ||
String? subtitleUrl; | ||
int? type; | ||
int? aiType; | ||
int? aiStatus; | ||
String? title; | ||
int? code; | ||
String? content; | ||
List? body; | ||
|
||
factory SubTitlteItemModel.fromJson(Map<String, dynamic> json) => | ||
SubTitlteItemModel( | ||
id: json["id"], | ||
lan: json["lan"].replaceAll('-', ''), | ||
lanDoc: json["lan_doc"], | ||
isLock: json["is_lock"], | ||
subtitleUrl: json["subtitle_url"], | ||
type: json["type"], | ||
aiType: json["ai_type"], | ||
aiStatus: json["ai_status"], | ||
title: json["lan_doc"], | ||
code: SubtitleType.values | ||
.firstWhereOrNull( | ||
(element) => element.id.toString() == json["lan"]) | ||
?.index ?? | ||
-1, | ||
content: '', | ||
body: [], | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.