[DEV] automatic select saison when single
This commit is contained in:
parent
4f10e7cfcc
commit
56f6220587
@ -46,6 +46,11 @@ export class SeriesScene implements OnInit {
|
||||
//this.id_type = parseInt(this.route.snapshot.paramMap.get('type_id'));
|
||||
this.id_series = this.arianeService.getSeriesId();
|
||||
let self = this;
|
||||
let update_ended = {
|
||||
series_metadata: false,
|
||||
sub_saison: false,
|
||||
sub_video: false,
|
||||
}
|
||||
this.seriesService.get(this.id_series)
|
||||
.then(function(response) {
|
||||
self.name = response.name;
|
||||
@ -59,28 +64,39 @@ export class SeriesScene implements OnInit {
|
||||
self.covers.push(self.seriesService.getCoverUrl(response.covers[iii]));
|
||||
}
|
||||
}
|
||||
update_ended.series_metadata = true;
|
||||
self.checkIfJumpIsNeeded(update_ended);
|
||||
}).catch(function(response) {
|
||||
self.description = "";
|
||||
self.name = "???";
|
||||
self.cover = null;
|
||||
self.covers = [];
|
||||
// no check jusp ==> an error occured on season
|
||||
});
|
||||
console.log("get parameter id: " + this.id_series);
|
||||
this.seriesService.getSeason(this.id_series, ["id", "name"])
|
||||
.then(function(response) {
|
||||
self.seasons_error = "";
|
||||
self.seasons = response
|
||||
update_ended.sub_saison = true;
|
||||
self.checkIfJumpIsNeeded(update_ended);
|
||||
}).catch(function(response) {
|
||||
self.seasons_error = "Can not get the list of season in this series";
|
||||
self.seasons = []
|
||||
update_ended.sub_saison = true;
|
||||
self.checkIfJumpIsNeeded(update_ended);
|
||||
});
|
||||
this.seriesService.getVideo(this.id_series)
|
||||
.then(function(response) {
|
||||
self.videos_error = "";
|
||||
self.videos = response
|
||||
update_ended.sub_video = true;
|
||||
self.checkIfJumpIsNeeded(update_ended);
|
||||
}).catch(function(response) {
|
||||
self.videos_error = "Can not get the List of video without season";
|
||||
self.videos = []
|
||||
update_ended.sub_video = true;
|
||||
self.checkIfJumpIsNeeded(update_ended);
|
||||
});
|
||||
}
|
||||
onSelectSeason(_event: any, _idSelected: number):void {
|
||||
@ -90,5 +106,21 @@ export class SeriesScene implements OnInit {
|
||||
onSelectVideo(_event: any, _idSelected: number):void {
|
||||
this.arianeService.navigateVideo(_idSelected, _event.which==2, _event.ctrlKey);
|
||||
}
|
||||
|
||||
checkIfJumpIsNeeded(update_ended: { series_metadata: boolean; sub_saison: boolean; sub_video: boolean; }): void {
|
||||
// all update is ended
|
||||
if (update_ended.series_metadata == false || update_ended.sub_saison == false || update_ended.sub_video == false) {
|
||||
return;
|
||||
}
|
||||
// no local video
|
||||
if (this.videos.length > 0) {
|
||||
return;
|
||||
}
|
||||
// only one season:
|
||||
if (this.seasons.length !== 1) {
|
||||
return;
|
||||
}
|
||||
this.arianeService.navigateSeason(this.seasons[0].id, false, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user