mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: pgc timeline
Closes #653 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
91
lib/models/bangumi/pgc_timeline/episode.dart
Normal file
91
lib/models/bangumi/pgc_timeline/episode.dart
Normal file
@@ -0,0 +1,91 @@
|
||||
import 'icon_font.dart';
|
||||
|
||||
class Episode {
|
||||
String? cover;
|
||||
int? delay;
|
||||
int? delayId;
|
||||
String? delayIndex;
|
||||
String? delayReason;
|
||||
bool? enableVt;
|
||||
String? epCover;
|
||||
int? episodeId;
|
||||
int? follow;
|
||||
String? follows;
|
||||
IconFont? iconFont;
|
||||
String? plays;
|
||||
String? pubIndex;
|
||||
String? pubTime;
|
||||
int? pubTs;
|
||||
int? published;
|
||||
int? seasonId;
|
||||
String? squareCover;
|
||||
String? title;
|
||||
|
||||
Episode({
|
||||
this.cover,
|
||||
this.delay,
|
||||
this.delayId,
|
||||
this.delayIndex,
|
||||
this.delayReason,
|
||||
this.enableVt,
|
||||
this.epCover,
|
||||
this.episodeId,
|
||||
this.follow,
|
||||
this.follows,
|
||||
this.iconFont,
|
||||
this.plays,
|
||||
this.pubIndex,
|
||||
this.pubTime,
|
||||
this.pubTs,
|
||||
this.published,
|
||||
this.seasonId,
|
||||
this.squareCover,
|
||||
this.title,
|
||||
});
|
||||
|
||||
factory Episode.fromJson(Map<String, dynamic> json) => Episode(
|
||||
cover: json['cover'] as String?,
|
||||
delay: json['delay'] as int?,
|
||||
delayId: json['delay_id'] as int?,
|
||||
delayIndex: json['delay_index'] as String?,
|
||||
delayReason: json['delay_reason'] as String?,
|
||||
enableVt: json['enable_vt'] as bool?,
|
||||
epCover: json['ep_cover'] as String?,
|
||||
episodeId: json['episode_id'] as int?,
|
||||
follow: json['follow'] as int?,
|
||||
follows: json['follows'] as String?,
|
||||
iconFont: json['icon_font'] == null
|
||||
? null
|
||||
: IconFont.fromJson(json['icon_font'] as Map<String, dynamic>),
|
||||
plays: json['plays'] as String?,
|
||||
pubIndex: json['pub_index'] as String?,
|
||||
pubTime: json['pub_time'] as String?,
|
||||
pubTs: json['pub_ts'] as int?,
|
||||
published: json['published'] as int?,
|
||||
seasonId: json['season_id'] as int?,
|
||||
squareCover: json['square_cover'] as String?,
|
||||
title: json['title'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'cover': cover,
|
||||
'delay': delay,
|
||||
'delay_id': delayId,
|
||||
'delay_index': delayIndex,
|
||||
'delay_reason': delayReason,
|
||||
'enable_vt': enableVt,
|
||||
'ep_cover': epCover,
|
||||
'episode_id': episodeId,
|
||||
'follow': follow,
|
||||
'follows': follows,
|
||||
'icon_font': iconFont?.toJson(),
|
||||
'plays': plays,
|
||||
'pub_index': pubIndex,
|
||||
'pub_time': pubTime,
|
||||
'pub_ts': pubTs,
|
||||
'published': published,
|
||||
'season_id': seasonId,
|
||||
'square_cover': squareCover,
|
||||
'title': title,
|
||||
};
|
||||
}
|
||||
16
lib/models/bangumi/pgc_timeline/icon_font.dart
Normal file
16
lib/models/bangumi/pgc_timeline/icon_font.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
class IconFont {
|
||||
String? name;
|
||||
String? text;
|
||||
|
||||
IconFont({this.name, this.text});
|
||||
|
||||
factory IconFont.fromJson(Map<String, dynamic> json) => IconFont(
|
||||
name: json['name'] as String?,
|
||||
text: json['text'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'name': name,
|
||||
'text': text,
|
||||
};
|
||||
}
|
||||
23
lib/models/bangumi/pgc_timeline/pgc_timeline.dart
Normal file
23
lib/models/bangumi/pgc_timeline/pgc_timeline.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'result.dart';
|
||||
|
||||
class PgcTimeline {
|
||||
int? code;
|
||||
String? message;
|
||||
List<Result>? result;
|
||||
|
||||
PgcTimeline({this.code, this.message, this.result});
|
||||
|
||||
factory PgcTimeline.fromJson(Map<String, dynamic> json) => PgcTimeline(
|
||||
code: json['code'] as int?,
|
||||
message: json['message'] as String?,
|
||||
result: (json['result'] as List<dynamic>?)
|
||||
?.map((e) => Result.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'code': code,
|
||||
'message': message,
|
||||
'result': result?.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
35
lib/models/bangumi/pgc_timeline/result.dart
Normal file
35
lib/models/bangumi/pgc_timeline/result.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'episode.dart';
|
||||
|
||||
class Result {
|
||||
String? date;
|
||||
int? dateTs;
|
||||
int? dayOfWeek;
|
||||
List<Episode>? episodes;
|
||||
int? isToday;
|
||||
|
||||
Result({
|
||||
this.date,
|
||||
this.dateTs,
|
||||
this.dayOfWeek,
|
||||
this.episodes,
|
||||
this.isToday,
|
||||
});
|
||||
|
||||
factory Result.fromJson(Map<String, dynamic> json) => Result(
|
||||
date: json['date'] as String?,
|
||||
dateTs: json['date_ts'] as int?,
|
||||
dayOfWeek: json['day_of_week'] as int?,
|
||||
episodes: (json['episodes'] as List<dynamic>?)
|
||||
?.map((e) => Episode.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
isToday: json['is_today'] as int?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'date': date,
|
||||
'date_ts': dateTs,
|
||||
'day_of_week': dayOfWeek,
|
||||
'episodes': episodes?.map((e) => e.toJson()).toList(),
|
||||
'is_today': isToday,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user