[DEV] update upload
This commit is contained in:
parent
2b8d170383
commit
f060c47a24
@ -38,27 +38,16 @@
|
|||||||
<div *ngIf="mediaFile != null" class="fill-all">
|
<div *ngIf="mediaFile != null" class="fill-all">
|
||||||
<div class="request_raw">
|
<div class="request_raw">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
*Type:
|
Type:
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input" element.value>
|
||||||
<select [ngModel]="type_id"
|
<select [ngModel]="type_id"
|
||||||
(ngModelChange)="onChangeType($event)">
|
(ngModelChange)="onChangeType($event)"
|
||||||
|
[class.error]="type_id == null">
|
||||||
<option *ngFor="let element of listType" [ngValue]="element.value">{{element.label}}</option>
|
<option *ngFor="let element of listType" [ngValue]="element.value">{{element.label}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="request_raw">
|
|
||||||
<div class="label">
|
|
||||||
*Title:
|
|
||||||
</div>
|
|
||||||
<div class="input">
|
|
||||||
<input type="text"
|
|
||||||
placeholder="Name of the Media"
|
|
||||||
[value]="parse_title"
|
|
||||||
(input)="onTitle($event.target.value)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="request_raw">
|
<div class="request_raw">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
Universe:
|
Universe:
|
||||||
@ -71,6 +60,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="request_raw">
|
<div class="request_raw">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
Series:
|
Series:
|
||||||
@ -84,10 +74,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="request_raw">
|
<div class="request_raw">
|
||||||
<div class="label">
|
<div class="label label2">
|
||||||
==>
|
==>
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input input2">
|
||||||
<select [ngModel]="series_id"
|
<select [ngModel]="series_id"
|
||||||
(ngModelChange)="onChangeSeries($event)">
|
(ngModelChange)="onChangeSeries($event)">
|
||||||
<option *ngFor="let element of listSeries" [ngValue]="element.value">{{element.label}}</option>
|
<option *ngFor="let element of listSeries" [ngValue]="element.value">{{element.label}}</option>
|
||||||
@ -125,8 +115,20 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="request_raw">
|
||||||
|
<div class="label">
|
||||||
|
Title:
|
||||||
|
</div>
|
||||||
|
<div class="input">
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Name of the Media"
|
||||||
|
[value]="parse_title"
|
||||||
|
(input)="onTitle($event.target.value)"
|
||||||
|
[class.error]="parse_title == ''"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
||||||
<div class="send_value">
|
<div class="send_value">
|
||||||
<button class="button fill-x color-button-validate color-shadow-black"
|
<button class="button fill-x color-button-validate color-shadow-black"
|
||||||
[disabled]="!need_send"
|
[disabled]="!need_send"
|
||||||
|
@ -65,6 +65,16 @@ d.fill-all{
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
.error {
|
||||||
|
border-color: rgba(200,0,0,1.0);
|
||||||
|
background-color: rgba(256,220,220,1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.label2 {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
.input2 {
|
||||||
|
width: 70%;
|
||||||
}
|
}
|
||||||
.input_add {
|
.input_add {
|
||||||
width: 5%;
|
width: 5%;
|
||||||
|
@ -47,8 +47,8 @@ export class UploadScene implements OnInit {
|
|||||||
mediaFile: File = null;
|
mediaFile: File = null;
|
||||||
upload_file_value: string = ""
|
upload_file_value: string = ""
|
||||||
selectedFiles: FileList;
|
selectedFiles: FileList;
|
||||||
type_id: number = undefined
|
type_id: number = null
|
||||||
series_id: number = undefined
|
series_id: number = null
|
||||||
need_send: boolean = false;
|
need_send: boolean = false;
|
||||||
|
|
||||||
covers_display: Array<any> = [];
|
covers_display: Array<any> = [];
|
||||||
@ -59,16 +59,15 @@ export class UploadScene implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
listType: ElementList[] = [
|
listType: ElementList[] = [
|
||||||
{ value: undefined, label: '---' },
|
{ value: null, label: '---' },
|
||||||
];
|
];
|
||||||
listUniverse: ElementList[] = [
|
listUniverse: ElementList[] = [
|
||||||
{ value: undefined, label: '---' },
|
|
||||||
{ value: null, label: '---' },
|
{ value: null, label: '---' },
|
||||||
];
|
];
|
||||||
listSeries: ElementList[] = [
|
listSeries: ElementList[] = [
|
||||||
{ value: undefined, label: '---' },
|
{ value: null, label: '---' },
|
||||||
];
|
];
|
||||||
listSeries2 = [{ id: undefined, description: '---' }];
|
listSeries2 = [{ id: null, description: '---' }];
|
||||||
/*
|
/*
|
||||||
config = {
|
config = {
|
||||||
displayKey: "label", // if objects array passed which key to be displayed defaults to description
|
displayKey: "label", // if objects array passed which key to be displayed defaults to description
|
||||||
@ -89,7 +88,7 @@ export class UploadScene implements OnInit {
|
|||||||
searchOnKey: 'description', // key on which search should be performed this will be selective search. if undefined this will be extensive search on all keys
|
searchOnKey: 'description', // key on which search should be performed this will be selective search. if undefined this will be extensive search on all keys
|
||||||
}
|
}
|
||||||
listSeason: ElementList[] = [
|
listSeason: ElementList[] = [
|
||||||
{ value: undefined, label: '---' },
|
{ value: null, label: '---' },
|
||||||
];
|
];
|
||||||
parse_universe: string = "";
|
parse_universe: string = "";
|
||||||
parse_series: string = "";
|
parse_series: string = "";
|
||||||
@ -119,7 +118,7 @@ export class UploadScene implements OnInit {
|
|||||||
if (this.parse_title === undefined || this.parse_title === null || this.parse_title === "") {
|
if (this.parse_title === undefined || this.parse_title === null || this.parse_title === "") {
|
||||||
this.need_send = false;
|
this.need_send = false;
|
||||||
}
|
}
|
||||||
if (this.type_id === undefined) {
|
if (this.type_id === undefined || this.type_id === null) {
|
||||||
this.need_send = false;
|
this.need_send = false;
|
||||||
}
|
}
|
||||||
return this.need_send;
|
return this.need_send;
|
||||||
@ -129,10 +128,10 @@ export class UploadScene implements OnInit {
|
|||||||
this.arianeService.updateManual(this.route.snapshot.paramMap);
|
this.arianeService.updateManual(this.route.snapshot.paramMap);
|
||||||
this.id_video = this.arianeService.getVideoId();
|
this.id_video = this.arianeService.getVideoId();
|
||||||
let self = this;
|
let self = this;
|
||||||
this.listType = [{ value: undefined, label: '---' }];
|
this.listType = [{ value: null, label: '---' }];
|
||||||
this.listUniverse = [{ value: undefined, label: '---' }];
|
this.listUniverse = [{ value: null, label: '---' }];
|
||||||
this.listSeries = [{ value: undefined, label: '---' }];
|
this.listSeries = [{ value: null, label: '---' }];
|
||||||
this.listSeason = [{ value: undefined, label: '---' }];
|
this.listSeason = [{ value: null, label: '---' }];
|
||||||
this.universeService.getData()
|
this.universeService.getData()
|
||||||
.then(function (response2) {
|
.then(function (response2) {
|
||||||
for (let iii = 0; iii < response2.length; iii++) {
|
for (let iii = 0; iii < response2.length; iii++) {
|
||||||
@ -150,6 +149,7 @@ export class UploadScene implements OnInit {
|
|||||||
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
||||||
});
|
});
|
||||||
//this.seriesService.getOrder()
|
//this.seriesService.getOrder()
|
||||||
|
/*
|
||||||
this.seriesService.getData()
|
this.seriesService.getData()
|
||||||
.then(function (response3) {
|
.then(function (response3) {
|
||||||
for (let iii = 0; iii < response3.length; iii++) {
|
for (let iii = 0; iii < response3.length; iii++) {
|
||||||
@ -159,6 +159,7 @@ export class UploadScene implements OnInit {
|
|||||||
}).catch(function (response3) {
|
}).catch(function (response3) {
|
||||||
console.log("get response3 : " + JSON.stringify(response3, null, 2));
|
console.log("get response3 : " + JSON.stringify(response3, null, 2));
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
this.videoService.get(this.id_video)
|
this.videoService.get(this.id_video)
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
@ -199,16 +200,22 @@ export class UploadScene implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onChangeType (_value: any): void {
|
onChangeType (_value: any): void {
|
||||||
|
this.series_id = null;
|
||||||
|
this.updateType (_value);
|
||||||
|
}
|
||||||
|
private updateType (_value: any): void {
|
||||||
console.log("Change requested of type ... " + _value);
|
console.log("Change requested of type ... " + _value);
|
||||||
|
if (this.type_id == _value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.type_id = _value;
|
this.type_id = _value;
|
||||||
//this.data.series_id = null;
|
//this.data.series_id = null;
|
||||||
//this.data.season_id = null;
|
//this.data.season_id = null;
|
||||||
//this.listSeries = [{value: undefined, label: '---'}];
|
this.listSeries = [{value: null, label: '---'}];
|
||||||
//this.listSeason = [{value: undefined, label: '---'}];
|
this.listSeason = [{value: null, label: '---'}];
|
||||||
let self = this;
|
let self = this;
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
/*
|
if (this.type_id != null) {
|
||||||
if (this.type_id != undefined) {
|
|
||||||
self.typeService.getSubSeries(this.type_id, ["id", "name"])
|
self.typeService.getSubSeries(this.type_id, ["id", "name"])
|
||||||
.then(function(response2) {
|
.then(function(response2) {
|
||||||
for(let iii= 0; iii < response2.length; iii++) {
|
for(let iii= 0; iii < response2.length; iii++) {
|
||||||
@ -218,7 +225,6 @@ export class UploadScene implements OnInit {
|
|||||||
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeSeries (_value: any): void {
|
onChangeSeries (_value: any): void {
|
||||||
@ -237,6 +243,7 @@ export class UploadScene implements OnInit {
|
|||||||
}
|
}
|
||||||
onSeason (_value: any): void {
|
onSeason (_value: any): void {
|
||||||
this.parse_season = _value;
|
this.parse_season = _value;
|
||||||
|
//console.log("change episode ID: " + _value + " ==> " + this.parse_season.toString());
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +258,8 @@ export class UploadScene implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onEpisode (_value: any): void {
|
onEpisode (_value: any): void {
|
||||||
this.parse_episode = parseInt(_value.value, 10);
|
this.parse_episode = _value;
|
||||||
|
//console.log("change episode ID: " + _value + " ==> " + this.parse_episode.toString());
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
}
|
}
|
||||||
onSeries (_value: any): void {
|
onSeries (_value: any): void {
|
||||||
@ -259,9 +267,16 @@ export class UploadScene implements OnInit {
|
|||||||
let self = this;
|
let self = this;
|
||||||
if (this.parse_series != "") {
|
if (this.parse_series != "") {
|
||||||
this.seriesService.getLike(this.parse_series)
|
this.seriesService.getLike(this.parse_series)
|
||||||
.then(function(response) {
|
.then(function(response: any[]) {
|
||||||
console.log("find elemet: " + response.name + " " + response.id);
|
console.log("find element: " + response.length);
|
||||||
self.series_id = response.id;
|
for (let iii = 0; iii<response.length; iii++) {
|
||||||
|
console.log(" - " + JSON.stringify(response[iii]));
|
||||||
|
}
|
||||||
|
if (response.length == 0) {
|
||||||
|
self.series_id = null;
|
||||||
|
} else if (response.length == 1) {
|
||||||
|
self.series_id = response[0].id;
|
||||||
|
}
|
||||||
}).catch(function(response) {
|
}).catch(function(response) {
|
||||||
console.log("CAN NOT find element: " );
|
console.log("CAN NOT find element: " );
|
||||||
self.series_id = null;
|
self.series_id = null;
|
||||||
@ -289,16 +304,26 @@ export class UploadScene implements OnInit {
|
|||||||
_event.preventDefault();
|
_event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
// At the file input element
|
clearData() {
|
||||||
// (change)="selectFile($event)"
|
|
||||||
onChangeFile (_value: any): void {
|
|
||||||
this.parse_universe = "";
|
this.parse_universe = "";
|
||||||
this.parse_series = "";
|
this.parse_series = "";
|
||||||
this.parse_season = null;
|
this.parse_season = null;
|
||||||
this.parse_episode = null;
|
this.parse_episode = null;
|
||||||
this.parse_title = "";
|
this.parse_title = "";
|
||||||
this.selectedFiles = _value.files
|
|
||||||
|
this.type_id = null;
|
||||||
|
this.series_id = null;
|
||||||
|
this.listSeries = [{value: null, label: '---'}];
|
||||||
|
this.listSeason = [{value: null, label: '---'}];
|
||||||
|
}
|
||||||
|
|
||||||
|
// At the file input element
|
||||||
|
// (change)="selectFile($event)"
|
||||||
|
onChangeFile (_value: any): void {
|
||||||
|
this.selectedFiles = _value.files;
|
||||||
this.mediaFile = this.selectedFiles[0];
|
this.mediaFile = this.selectedFiles[0];
|
||||||
|
this.clearData();
|
||||||
|
|
||||||
console.log("select file " + this.mediaFile.name);
|
console.log("select file " + this.mediaFile.name);
|
||||||
const splitElement = this.mediaFile.name.split('-');
|
const splitElement = this.mediaFile.name.split('-');
|
||||||
if (splitElement.length == 1) {
|
if (splitElement.length == 1) {
|
||||||
@ -348,24 +373,31 @@ export class UploadScene implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remove extention
|
// remove extention
|
||||||
this.parse_title = this.parse_title.replace(new RegExp("\.(mkv|MKV|Mkv|webm|WEBM|Webm)"),"");
|
this.parse_title = this.parse_title.replace(new RegExp("\.(mkv|MKV|Mkv|webm|WEBM|Webm|mp4)"),"");
|
||||||
//this.uploadFile(this.coverFile);
|
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
|
this.series_id = null;
|
||||||
let self = this;
|
let self = this;
|
||||||
if (this.parse_series != "") {
|
if (this.parse_series != "") {
|
||||||
this.seriesService.getLike(this.parse_series)
|
this.seriesService.getLike(this.parse_series)
|
||||||
.then(function(response) {
|
.then(function(response: any[]) {
|
||||||
console.log("find elemet: " + response.name + " " + response.id);
|
console.log("find element: " + response.length);
|
||||||
self.series_id = response.id;
|
for (let iii = 0; iii<response.length; iii++) {
|
||||||
|
console.log(" - " + JSON.stringify(response[iii]));
|
||||||
|
}
|
||||||
|
if (response.length == 0) {
|
||||||
|
self.series_id = null;
|
||||||
|
} else if (response.length == 1) {
|
||||||
|
let serie_elem = response[0];
|
||||||
|
self.series_id = serie_elem.id;
|
||||||
|
self.updateType(serie_elem.parent_id);
|
||||||
|
}
|
||||||
}).catch(function(response) {
|
}).catch(function(response) {
|
||||||
console.log("CAN NOT find element: " );
|
console.log("CAN NOT find element: " );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uploadFile (_file: File) {
|
uploadFile (_file: File) {
|
||||||
if (_file == undefined) {
|
if (_file == undefined) {
|
||||||
console.log("No file selected!");
|
console.log("No file selected!");
|
||||||
@ -381,25 +413,25 @@ export class UploadScene implements OnInit {
|
|||||||
*/
|
*/
|
||||||
this.upload = new UploadProgress();
|
this.upload = new UploadProgress();
|
||||||
// add universe
|
// add universe
|
||||||
if (this.parse_universe != null) {
|
if (this.parse_universe !== null) {
|
||||||
this.upload.labelMediaTitle += this.parse_universe;
|
this.upload.labelMediaTitle += this.parse_universe;
|
||||||
}
|
}
|
||||||
// add series
|
// add series
|
||||||
if (this.parse_series != null) {
|
if (this.parse_series !== null) {
|
||||||
if (this.upload.labelMediaTitle.length != 0) {
|
if (this.upload.labelMediaTitle.length != 0) {
|
||||||
this.upload.labelMediaTitle += "/";
|
this.upload.labelMediaTitle += "/";
|
||||||
}
|
}
|
||||||
this.upload.labelMediaTitle += this.parse_series;
|
this.upload.labelMediaTitle += this.parse_series;
|
||||||
}
|
}
|
||||||
// add season
|
// add season
|
||||||
if (this.parse_season != null) {
|
if (this.parse_season !== null && this.parse_season !== undefined && this.parse_season.toString().length != 0) {
|
||||||
if (this.upload.labelMediaTitle.length != 0) {
|
if (this.upload.labelMediaTitle.length != 0) {
|
||||||
this.upload.labelMediaTitle += "-";
|
this.upload.labelMediaTitle += "-";
|
||||||
}
|
}
|
||||||
this.upload.labelMediaTitle += "s" + this.parse_season.toString();
|
this.upload.labelMediaTitle += "s" + this.parse_season.toString();
|
||||||
}
|
}
|
||||||
// add episode ID
|
// add episode ID
|
||||||
if (this.parse_episode != null) {
|
if (this.parse_episode !== null && this.parse_episode !== undefined && this.parse_episode.toString().length != 0) {
|
||||||
if (this.upload.labelMediaTitle.length != 0) {
|
if (this.upload.labelMediaTitle.length != 0) {
|
||||||
this.upload.labelMediaTitle += "-";
|
this.upload.labelMediaTitle += "-";
|
||||||
}
|
}
|
||||||
@ -412,9 +444,11 @@ export class UploadScene implements OnInit {
|
|||||||
this.upload.labelMediaTitle += this.parse_title;
|
this.upload.labelMediaTitle += this.parse_title;
|
||||||
// display the upload pop-in
|
// display the upload pop-in
|
||||||
this.popInService.open("popin-upload-progress");
|
this.popInService.open("popin-upload-progress");
|
||||||
|
|
||||||
this.videoService.uploadFile(_file,
|
this.videoService.uploadFile(_file,
|
||||||
this.parse_universe,
|
this.parse_universe,
|
||||||
this.parse_series,
|
this.parse_series,
|
||||||
|
this.series_id,
|
||||||
this.parse_season,
|
this.parse_season,
|
||||||
this.parse_episode,
|
this.parse_episode,
|
||||||
this.parse_title,
|
this.parse_title,
|
||||||
|
@ -13,7 +13,7 @@ export class DataInterface {
|
|||||||
private name: string;
|
private name: string;
|
||||||
private bdd: any;
|
private bdd: any;
|
||||||
|
|
||||||
constructor(_name, _data) {
|
constructor(_name:string, _data:any) {
|
||||||
this.name = _name;
|
this.name = _name;
|
||||||
this.bdd = _data;
|
this.bdd = _data;
|
||||||
}
|
}
|
||||||
@ -66,15 +66,13 @@ export class DataInterface {
|
|||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
getNameLike(_name: string){
|
getNameLike(_name: string): any[] {
|
||||||
let out = undefined;
|
let out = [];
|
||||||
let nameLower = _name.toLowerCase();
|
let nameLower = _name.toLowerCase();
|
||||||
for (let iii=0; iii<this.bdd.length; iii++) {
|
for (let iii=0; iii<this.bdd.length; iii++) {
|
||||||
//console.log("compare '" + _name + "' ??? '" + this.bdd[iii]['name'] + "'");
|
//console.log("compare '" + _name + "' ??? '" + this.bdd[iii]['name'] + "'");
|
||||||
if (this.bdd[iii]['name'] == _name) {
|
if (this.bdd[iii]['name'].toLowerCase() == nameLower) {
|
||||||
return this.bdd[iii];
|
out.push(this.bdd[iii]);
|
||||||
} else if (this.bdd[iii]['name'].toLowerCase() == nameLower) {
|
|
||||||
out = this.bdd[iii];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
@ -19,7 +19,7 @@ export class SeriesService {
|
|||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getSeries()
|
self.bdd.getSeries()
|
||||||
.then(function(response) {
|
.then(function(response:DataInterface) {
|
||||||
let data = response.get(_id);
|
let data = response.get(_id);
|
||||||
if (data === null || data === undefined) {
|
if (data === null || data === undefined) {
|
||||||
reject("Data does not exist in the local BDD");
|
reject("Data does not exist in the local BDD");
|
||||||
@ -37,7 +37,7 @@ export class SeriesService {
|
|||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getSeries()
|
self.bdd.getSeries()
|
||||||
.then(function(response) {
|
.then(function(response:DataInterface) {
|
||||||
let data = response.gets();
|
let data = response.gets();
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}).catch(function(response) {
|
}).catch(function(response) {
|
||||||
@ -51,7 +51,7 @@ export class SeriesService {
|
|||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getSeries()
|
self.bdd.getSeries()
|
||||||
.then(function(response) {
|
.then(function(response:DataInterface) {
|
||||||
let data = response.gets_where([["!=", "id", null]], ["id", "name"], ["name","id"])
|
let data = response.gets_where([["!=", "id", null]], ["id", "name"], ["name","id"])
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}).catch(function(response) {
|
}).catch(function(response) {
|
||||||
@ -69,7 +69,7 @@ export class SeriesService {
|
|||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getVideo()
|
self.bdd.getVideo()
|
||||||
.then(function(response) {
|
.then(function(response:DataInterface) {
|
||||||
let data = response.gets_where([["==", "series_id", _id], ["==", "season_id", null]], undefined, ["episode", "name"])
|
let data = response.gets_where([["==", "series_id", _id], ["==", "season_id", null]], undefined, ["episode", "name"])
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}).catch(function(response) {
|
}).catch(function(response) {
|
||||||
@ -81,7 +81,7 @@ export class SeriesService {
|
|||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getVideo()
|
self.bdd.getVideo()
|
||||||
.then(function(response) {
|
.then(function(response:DataInterface) {
|
||||||
let data = response.gets_where([["==", "series_id", _id]], undefined, undefined)
|
let data = response.gets_where([["==", "series_id", _id]], undefined, undefined)
|
||||||
resolve(data.length);
|
resolve(data.length);
|
||||||
}).catch(function(response) {
|
}).catch(function(response) {
|
||||||
@ -94,7 +94,7 @@ export class SeriesService {
|
|||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getSeason()
|
self.bdd.getSeason()
|
||||||
.then(function(response) {
|
.then(function(response:DataInterface) {
|
||||||
let data = response.gets_where([["==", "parent_id", _id]], ["id"], ["number"])
|
let data = response.gets_where([["==", "parent_id", _id]], ["id"], ["number"])
|
||||||
if (_select.length == 0) {
|
if (_select.length == 0) {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
@ -131,9 +131,9 @@ export class SeriesService {
|
|||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getSeries()
|
self.bdd.getSeries()
|
||||||
.then(function(response) {
|
.then(function(response:DataInterface) {
|
||||||
let data = response.getNameLike(_nameSeries);
|
let data = response.getNameLike(_nameSeries);
|
||||||
if (data === null || data === undefined) {
|
if (data === null || data === undefined || data.length === 0 ) {
|
||||||
reject("Data does not exist in the local BDD");
|
reject("Data does not exist in the local BDD");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ export class VideoService {
|
|||||||
uploadFile(_file:File,
|
uploadFile(_file:File,
|
||||||
_universe:string,
|
_universe:string,
|
||||||
_series:string,
|
_series:string,
|
||||||
|
_series_id:number,
|
||||||
_season:number,
|
_season:number,
|
||||||
_episode:number,
|
_episode:number,
|
||||||
_title:string,
|
_title:string,
|
||||||
@ -59,7 +60,14 @@ export class VideoService {
|
|||||||
_progress:any = null) {
|
_progress:any = null) {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file_name', _file.name);
|
formData.append('file_name', _file.name);
|
||||||
|
// set the file at hte begining it will permit to abort the transmission
|
||||||
|
formData.append('file', _file);
|
||||||
formData.append('universe', _universe);
|
formData.append('universe', _universe);
|
||||||
|
if (_series_id != null) {
|
||||||
|
formData.append('series_id', _series_id.toString());
|
||||||
|
} else {
|
||||||
|
formData.append('series_id', null);
|
||||||
|
}
|
||||||
formData.append('series', _series);
|
formData.append('series', _series);
|
||||||
if (_season != null) {
|
if (_season != null) {
|
||||||
formData.append('season', _season.toString());
|
formData.append('season', _season.toString());
|
||||||
@ -79,7 +87,6 @@ export class VideoService {
|
|||||||
} else {
|
} else {
|
||||||
formData.append('type_id', null);
|
formData.append('type_id', null);
|
||||||
}
|
}
|
||||||
formData.append('file', _file);
|
|
||||||
return this.http.uploadMultipart(this.serviceName + "/upload/", formData, _progress);
|
return this.http.uploadMultipart(this.serviceName + "/upload/", formData, _progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user