mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-09 11:37:51 +08:00
opt subtitle
Closes #1357 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -7,11 +7,22 @@ class SubtitleInfo {
|
||||
|
||||
SubtitleInfo({this.lan, this.lanDoc, this.subtitles});
|
||||
|
||||
factory SubtitleInfo.fromJson(Map<String, dynamic> json) => SubtitleInfo(
|
||||
lan: json['lan'] as String?,
|
||||
lanDoc: json['lan_doc'] as String?,
|
||||
subtitles: (json['subtitles'] as List<dynamic>?)
|
||||
?.map((e) => Subtitle.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
SubtitleInfo.fromJson(Map<String, dynamic> json) {
|
||||
lan = json['lan'] as String?;
|
||||
lanDoc = json['lan_doc'] as String?;
|
||||
final List? list = json['subtitles'];
|
||||
if (list != null && list.isNotEmpty) {
|
||||
subtitles = <Subtitle>[];
|
||||
int index = 0;
|
||||
for (var e in list) {
|
||||
final item = Subtitle.fromJson(e);
|
||||
if (item.lan!.contains('zh')) {
|
||||
subtitles!.insert(index, item);
|
||||
index++;
|
||||
} else {
|
||||
subtitles!.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user