159 lines
3.6 KiB
Dart
159 lines
3.6 KiB
Dart
class XtreamCategory {
|
|
final String id;
|
|
final String name;
|
|
|
|
XtreamCategory({required this.id, required this.name});
|
|
|
|
factory XtreamCategory.fromJson(Map<String, dynamic> json) {
|
|
return XtreamCategory(
|
|
id: json['category_id']?.toString() ?? '',
|
|
name: json['category_name'] ?? '',
|
|
);
|
|
}
|
|
}
|
|
|
|
class XtreamStream {
|
|
final int streamId;
|
|
final String name;
|
|
final String? streamIcon;
|
|
final String? plot;
|
|
final String? rating;
|
|
final String? containerExtension;
|
|
String? url;
|
|
|
|
XtreamStream({
|
|
required this.streamId,
|
|
required this.name,
|
|
this.streamIcon,
|
|
this.plot,
|
|
this.rating,
|
|
this.containerExtension,
|
|
this.url,
|
|
});
|
|
|
|
factory XtreamStream.fromJson(Map<String, dynamic> json) {
|
|
return XtreamStream(
|
|
streamId: json['stream_id'] ?? 0,
|
|
name: json['name'] ?? '',
|
|
streamIcon: json['stream_icon'],
|
|
plot: json['plot'],
|
|
rating: json['rating'],
|
|
containerExtension: json['container_extension'],
|
|
url: null,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'stream_id': streamId,
|
|
'name': name,
|
|
'stream_icon': streamIcon,
|
|
'plot': plot,
|
|
'rating': rating,
|
|
'container_extension': containerExtension,
|
|
'url': url,
|
|
};
|
|
}
|
|
}
|
|
|
|
class XtreamSeries {
|
|
final int seriesId;
|
|
final String name;
|
|
final String? cover;
|
|
final String? plot;
|
|
final String? rating;
|
|
final List<XtreamSeason> seasons;
|
|
|
|
XtreamSeries({
|
|
required this.seriesId,
|
|
required this.name,
|
|
this.cover,
|
|
this.plot,
|
|
this.rating,
|
|
this.seasons = const [],
|
|
});
|
|
|
|
factory XtreamSeries.fromJson(Map<String, dynamic> json) {
|
|
return XtreamSeries(
|
|
seriesId: json['series_id'] ?? 0,
|
|
name: json['name'] ?? '',
|
|
cover: json['cover'],
|
|
plot: json['plot'],
|
|
rating: json['rating'],
|
|
seasons: [],
|
|
);
|
|
}
|
|
}
|
|
|
|
class XtreamSeason {
|
|
final int seasonNumber;
|
|
final List<XtreamEpisode> episodes;
|
|
|
|
XtreamSeason({required this.seasonNumber, this.episodes = const []});
|
|
}
|
|
|
|
class XtreamEpisode {
|
|
final int episodeId;
|
|
final int seasonNumber;
|
|
final int episodeNumber;
|
|
final String title;
|
|
final String? info;
|
|
final String? containerExtension;
|
|
String? url;
|
|
|
|
XtreamEpisode({
|
|
required this.episodeId,
|
|
required this.seasonNumber,
|
|
required this.episodeNumber,
|
|
required this.title,
|
|
this.info,
|
|
this.containerExtension,
|
|
this.url,
|
|
});
|
|
|
|
factory XtreamEpisode.fromJson(Map<String, dynamic> json) {
|
|
return XtreamEpisode(
|
|
episodeId: json['id'] ?? 0,
|
|
seasonNumber: json['season'] ?? 0,
|
|
episodeNumber: json['episode_num'] ?? 0,
|
|
title: json['title'] ?? '',
|
|
info: json['info'],
|
|
containerExtension: json['container_extension'],
|
|
url: null,
|
|
);
|
|
}
|
|
}
|
|
|
|
class XtreamUserInfo {
|
|
final String username;
|
|
final String password;
|
|
final int maxConnections;
|
|
final int activeCons;
|
|
final bool isTrial;
|
|
final int? expDate;
|
|
final String status;
|
|
|
|
XtreamUserInfo({
|
|
required this.username,
|
|
required this.password,
|
|
required this.maxConnections,
|
|
required this.activeCons,
|
|
required this.isTrial,
|
|
this.expDate,
|
|
required this.status,
|
|
});
|
|
|
|
factory XtreamUserInfo.fromJson(Map<String, dynamic> json) {
|
|
final userInfo = json['user_info'] ?? json;
|
|
return XtreamUserInfo(
|
|
username: userInfo['username'] ?? '',
|
|
password: userInfo['password'] ?? '',
|
|
maxConnections: int.tryParse(userInfo['max_connections']?.toString() ?? '1') ?? 1,
|
|
activeCons: int.tryParse(userInfo['active_cons']?.toString() ?? '0') ?? 0,
|
|
isTrial: userInfo['is_trial'] == '1',
|
|
expDate: userInfo['exp_date'],
|
|
status: userInfo['status'] ?? '',
|
|
);
|
|
}
|
|
}
|