movie and tvshow list
This commit is contained in:
+30
-10
@@ -41,6 +41,26 @@ class Movie {
|
||||
});
|
||||
|
||||
factory Movie.fromJson(Map<String, dynamic> json) {
|
||||
if (json.containsKey('backdropPath')) {
|
||||
return Movie(
|
||||
movieID: int.parse(json['movieID']),
|
||||
movieTitle: json['movieTitle'] as String,
|
||||
overview: json['overview'] as String,
|
||||
releaseDate: DateTime.parse(json['releaseDate']),
|
||||
state: int.parse(json['state']),
|
||||
resolution: json['resolution'] as String,
|
||||
backdropPath: json['backdropPath'] as String,
|
||||
languages: json['languages'],
|
||||
productionCountries: json['productionCountries'],
|
||||
productionCompanies: json['productionCompanies'],
|
||||
voteAverage: double.parse(json['voteAverage']),
|
||||
voteCount: int.parse(json['voteCount']),
|
||||
cast: json['cast'],
|
||||
crew: json['crew'],
|
||||
genre: json['genre'],
|
||||
localPath: json['localpath'],
|
||||
);
|
||||
}
|
||||
return Movie(
|
||||
movieID: int.parse(json['movieID']),
|
||||
movieTitle: json['movieTitle'] as String,
|
||||
@@ -48,16 +68,16 @@ class Movie {
|
||||
releaseDate: DateTime.parse(json['releaseDate']),
|
||||
state: int.parse(json['state']),
|
||||
resolution: json['resolution'] as String,
|
||||
backdropPath: json['backdropPath'] as String,
|
||||
languages: json['languages'],
|
||||
productionCountries: json['productionCountries'],
|
||||
productionCompanies: json['productionCompanies'],
|
||||
voteAverage: double.parse(json['voteAverage']),
|
||||
voteCount: int.parse(json['voteCount']),
|
||||
cast: json['cast'],
|
||||
crew: json['crew'],
|
||||
genre: json['genre'],
|
||||
localPath: json['localpath'],
|
||||
backdropPath: '',
|
||||
languages: '',
|
||||
productionCountries: '',
|
||||
productionCompanies: '',
|
||||
voteAverage: 0,
|
||||
voteCount: 0,
|
||||
cast: '',
|
||||
crew: '',
|
||||
genre: '',
|
||||
localPath: '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+41
-14
@@ -113,29 +113,56 @@ class TVShow {
|
||||
seriesState = 3;
|
||||
}
|
||||
|
||||
if (json.containsKey('overview')) {
|
||||
return TVShow(
|
||||
seriesID: int.parse(json['seriesID']),
|
||||
seriesName: json['seriesName'],
|
||||
firstAired: DateTime.parse(json['firstAired']),
|
||||
seriesState: seriesState,
|
||||
resolution: json['resolution'],
|
||||
status: json['status'],
|
||||
cliffhanger: int.parse(json['cliffhanger']),
|
||||
download: json['download'],
|
||||
overview: json['overview'],
|
||||
backdropPath: json['backdropPath'],
|
||||
seasonStatus: json['seasons']
|
||||
.map<Season>((json) => Season.fromJson(json))
|
||||
.toList(),
|
||||
languages: json['languages'],
|
||||
networks: json['networks'],
|
||||
originCountries: json['originCountries'],
|
||||
productionCompanies: json['productionCompanies'],
|
||||
voteAverage: double.parse(json['voteAverage']),
|
||||
voteCount: int.parse(json['voteCount']),
|
||||
cast: json['cast'],
|
||||
crew: json['crew'],
|
||||
genre: json['genre'],
|
||||
localPath: json['localPath'],
|
||||
);
|
||||
}
|
||||
|
||||
return TVShow(
|
||||
seriesID: int.parse(json['seriesID']),
|
||||
seriesName: json['seriesName'],
|
||||
overview: json['overview'],
|
||||
backdropPath: json['backdropPath'],
|
||||
firstAired: DateTime.parse(json['firstAired']),
|
||||
seriesState: seriesState,
|
||||
resolution: json['resolution'],
|
||||
status: json['status'],
|
||||
cliffhanger: int.parse(json['cliffhanger']),
|
||||
seasonStatus:
|
||||
json['seasons'].map<Season>((json) => Season.fromJson(json)).toList(),
|
||||
languages: json['languages'],
|
||||
networks: json['networks'],
|
||||
originCountries: json['originCountries'],
|
||||
productionCompanies: json['productionCompanies'],
|
||||
voteAverage: double.parse(json['voteAverage']),
|
||||
voteCount: int.parse(json['voteCount']),
|
||||
cast: json['cast'],
|
||||
crew: json['crew'],
|
||||
genre: json['genre'],
|
||||
download: json['download'],
|
||||
localPath: json['localPath'],
|
||||
overview: '',
|
||||
backdropPath: '',
|
||||
seasonStatus: [],
|
||||
languages: '',
|
||||
networks: '',
|
||||
originCountries: '',
|
||||
productionCompanies: '',
|
||||
voteAverage: 0,
|
||||
voteCount: 0,
|
||||
cast: '',
|
||||
crew: '',
|
||||
genre: '',
|
||||
localPath: '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user