-
Saison: {{saison_name}}
+
+ Season: {{season_name}}
Episode: {{episode}}
diff --git a/front/src/app/scene/video/video.ts b/front/src/app/scene/video/video.ts
index cd59541..b20423e 100644
--- a/front/src/app/scene/video/video.ts
+++ b/front/src/app/scene/video/video.ts
@@ -10,8 +10,8 @@ import { Location } from '@angular/common';
import { fadeInAnimation } from '../../_animations/index';
import { HttpWrapperService } from '../../service/http-wrapper';
import { VideoService } from '../../service/video';
-import { GroupService } from '../../service/group';
-import { SaisonService } from '../../service/saison';
+import { SeriesService } from '../../service/series';
+import { SeasonService } from '../../service/season';
import { ArianeService } from '../../service/ariane';
@Component({
@@ -22,7 +22,7 @@ import { ArianeService } from '../../service/ariane';
host: { '[@fadeInAnimation]': '' }
})
-export class VideoComponent implements OnInit {
+export class VideoScene implements OnInit {
id_video:number = -1;
error:string = ""
@@ -30,10 +30,10 @@ export class VideoComponent implements OnInit {
name:string = ""
description:string = ""
episode:number = undefined
- group_id:number = undefined
- group_name:string = undefined
- saison_id:number = undefined
- saison_name:string = undefined
+ series_id:number = undefined
+ series_name:string = undefined
+ season_id:number = undefined
+ season_name:string = undefined
data_id:number = -1
time:number = undefined
type_id:number = undefined
@@ -46,8 +46,8 @@ export class VideoComponent implements OnInit {
private router: Router,
private locate: Location,
private videoService: VideoService,
- private groupService: GroupService,
- private saisonService: SaisonService,
+ private seriesService: SeriesService,
+ private seasonService: SeasonService,
private httpService: HttpWrapperService,
private arianeService: ArianeService) {
@@ -55,14 +55,14 @@ export class VideoComponent implements OnInit {
generateName() {
this.generated_name = "";
- if (this.group_name != undefined) {
- this.generated_name += this.group_name + "-";
+ if (this.series_name != undefined) {
+ this.generated_name += this.series_name + "-";
}
- if (this.saison_name != undefined) {
- if (this.saison_name.length < 2) {
- this.generated_name += "s0" + this.saison_name + "-";
+ if (this.season_name != undefined) {
+ if (this.season_name.length < 2) {
+ this.generated_name += "s0" + this.season_name + "-";
} else {
- this.generated_name += "s" + this.saison_name + "-";
+ this.generated_name += "s" + this.season_name + "-";
}
}
if (this.episode != undefined) {
@@ -87,8 +87,8 @@ export class VideoComponent implements OnInit {
self.name = response.name;
self.description = response.description;
self.episode = response.episode;
- self.group_id = response.serie_id;
- self.saison_id = response.saison_id;
+ self.series_id = response.series_id;
+ self.season_id = response.season_id;
self.data_id = response.data_id;
self.time = response.time;
self.generated_name = response.generated_name;
@@ -106,19 +106,19 @@ export class VideoComponent implements OnInit {
}
}
self.generateName();
- if (self.group_id !== undefined && self.group_id !== null) {
- self.groupService.get(self.group_id)
+ if (self.series_id !== undefined && self.series_id !== null) {
+ self.seriesService.get(self.series_id)
.then(function(response) {
- self.group_name = response.name;
+ self.series_name = response.name;
self.generateName();
}).catch(function(response) {
// nothing to do ...
});
}
- if (self.saison_id !== undefined && self.saison_id !== null) {
- self.saisonService.get(self.saison_id)
+ if (self.season_id !== undefined && self.season_id !== null) {
+ self.seasonService.get(self.season_id)
.then(function(response) {
- self.saison_name = response.name;
+ self.season_name = response.name;
self.generateName();
}).catch(function(response) {
// nothing to do ...
@@ -131,15 +131,15 @@ export class VideoComponent implements OnInit {
self.name = "";
self.description = "";
self.episode = undefined;
- self.group_id = undefined;
- self.saison_id = undefined;
+ self.series_id = undefined;
+ self.season_id = undefined;
self.data_id = -1;
self.time = undefined;
self.generated_name = "";
self.video_source = "";
self.cover = null;
- self.group_name = undefined;
- self.saison_name = undefined;
+ self.series_name = undefined;
+ self.season_name = undefined;
});
}
diff --git a/front/src/app/service/ariane.ts b/front/src/app/service/ariane.ts
index 0162ac9..4fee966 100644
--- a/front/src/app/service/ariane.ts
+++ b/front/src/app/service/ariane.ts
@@ -8,18 +8,18 @@ import { Injectable, Output, EventEmitter, OnInit} from '@angular/core'
import { Router, ActivatedRoute, ParamMap, NavigationEnd } from '@angular/router';
-import { TypeService } from 'app/service/type';
-import { UniversService } from 'app/service/univers';
-import { GroupService } from 'app/service/group';
-import { SaisonService } from 'app/service/saison';
-import { VideoService } from 'app/service/video';
-import { environment } from 'environments/environment';
+import { TypeService } from './type';
+import { UniverseService } from './universe';
+import { SeriesService } from './series';
+import { SeasonService } from './season';
+import { VideoService } from './video';
+import { environment } from '../../environments/environment';
export class InputOrders {
public type_id: number = null;
- public univers_id: number = null;
- public group_id: number = null;
- public saison_id: number = null;
+ public universe_id: number = null;
+ public series_id: number = null;
+ public season_id: number = null;
public video_id: number = null;
}
@@ -31,17 +31,17 @@ export class ArianeService {
public type_name: string = null;
@Output() type_change: EventEmitter = new EventEmitter();
- public univers_id: number = null;
- public univers_name: string = null;
- @Output() univers_change: EventEmitter = new EventEmitter();
+ public universe_id: number = null;
+ public universe_name: string = null;
+ @Output() universe_change: EventEmitter = new EventEmitter();
- public group_id: number = null;
- public group_name: string = null;
- @Output() group_change: EventEmitter = new EventEmitter();
+ public series_id: number = null;
+ public series_name: string = null;
+ @Output() series_change: EventEmitter = new EventEmitter();
- public saison_id: number = null;
- public saison_name: string = null;
- @Output() saison_change: EventEmitter = new EventEmitter();
+ public season_id: number = null;
+ public season_name: string = null;
+ @Output() season_change: EventEmitter = new EventEmitter();
public video_id: number = null;
public video_name: string = null;
@@ -50,9 +50,9 @@ export class ArianeService {
constructor(private route: ActivatedRoute,
private router: Router,
private typeService: TypeService,
- private universService: UniversService,
- private groupService: GroupService,
- private saisonService: SaisonService,
+ private universeService: UniverseService,
+ private seriesService: SeriesService,
+ private seasonService: SeasonService,
private videoService: VideoService) {
console.log("Start ArianeService");
}
@@ -75,29 +75,29 @@ export class ArianeService {
}
console.log("type_id = " + type_id + " " + params.get('type_id'));
- let univers_id = params.get('univers_id');
- if (univers_id === null || univers_id === undefined || univers_id == "null" || univers_id == "NULL" || univers_id == "") {
- univers_id = null;
+ let universe_id = params.get('universe_id');
+ if (universe_id === null || universe_id === undefined || universe_id == "null" || universe_id == "NULL" || universe_id == "") {
+ universe_id = null;
} else {
- univers_id = parseInt(univers_id)
+ universe_id = parseInt(universe_id)
}
- console.log("univers_id = " + univers_id + " " + params.get('univers_id'));
+ console.log("universe_id = " + universe_id + " " + params.get('univers_id'));
- let group_id = params.get('group_id');
- if (group_id === null || group_id === undefined || group_id == "null" || group_id == "NULL" || group_id == "") {
- group_id = null;
+ let series_id = params.get('series_id');
+ if (series_id === null || series_id === undefined || series_id == "null" || series_id == "NULL" || series_id == "") {
+ series_id = null;
} else {
- group_id = parseInt(group_id)
+ series_id = parseInt(series_id)
}
- console.log("group_id = " + group_id + " " + params.get('group_id'));
+ console.log("series_id = " + series_id + " " + params.get('series_id'));
- let saison_id = params.get('saison_id');
- if (saison_id === null || saison_id === undefined || saison_id == "null" || saison_id == "NULL" || saison_id == "") {
- saison_id = null;
+ let season_id = params.get('season_id');
+ if (season_id === null || season_id === undefined || season_id == "null" || season_id == "NULL" || season_id == "") {
+ season_id = null;
} else {
- saison_id = parseInt(saison_id)
+ season_id = parseInt(season_id)
}
- console.log("saison_id = " + saison_id + " " + params.get('saison_id'));
+ console.log("season_id = " + season_id + " " + params.get('season_id'));
let video_id = params.get('video_id');
if (video_id === null || video_id === undefined || video_id == "null" || video_id == "NULL" || video_id == "") {
@@ -108,24 +108,24 @@ export class ArianeService {
console.log("video_id = " + video_id + " " + params.get('video_id'));
this.setType(type_id);
- this.setUnivers(univers_id);
- this.setGroup(group_id);
- this.setSaison(saison_id);
+ this.setUniverse(universe_id);
+ this.setSeries(series_id);
+ this.setSeason(season_id);
this.setVideo(video_id);
}
reset():void {
this.type_id = null;
this.type_name = null;
this.type_change.emit(this.type_id);
- this.univers_id = null;
- this.univers_name = null;
- this.univers_change.emit(this.univers_id);
- this.group_id = null;
- this.group_name = null;
- this.group_change.emit(this.group_id);
- this.saison_id = null;
- this.saison_name = null;
- this.saison_change.emit(this.saison_id);
+ this.universe_id = null;
+ this.universe_name = null;
+ this.universe_change.emit(this.universe_id);
+ this.series_id = null;
+ this.series_name = null;
+ this.series_change.emit(this.series_id);
+ this.season_id = null;
+ this.season_name = null;
+ this.season_change.emit(this.season_id);
this.video_id = null;
this.video_name = null;
this.video_change.emit(this.video_id);
@@ -137,17 +137,17 @@ export class ArianeService {
if (out.type_id == 0){
out.type_id = undefined;
}
- out.univers_id = parseInt(this.route.snapshot.paramMap.get('univers_id'));
- if (out.univers_id == 0){
- out.univers_id = undefined;
+ out.universe_id = parseInt(this.route.snapshot.paramMap.get('univers_id'));
+ if (out.universe_id == 0){
+ out.universe_id = undefined;
}
- out.group_id = parseInt(this.route.snapshot.paramMap.get('group_id'));
- if (out.group_id == 0){
- out.group_id = undefined;
+ out.series_id = parseInt(this.route.snapshot.paramMap.get('series_id'));
+ if (out.series_id == 0){
+ out.series_id = undefined;
}
- out.saison_id = parseInt(this.route.snapshot.paramMap.get('saison_id'));
- if (out.saison_id == 0){
- out.saison_id = undefined;
+ out.season_id = parseInt(this.route.snapshot.paramMap.get('season_id'));
+ if (out.season_id == 0){
+ out.season_id = undefined;
}
out.video_id = parseInt(this.route.snapshot.paramMap.get('video_id'));
if (out.video_id == 0){
@@ -159,7 +159,7 @@ export class ArianeService {
routeTo(_data:InputOrders, _destination:string = null) {
routeTo = ""
//if (
- this.router.navigate(['/type/' + this.type_id + '/group/' + this.id_group + '/saison/' + _idSelected ]);
+ this.router.navigate(['/type/' + this.type_id + '/series/' + this.id_series + '/season/' + _idSelected ]);
}
*/
@@ -192,92 +192,92 @@ export class ArianeService {
return this.type_name;
}
- setUnivers(_id:number) {
- if (this.univers_id == _id) {
+ setUniverse(_id:number) {
+ if (this.universe_id == _id) {
return;
}
if (_id === undefined) {
return;
}
- this.univers_id = _id;
- this.univers_name = "??--??";
- if (this.univers_id === null) {
- this.univers_change.emit(this.univers_id);
+ this.universe_id = _id;
+ this.universe_name = "??--??";
+ if (this.universe_id === null) {
+ this.universe_change.emit(this.universe_id);
return;
}
let self = this;
- this.universService.get(_id)
+ this.universeService.get(_id)
.then(function(response) {
- self.univers_name = response.number
- self.univers_change.emit(self.univers_id);
+ self.universe_name = response.number
+ self.universe_change.emit(self.universe_id);
}).catch(function(response) {
- self.univers_change.emit(self.univers_id);
+ self.universe_change.emit(self.universe_id);
});
}
- getUniversId():number {
- return this.univers_id;
+ getUniverseId():number {
+ return this.universe_id;
}
- getUniversName():string {
- return this.univers_name;
+ getUniverseName():string {
+ return this.universe_name;
}
- setGroup(_id:number):void {
- if (this.group_id == _id) {
+ setSeries(_id:number):void {
+ if (this.series_id == _id) {
return;
}
if (_id === undefined) {
return;
}
- this.group_id = _id;
- this.group_name = "??--??";
- if (this.group_id === null) {
- this.group_change.emit(this.group_id);
+ this.series_id = _id;
+ this.series_name = "??--??";
+ if (this.series_id === null) {
+ this.series_change.emit(this.series_id);
return;
}
let self = this;
- this.groupService.get(_id)
+ this.seriesService.get(_id)
.then(function(response) {
- self.group_name = response.name
- self.group_change.emit(self.group_id);
+ self.series_name = response.name
+ self.series_change.emit(self.series_id);
}).catch(function(response) {
- self.group_change.emit(self.group_id);
+ self.series_change.emit(self.series_id);
});
}
- getGroupId():number {
- return this.group_id;
+ getSeriesId():number {
+ return this.series_id;
}
- getGroupName():string {
- return this.group_name;
+ getSeriesName():string {
+ return this.series_name;
}
- setSaison(_id:number):void {
- if (this.saison_id == _id) {
+ setSeason(_id:number):void {
+ if (this.season_id == _id) {
return;
}
if (_id === undefined) {
return;
}
- this.saison_id = _id;
- this.saison_name = "??--??";
- if (this.saison_id === null) {
- this.saison_change.emit(this.saison_id);
+ this.season_id = _id;
+ this.season_name = "??--??";
+ if (this.season_id === null) {
+ this.season_change.emit(this.season_id);
return;
}
let self = this;
- this.saisonService.get(_id)
+ this.seasonService.get(_id)
.then(function(response) {
- //self.setGroup(response.group_id);
- self.saison_name = response.name
- self.saison_change.emit(self.saison_id);
+ //self.setSeries(response.series_id);
+ self.season_name = response.name
+ self.season_change.emit(self.season_id);
}).catch(function(response) {
- self.saison_change.emit(self.saison_id);
+ self.season_change.emit(self.season_id);
});
}
- getSaisonId():number {
- return this.saison_id;
+ getSeasonId():number {
+ return this.season_id;
}
- getSaisonName():string {
- return this.saison_name;
+ getSeasonName():string {
+ return this.season_name;
}
setVideo(_id:number):void {
@@ -296,8 +296,8 @@ export class ArianeService {
let self = this;
this.videoService.get(_id)
.then(function(response) {
- //self.setSaison(response.saison_id);
- //self.setGroup(response.group_id);
+ //self.setSeason(response.season_id);
+ //self.setSeries(response.series_id);
self.video_name = response.name;
self.video_change.emit(self.video_id);
}).catch(function(response) {
@@ -311,8 +311,8 @@ export class ArianeService {
return this.video_name;
}
- genericNavigate(_destination:string, _universId:number, _typeId:number, _groupId:number, _saisonId:number, _videoId:number, _newWindows:boolean):void {
- let addressOffset = _destination + '/' + _universId + '/' + _typeId + '/' + _groupId + '/' + _saisonId + '/' + _videoId;
+ genericNavigate(_destination:string, _universeId:number, _typeId:number, _seriesId:number, _seasonId:number, _videoId:number, _newWindows:boolean):void {
+ let addressOffset = _destination + '/' + _universeId + '/' + _typeId + '/' + _seriesId + '/' + _seasonId + '/' + _videoId;
if(_newWindows==true) {
if (environment.frontBaseUrl === undefined || environment.frontBaseUrl === null || environment.frontBaseUrl === "") {
window.open('/' + addressOffset);
@@ -324,35 +324,35 @@ export class ArianeService {
}
}
- navigateUnivers(_id:number, _newWindows:boolean):void {
- this.genericNavigate('univers', _id, this.type_id, null, null, null, _newWindows);
+ navigateUniverse(_id:number, _newWindows:boolean):void {
+ this.genericNavigate('universe', _id, this.type_id, null, null, null, _newWindows);
}
- navigateUniversEdit(_id:number, _newWindows:boolean):void {
- this.genericNavigate('univers-edit', _id, this.type_id, null, null, null, _newWindows);
+ navigateUniverseEdit(_id:number, _newWindows:boolean):void {
+ this.genericNavigate('universe-edit', _id, this.type_id, null, null, null, _newWindows);
}
navigateType(_id:number, _newWindows:boolean):void {
- this.genericNavigate('type', this.univers_id, _id, null, null, null, _newWindows);
+ this.genericNavigate('type', this.universe_id, _id, null, null, null, _newWindows);
}
navigateTypeEdit(_id:number, _newWindows:boolean):void {
- this.genericNavigate('type-edit', this.univers_id, _id, null, null, null, _newWindows);
+ this.genericNavigate('type-edit', this.universe_id, _id, null, null, null, _newWindows);
}
- navigateGroup(_id:number, _newWindows:boolean):void {
- this.genericNavigate('group', this.univers_id, this.type_id, _id, null, null, _newWindows);
+ navigateSeries(_id:number, _newWindows:boolean):void {
+ this.genericNavigate('series', this.universe_id, this.type_id, _id, null, null, _newWindows);
}
- navigateGroupEdit(_id:number, _newWindows:boolean):void {
- this.genericNavigate('group-edit', this.univers_id, this.type_id, _id, null, null, _newWindows);
+ navigateSeriesEdit(_id:number, _newWindows:boolean):void {
+ this.genericNavigate('series-edit', this.universe_id, this.type_id, _id, null, null, _newWindows);
}
- navigateSaison(_id:number, _newWindows:boolean):void {
- this.genericNavigate('saison', this.univers_id, this.type_id, this.group_id, _id, null, _newWindows);
+ navigateSeason(_id:number, _newWindows:boolean):void {
+ this.genericNavigate('season', this.universe_id, this.type_id, this.series_id, _id, null, _newWindows);
}
- navigateSaisonEdit(_id:number, _newWindows:boolean):void {
- this.genericNavigate('saison-edit', this.univers_id, this.type_id, this.group_id, _id, null, _newWindows);
+ navigateSeasonEdit(_id:number, _newWindows:boolean):void {
+ this.genericNavigate('season-edit', this.universe_id, this.type_id, this.series_id, _id, null, _newWindows);
}
navigateVideo(_id:number, _newWindows:boolean):void {
- this.genericNavigate('video', this.univers_id, this.type_id, this.group_id, this.saison_id, _id, _newWindows);
+ this.genericNavigate('video', this.universe_id, this.type_id, this.series_id, this.season_id, _id, _newWindows);
}
navigateVideoEdit(_id:number, _newWindows:boolean):void {
- this.genericNavigate('video-edit', this.univers_id, this.type_id, this.group_id, this.saison_id, _id, _newWindows);
+ this.genericNavigate('video-edit', this.universe_id, this.type_id, this.series_id, this.season_id, _id, _newWindows);
}
diff --git a/front/src/app/service/bdd.ts b/front/src/app/service/bdd.ts
index c9593f5..4780aeb 100644
--- a/front/src/app/service/bdd.ts
+++ b/front/src/app/service/bdd.ts
@@ -1,23 +1,22 @@
import { Injectable } from '@angular/core';
-import { HttpWrapperService } from 'app/service/http-wrapper';
-import { DataInterface } from 'app/service/dataInterface';
+import { HttpWrapperService } from './http-wrapper';
+import { DataInterface } from './dataInterface';
-import { environment } from 'environments/environment';
@Injectable()
export class BddService {
private bdd = {
"type": null,
- "group": null,
- "saison": null,
- "univers": null,
+ "series": null,
+ "season": null,
+ "universe": null,
"video": null
};
private bddPomise = {
"type": null,
- "group": null,
- "saison": null,
- "univers": null,
+ "series": null,
+ "season": null,
+ "universe": null,
"video": null
};
@@ -30,9 +29,10 @@ export class BddService {
let self = this;
return new Promise((resolve, reject) => {
self.get(_name)
- .then(function(response) {
+ .then(function(response:DataInterface) {
+ let responseTmp = response;
ret.then(function(response2) {
- response.set(_id, response2);
+ responseTmp.set(_id, response2);
resolve(response2);
}).catch(function(response2) {
reject(response2);
@@ -42,14 +42,24 @@ export class BddService {
});
});
}
+ asyncSetInDB(_name: string, _id: number, data: any) {
+ let self = this;
+ self.get(_name)
+ .then(function(response:DataInterface) {
+ response.set(_id, data);
+ }).catch(function(response) {
+ // nothing to do ...
+ });
+ }
delete(_name: string, _id: number, ret: any) {
let self = this;
return new Promise((resolve, reject) => {
self.get(_name)
- .then(function(response) {
+ .then(function(response:DataInterface) {
+ let responseTmp = response;
ret.then(function(response2) {
- response.delete(_id);
+ responseTmp.delete(_id);
resolve(response2);
}).catch(function(response2) {
reject(response2);
@@ -62,8 +72,9 @@ export class BddService {
get(_name: string): any {
let self = this;
+ console.log("Try to get DB '" + _name + "'");
if (this.bdd[_name] === undefined) {
- console.log("Try to get a non existant BDD ... '" + _name + "'");
+ console.log("Try to get a non existant DB ... '" + _name + "'");
return;
}
if (this.bdd[_name] !== null) {
@@ -101,24 +112,24 @@ export class BddService {
});
}
- getType():any {
+ getType():DataInterface {
return this.get("type");
- };
+ }
- getGroup():any {
- return this.get("group");
- };
+ getSeries():DataInterface {
+ return this.get("series");
+ }
- getSaison():any {
- return this.get("saison");
- };
+ getSeason():DataInterface {
+ return this.get("season");
+ }
- getUnivers():any {
- return this.get("univers");
- };
+ getUniverse():DataInterface {
+ return this.get("universe");
+ }
- getVideo():any {
+ getVideo():DataInterface {
return this.get("video");
- };
+ }
}
diff --git a/front/src/app/service/data.ts b/front/src/app/service/data.ts
index 315210a..a9640c4 100644
--- a/front/src/app/service/data.ts
+++ b/front/src/app/service/data.ts
@@ -1,8 +1,7 @@
import { Injectable } from '@angular/core';
-import { HttpWrapperService } from 'app/service/http-wrapper';
-import { DataInterface } from 'app/service/dataInterface';
+import { HttpWrapperService } from './http-wrapper';
+import { DataInterface } from './dataInterface';
-import { environment } from 'environments/environment';
@Injectable()
export class DataService {
diff --git a/front/src/app/service/dataInterface.ts b/front/src/app/service/dataInterface.ts
index 807b7cb..a318cda 100644
--- a/front/src/app/service/dataInterface.ts
+++ b/front/src/app/service/dataInterface.ts
@@ -248,13 +248,21 @@ export class DataInterface {
}
//console.log("order in list by : " + value_order);
//out = sorted(out, key=lambda x{ x[value_order])
- out.sort(function (a, b) {
- //const name1 = t1.name.toLowerCase();
- //const name2 = t2.name.toLowerCase();
+ if (value_order == "name") {
+ out.sort(function (a, b) {
+ const name1 = a[value_order].toLowerCase();
+ const name2 = b[value_order].toLowerCase();
+ if (name1 > name2) { return 1; }
+ if (name1 < name2) { return -1; }
+ return 0;
+ });
+ } else {
+ out.sort(function (a, b) {
if (a[value_order] > b[value_order]) { return 1; }
if (a[value_order] < b[value_order]) { return -1; }
return 0;
});
+ }
if (_order.length > 1) {
out_unclassable = this.order_by(out_unclassable, _order.slice(1));
}
diff --git a/front/src/app/service/http-oauth-wrapper.ts b/front/src/app/service/http-oauth-wrapper.ts
index f6954b4..a85db50 100644
--- a/front/src/app/service/http-oauth-wrapper.ts
+++ b/front/src/app/service/http-oauth-wrapper.ts
@@ -4,7 +4,7 @@ import { HttpClient, HttpHeaders, HttpParams, HttpRequest, HttpEvent} from '@ang
import { catchError, map, tap } from 'rxjs/operators';
import {Observable} from "rxjs";
-import { environment } from 'environments/environment';
+import { environment } from '../../environments/environment';
@Injectable()
export class HttpOAuthWrapperService {
@@ -312,7 +312,7 @@ export class HttpOAuthWrapperService {
}
});
});
- };
+ }
// Complex wrapper to simplify interaction:
delete_specific(_base:string, _id:number, _subElement:string = ""):any {
@@ -349,7 +349,7 @@ export class HttpOAuthWrapperService {
}
});
});
- };
+ }
// Complex wrapper to simplify interaction:
put_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any {
//console.log("put data to " + _base);
@@ -385,7 +385,7 @@ export class HttpOAuthWrapperService {
}
});
});
- };
+ }
// Complex wrapper to simplify interaction:
post_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any {
//console.log("put data to " + _base);
@@ -421,5 +421,5 @@ export class HttpOAuthWrapperService {
}
});
});
- };
+ }
}
diff --git a/front/src/app/service/http-wrapper.ts b/front/src/app/service/http-wrapper.ts
index e77e969..f18df86 100644
--- a/front/src/app/service/http-wrapper.ts
+++ b/front/src/app/service/http-wrapper.ts
@@ -4,8 +4,8 @@ import { HttpClient, HttpHeaders, HttpParams, HttpRequest, HttpEvent, HttpEventT
import { catchError, map, tap } from 'rxjs/operators';
import {Observable} from "rxjs";
-import { environment } from 'environments/environment';
-import { SessionService } from 'app/service/session';
+import { environment } from '../../environments/environment';
+import { SessionService } from './session';
@Injectable()
export class HttpWrapperService {
@@ -404,8 +404,8 @@ export class HttpWrapperService {
self.post(url, headers, _multipart, _progress)
.then(function(response: any) {
console.log("URL: " + url + "\nRespond(" + response.status + "): " + JSON.stringify(response.data, null, 2));
- if (response.status == 200) {
- resolve(response.data);
+ if (response.status >= 200 && response.status <= 299) {
+ resolve(response.data.body);
return;
}
reject("An error occured");
@@ -484,7 +484,7 @@ export class HttpWrapperService {
}
});
});
- };
+ }
// Complex wrapper to simplify interaction:
delete_specific(_base:string, _id:number, _subElement:string = ""):any {
@@ -521,7 +521,7 @@ export class HttpWrapperService {
}
});
});
- };
+ }
// Complex wrapper to simplify interaction:
put_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any {
//console.log("put data to " + _base);
@@ -557,7 +557,7 @@ export class HttpWrapperService {
}
});
});
- };
+ }
// Complex wrapper to simplify interaction:
post_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any {
//console.log("put data to " + _base);
@@ -593,5 +593,5 @@ export class HttpWrapperService {
}
});
});
- };
+ }
}
diff --git a/front/src/app/service/saison.ts b/front/src/app/service/season.ts
similarity index 74%
rename from front/src/app/service/saison.ts
rename to front/src/app/service/season.ts
index f4c55cc..fd41fe8 100644
--- a/front/src/app/service/saison.ts
+++ b/front/src/app/service/season.ts
@@ -1,25 +1,24 @@
import { Injectable } from '@angular/core';
-import { HttpWrapperService } from 'app/service/http-wrapper';
-import { DataInterface } from 'app/service/dataInterface';
-import { environment } from 'environments/environment';
-import { BddService } from 'app/service/bdd';
+import { HttpWrapperService } from './http-wrapper';
+import { DataInterface } from './dataInterface';
+import { BddService } from './bdd';
@Injectable()
-export class SaisonService {
+export class SeasonService {
// 0: Not hide password; 1 hide password;
private identificationVersion: number = 1;
- private serviceName:string = "saison";
+ private serviceName:string = "season";
constructor(private http: HttpWrapperService,
private bdd: BddService) {
- console.log("Start SaisonService");
+ console.log("Start SeasonService");
}
get(_id:number):any {
let self = this;
return new Promise((resolve, reject) => {
- self.bdd.getSaison()
+ self.bdd.getSeason()
.then(function(response) {
let data = response.get(_id);
if (data === null || data === undefined) {
@@ -37,8 +36,8 @@ export class SaisonService {
return new Promise((resolve, reject) => {
self.bdd.getVideo()
.then(function(response) {
- //let data = response.gets_where([["==", "saison_id", _id]], ["id", "name", "episode"], ["episode", "name"])
- let data = response.gets_where([["==", "saison_id", _id]], undefined, ["episode", "name"])
+ //let data = response.gets_where([["==", "season_id", _id]], ["id", "name", "episode"], ["episode", "name"])
+ let data = response.gets_where([["==", "season_id", _id]], undefined, ["episode", "name"])
resolve(data);
}).catch(function(response) {
reject(response);
@@ -50,8 +49,8 @@ export class SaisonService {
return new Promise((resolve, reject) => {
self.bdd.getVideo()
.then(function(response) {
- //let data = response.gets_where([["==", "saison_id", _id]], ["id", "name", "episode"], ["episode", "name"])
- let data = response.gets_where([["==", "saison_id", _id]], undefined, ["episode", "name"])
+ //let data = response.gets_where([["==", "season_id", _id]], ["id", "name", "episode"], ["episode", "name"])
+ let data = response.gets_where([["==", "season_id", _id]], undefined, ["episode", "name"])
resolve(data.length);
}).catch(function(response) {
reject(response);
diff --git a/front/src/app/service/group.ts b/front/src/app/service/series.ts
similarity index 77%
rename from front/src/app/service/group.ts
rename to front/src/app/service/series.ts
index aaa612f..9336b28 100644
--- a/front/src/app/service/group.ts
+++ b/front/src/app/service/series.ts
@@ -1,25 +1,24 @@
import { Injectable } from '@angular/core';
-import { HttpWrapperService } from 'app/service/http-wrapper';
-import { DataInterface } from 'app/service/dataInterface';
-import { BddService } from 'app/service/bdd';
+import { HttpWrapperService } from './http-wrapper';
+import { DataInterface } from './dataInterface';
+import { BddService } from './bdd';
-import { environment } from 'environments/environment';
@Injectable()
-export class GroupService {
+export class SeriesService {
// 0: Not hide password; 1 hide password;
private identificationVersion: number = 1;
- private serviceName:string = "group";
+ private serviceName:string = "series";
constructor(private http: HttpWrapperService,
private bdd: BddService) {
- console.log("Start GroupService");
+ console.log("Start SeriesService");
}
get(_id:number):any {
let self = this;
return new Promise((resolve, reject) => {
- self.bdd.getGroup()
+ self.bdd.getSeries()
.then(function(response) {
let data = response.get(_id);
if (data === null || data === undefined) {
@@ -32,12 +31,12 @@ export class GroupService {
reject(response);
});
});
- };
+ }
getData():any {
let self = this;
return new Promise((resolve, reject) => {
- self.bdd.getGroup()
+ self.bdd.getSeries()
.then(function(response) {
let data = response.gets();
resolve(data);
@@ -46,12 +45,12 @@ export class GroupService {
reject(response);
});
});
- };
+ }
getOrder():any {
let self = this;
return new Promise((resolve, reject) => {
- self.bdd.getGroup()
+ self.bdd.getSeries()
.then(function(response) {
let data = response.gets_where([["!=", "id", null]], ["id", "name"], ["name","id"])
resolve(data);
@@ -60,30 +59,30 @@ export class GroupService {
reject(response);
});
});
- };
+ }
getVideoAll(_id:number):any {
//this.checkLocalBdd();
- };
+ }
getVideo(_id:number):any {
let self = this;
return new Promise((resolve, reject) => {
self.bdd.getVideo()
.then(function(response) {
- //let data = response.gets_where([["==", "serie_id", _id], ["==", "saison_id", null]], ["id"], ["episode", "name"])
- let data = response.gets_where([["==", "serie_id", _id], ["==", "saison_id", null]], undefined, ["episode", "name"])
+ //let data = response.gets_where([["==", "series_id", _id], ["==", "season_id", null]], ["id"], ["episode", "name"])
+ let data = response.gets_where([["==", "series_id", _id], ["==", "season_id", null]], undefined, ["episode", "name"])
resolve(data);
}).catch(function(response) {
reject(response);
});
});
- };
+ }
- getSaison(_id:number, _select:Array = []):any {
+ getSeason(_id:number, _select:Array = []):any {
let self = this;
return new Promise((resolve, reject) => {
- self.bdd.getSaison()
+ self.bdd.getSeason()
.then(function(response) {
let data = response.gets_where([["==", "parent_id", _id]], ["id"], ["number"])
if (_select.length == 0) {
@@ -102,30 +101,31 @@ export class GroupService {
reject(response);
});
});
- };
+ }
put(_id:number, _data:any):any {
let ret = this.http.put_specific(this.serviceName, _id, _data);
return this.bdd.setAfterPut(this.serviceName, _id, ret);
- };
+ }
addCover(_id:number, _coverId:number):any {
return this.http.post_specific(this.serviceName, _id, {"data_id":_coverId}, "add_cover");
- };
+ }
getCoverUrl(_coverId:number):any {
return this.http.createRESTCall("data/" + _coverId);
- };
+ }
+
getCoverThumbnailUrl(_coverId:number):any {
return this.http.createRESTCall("data/thumbnail/" + _coverId);
- };
+ }
- getLike(_nameGroup:string):any {
+ getLike(_nameSeries:string):any {
let self = this;
return new Promise((resolve, reject) => {
- self.bdd.getGroup()
+ self.bdd.getSeries()
.then(function(response) {
- let data = response.getNameLike(_nameGroup);
+ let data = response.getNameLike(_nameSeries);
if (data === null || data === undefined) {
reject("Data does not exist in the local BDD");
return;
diff --git a/front/src/app/service/type.ts b/front/src/app/service/type.ts
index b260b46..9258efe 100644
--- a/front/src/app/service/type.ts
+++ b/front/src/app/service/type.ts
@@ -1,11 +1,9 @@
import { Injectable } from '@angular/core';
-import { HttpWrapperService } from 'app/service/http-wrapper';
-//import { SHA512 } from 'assets/js_3rd_party/sha512';
-import { DataInterface } from 'app/service/dataInterface';
-import { BddService } from 'app/service/bdd';
+import { HttpWrapperService } from './http-wrapper';
+import { DataInterface } from './dataInterface';
+import { BddService } from './bdd';
-import { environment } from 'environments/environment';
export interface MessageLogIn {
id: number;
@@ -66,16 +64,16 @@ export class TypeService {
self.bdd.getVideo()
.then(function(response) {
if (_select.length == 0) {
- let data = response.gets_where([["==", "type_id", _id], ["==", "serie_id", null], ["==", "univers_id", null]], undefined, ["name"]);
+ let data = response.gets_where([["==", "type_id", _id], ["==", "series_id", null], ["==", "universe_id", null]], undefined, ["name"]);
resolve(data);
return;
}
if (_select[0] == "*") {
- let data = response.gets_where([["==", "type_id", _id], ["==", "serie_id", null], ["==", "univers_id", null]], undefined, ["name"]);
+ let data = response.gets_where([["==", "type_id", _id], ["==", "series_id", null], ["==", "universe_id", null]], undefined, ["name"]);
resolve(data);
return;
}
- let data = response.gets_where([["==", "type_id", _id], ["==", "serie_id", null], ["==", "univers_id", null]], _select, ["name"]);
+ let data = response.gets_where([["==", "type_id", _id], ["==", "series_id", null], ["==", "universe_id", null]], _select, ["name"]);
resolve(data);
return;
}).catch(function(response) {
@@ -84,17 +82,17 @@ export class TypeService {
});
}
- getSubGroup(_id:number, _select:Array = []):any {
+ getSubSeries(_id:number, _select:Array = []):any {
let self = this;
return new Promise((resolve, reject) => {
self.bdd.getVideo()
.then(function(response) {
- let data = response.gets_where([["==", "type_id", _id], ["!=", "serie_id", null], ["==", "univers_id", null]], ["serie_id"], ["name"]);
+ let data = response.gets_where([["==", "type_id", _id], ["!=", "series_id", null], ["==", "universe_id", null]], ["series_id"], ["name"]);
if (_select.length == 0) {
resolve(data);
return;
}
- self.bdd.getGroup()
+ self.bdd.getSeries()
.then(function(response2) {
if (_select[0] == "*") {
let data2 = response2.gets_where([["==", "id", data]], undefined, ["name"]);
@@ -113,17 +111,17 @@ export class TypeService {
});
}
- getSubUnivers(_id:number, _select:Array = []):any {
+ getSubUniverse(_id:number, _select:Array = []):any {
let self = this;
return new Promise((resolve, reject) => {
self.bdd.getVideo()
.then(function(response) {
- let data = response.data.gets_where([["==", "type_id", _id], ["==", "serie_id", null], ["==", "univers_id", null]], ["univers_id"], ["name"]);
+ let data = response.data.gets_where([["==", "type_id", _id], ["==", "series_id", null], ["==", "universe_id", null]], ["univers_id"], ["name"]);
if (_select.length == 0) {
resolve(data);
return;
}
- self.bdd.getUnivers()
+ self.bdd.getUniverse()
.then(function(response2) {
if (_select[0] == "*") {
let data2 = response2.gets_where([["==", "id", data]], undefined, ["name"]);
diff --git a/front/src/app/service/univers.ts b/front/src/app/service/universe.ts
similarity index 74%
rename from front/src/app/service/univers.ts
rename to front/src/app/service/universe.ts
index a700403..3117e74 100644
--- a/front/src/app/service/univers.ts
+++ b/front/src/app/service/universe.ts
@@ -1,25 +1,23 @@
import { Injectable } from '@angular/core';
-import { HttpWrapperService } from 'app/service/http-wrapper';
-import { DataInterface } from 'app/service/dataInterface';
-import { BddService } from 'app/service/bdd';
-
-import { environment } from 'environments/environment';
+import { HttpWrapperService } from './http-wrapper';
+import { DataInterface } from './dataInterface';
+import { BddService } from './bdd';
@Injectable()
-export class UniversService {
+export class UniverseService {
// 0: Not hide password; 1 hide password;
private identificationVersion: number = 1;
- private serviceName:string = "univers";
+ private serviceName:string = "universe";
constructor(private http: HttpWrapperService,
private bdd: BddService) {
- console.log("Start universService");
+ console.log("Start universeService");
}
getData():any {
let self = this;
return new Promise((resolve, reject) => {
- self.bdd.getUnivers()
+ self.bdd.getUniverse()
.then(function(response) {
let data = response.gets();
resolve(data);
@@ -27,12 +25,12 @@ export class UniversService {
reject(response);
});
});
- };
+ }
get(_id:number):any {
let self = this;
return new Promise((resolve, reject) => {
- self.bdd.getUnivers()
+ self.bdd.getUniverse()
.then(function(response) {
let data = response.get(_id);
if (data === null || data === undefined) {
@@ -44,25 +42,25 @@ export class UniversService {
reject(response);
});
});
- };
+ }
- getSubGroup(_id:number, _select:Array = []):any {
+ getSubSeries(_id:number, _select:Array = []):any {
//this.checkLocalBdd();
- };
+ }
getSubVideo(_id:number, _select:Array = []):any {
//this.checkLocalBdd();
- };
+ }
put(_id:number, _data:any):any {
let ret = this.http.put_specific(this.serviceName, _id, _data);
return this.bdd.setAfterPut(this.serviceName, _id, ret);
- };
+ }
addCover(_id:number, _coverId:number):any {
return this.http.post_specific(this.serviceName, _id, {"data_id":_coverId}, "add_cover");
- };
+ }
getCoverUrl(_coverId:number):any {
return this.http.createRESTCall("data/" + _coverId);
- };
+ }
}
diff --git a/front/src/app/service/user.ts b/front/src/app/service/user.ts
index 573e520..518a391 100644
--- a/front/src/app/service/user.ts
+++ b/front/src/app/service/user.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
-import { HttpOAuthWrapperService } from 'app/service/http-oauth-wrapper';
-import { HttpWrapperService } from 'app/service/http-wrapper';
+import { HttpOAuthWrapperService } from './http-oauth-wrapper';
+import { HttpWrapperService } from './http-wrapper';
//import { SHA512 } from 'assets/js_3rd_party/sha512';
interface MessageLogIn {
diff --git a/front/src/app/service/video.ts b/front/src/app/service/video.ts
index 34645fe..e0efff0 100644
--- a/front/src/app/service/video.ts
+++ b/front/src/app/service/video.ts
@@ -1,9 +1,9 @@
import { Injectable } from '@angular/core';
-import { HttpWrapperService } from 'app/service/http-wrapper';
-import { DataInterface } from 'app/service/dataInterface';
-import { BddService } from 'app/service/bdd';
+import { HttpWrapperService } from './http-wrapper';
+import { DataInterface } from './dataInterface';
+import { BddService } from './bdd';
-import { environment } from 'environments/environment';
+import { environment } from '../../environments/environment';
@Injectable()
export class VideoService {
@@ -42,20 +42,17 @@ export class VideoService {
let ret = this.http.delete_specific(this.serviceName, _id);
return this.bdd.delete(this.serviceName, _id, ret);
}
- addCover(_id:number, _coverId:number):any {
- return this.http.post_specific(this.serviceName, _id, {"data_id":_coverId}, "add_cover");
- }
getCoverUrl(_coverId:number):any {
return this.http.createRESTCall("data/" + _coverId);
}
getCoverThumbnailUrl(_coverId:number):any {
return this.http.createRESTCall("data/thumbnail/" + _coverId);
}
-
+
uploadFile(_file:File,
_universe:string,
- _serie:string,
- _saison:number,
+ _series:string,
+ _season:number,
_episode:number,
_title:string,
_type_id:number,
@@ -63,11 +60,11 @@ export class VideoService {
const formData = new FormData();
formData.append('file_name', _file.name);
formData.append('universe', _universe);
- formData.append('serie', _serie);
- if (_saison != null) {
- formData.append('saison', _saison.toString());
+ formData.append('series', _series);
+ if (_season != null) {
+ formData.append('season', _season.toString());
} else {
- formData.append('saison', null);
+ formData.append('season', null);
}
if (_episode != null) {
@@ -85,5 +82,48 @@ export class VideoService {
formData.append('file', _file);
return this.http.uploadMultipart(this.serviceName + "/upload/", formData, _progress);
}
+
+ deleteCover(_media_id:number,
+ _cover_id:number) {
+ let self = this;
+ return new Promise((resolve, reject) => {
+ self.http.get_specific(this.serviceName + "/" + _media_id + "/rm_cover" , _cover_id)
+ .then(function(response) {
+ let data = response;
+ if (data === null || data === undefined) {
+ reject("error retrive data from server");
+ return;
+ }
+ self.bdd.asyncSetInDB(self.serviceName, _media_id, data);
+ resolve(data);
+ }).catch(function(response) {
+ reject(response);
+ });
+ });
+
+ }
+ uploadCover(_file:File,
+ _media_id:number,
+ _progress:any = null) {
+ const formData = new FormData();
+ formData.append('file_name', _file.name);
+ formData.append('type_id', _media_id.toString());
+ formData.append('file', _file);
+ let self = this;
+ return new Promise((resolve, reject) => {
+ self.http.uploadMultipart(this.serviceName + "/" + _media_id + "/add_cover/", formData, _progress)
+ .then(function(response) {
+ let data = response;
+ if (data === null || data === undefined) {
+ reject("error retrive data from server");
+ return;
+ }
+ self.bdd.asyncSetInDB(self.serviceName, _media_id, data);
+ resolve(data);
+ }).catch(function(response) {
+ reject(response);
+ });
+ });
+ }
}