[DEBUG] Some corrections for upload

This commit is contained in:
Edouard DUPIN 2022-04-08 21:31:37 +02:00
parent edcac1a386
commit 15c3b5f71e
5 changed files with 50 additions and 39 deletions

View File

@ -257,7 +257,7 @@ public class NodeInterface {
ex.printStackTrace();
throw new SQLException("Creating node failed, no ID obtained (2).");
}
ps.execute();
//ps.execute();
} catch (SQLException ex) {
ex.printStackTrace();
}

View File

@ -14,6 +14,9 @@ import javax.annotation.security.PermitAll;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.Response.Status;
import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
@ -288,11 +291,16 @@ public class VideoResource {
System.out.println(" - season: " + season);
System.out.println(" - episode: " + episode);
System.out.println(" - title: " + title);
System.out.println(" - typeId: " + typeId);
System.out.println(" - type: " + typeId);
System.out.println(" - fileInputStream: " + fileInputStream);
System.out.println(" - fileMetaData: " + fileMetaData);
System.out.flush();
if (typeId == null) {
return Response.status(406).
entity("Missong Input 'type'").
type("text/plain").
build();
}
long tmpUID = DataResource.getTmpDataId();
String sha512 = DataResource.saveTemporaryFile(fileInputStream, tmpUID);
@ -413,10 +421,13 @@ public class VideoResource {
MediaSmall creation = get(uniqueSQLID);
return Response.ok(creation).build();
} catch (Exception ex) {
System.out.println("Cat ann unexpected error ... ");
ex.printStackTrace();
System.out.println("Catch an unexpected error ... " + ex.getMessage());
ex.printStackTrace();
return Response.status(417).
entity("Back-end error : " + ex.getMessage()).
type("text/plain").
build();
}
return Response.serverError().build();
}
@POST
@Path("{id}/add_cover")

View File

@ -33,11 +33,11 @@
</table>
</div>
<div *ngIf="this.parsedElement.length != 0" class="title">
<div *ngIf="this.parsedElement.length !== 0" class="title">
Meta-data:
</div>
<div class="clear"><br/></div>
<div *ngIf="this.parsedElement.length != 0" class="fill-all">
<div *ngIf="this.parsedElement.length !== 0" class="fill-all">
<div class="request_raw_table">
<table>
<colgroup>
@ -49,9 +49,9 @@
<tr>
<td class="left-colomn">Type:</td>
<td class="right-colomn">
<select [ngModel]="type_id"
<select [ngModel]="typeId"
(ngModelChange)="onChangeType($event)"
[class.error]="type_id == null">
[class.error]="typeId === undefined">
<option *ngFor="let element of listType" [ngValue]="element.value">{{element.label}}</option>
</select>
</td>
@ -61,7 +61,7 @@
<td class="right-colomn">
<input type="text"
placeholder="Universe of the Media"
[value]="global_universe"
[value]="globalUniverse"
(input)="onUniverse($event.target.value)"
/>
</td>
@ -71,7 +71,7 @@
<td class="right-colomn">
<input type="text"
placeholder="Series of the Media"
[value]="global_series"
[value]="globalSeries"
(input)="onSeries($event.target.value)"
/>
</td>
@ -79,7 +79,7 @@
<tr>
<td class="left-colomn"></td>
<td class="right-colomn">
<select [ngModel]="series_id"
<select [ngModel]="seriesId"
(ngModelChange)="onChangeSeries($event)">
<option *ngFor="let element of listSeries" [ngValue]="element.value">{{element.label}}</option>
</select>
@ -98,7 +98,7 @@
<input type="number"
pattern="[0-9]{0-4}"
placeholder="season of the Media"
[value]="global_season"
[value]="globalSeason"
(input)="onSeason($event.target.value)"
/>
</td>
@ -128,7 +128,7 @@
placeholder="e?"
[value]="data.episode"
(input)="onEpisode(data, $event.target.value)"
[class.error]="data.episodeDetected == true"
[class.error]="data.episodeDetected === true"
/>
</td>
<td class="right-colomn" >
@ -136,9 +136,9 @@
placeholder="Name of the Media"
[value]="data.title"
(input)="onTitle(data, $event.target.value)"
[class.error]="data.title == ''"
[class.error]="data.title === ''"
/>
<span *ngIf="data.nameDetected == true" class="error">
<span *ngIf="data.nameDetected === true" class="error">
^^^This title already exist !!!
</span>
</td>
@ -164,7 +164,7 @@
</button>
</div>
<div class="clear"></div>
<div class="request_raw_table" *ngIf="this.listFileInBdd != null">
<div class="request_raw_table" *ngIf="this.listFileInBdd !== undefined">
<table>
<colgroup>
<col style="width:10%">
@ -179,14 +179,14 @@
</thead>
<tbody>
<tr *ngFor="let data of this.listFileInBdd">
<td class="left-colomn" [class.error]="data.episodeDetected == true">{{data.episode}}</td>
<td class="right-colomn" [class.error]="data.nameDetected == true">{{data.name}}</td>
<td class="left-colomn" [class.error]="data.episodeDetected === true">{{data.episode}}</td>
<td class="right-colomn" [class.error]="data.nameDetected === true">{{data.name}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div *ngIf="this.parsedElement.length != 0" class="fill-all">
<div *ngIf="this.parsedElement.length !== 0" class="fill-all">
<div class="request_raw_table">
<table>
<colgroup>

View File

@ -58,7 +58,7 @@ export class UploadScene implements OnInit {
selectedFiles: FileList;
typeId: number = null;
seriesId: number = null;
saisonId: number = null;v
saisonId: number = null;
needSend: boolean = false;
// list of all files already registered in the bdd to compare with the curent list of files.
@ -391,10 +391,10 @@ export class UploadScene implements OnInit {
iii--;
}
}
this.globalUniverse = this.parsedElement[0].universe;
this.globalSeries = this.parsedElement[0].series;
this.globalSeason = this.parsedElement[0].season;
console.log(`check : ${JSON.stringify(this.parsedElement[0])}`)
this.globalUniverse = this.parsedElement[0].universe ?? '';
this.globalSeries = this.parsedElement[0].series ?? '';
this.globalSeason = this.parsedElement[0].season ?? null;
this.updateNeedSend();
this.seriesId = null;

View File

@ -55,25 +55,25 @@ export class VideoService {
}
uploadFile(file:File,
universe:string,
series:string,
seriesId:number,
season:number,
episode:number,
title:string,
typeId:number,
universe?:string,
series?:string,
seriesId?:number,
season?:number,
episode?:number,
title?:string,
typeId?:number,
progress:any = null) {
const formData = new FormData();
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('file', file?? null);
formData.append('universe', universe?? null);
if(seriesId !== null) {
formData.append('seriesId', seriesId.toString());
formData.append('series', seriesId.toString());
} else {
formData.append('seriesId', null);
formData.append('series', null);
}
formData.append('series', series);
formData.append('series', series?? null);
if(season !== null) {
formData.append('season', season.toString());
} else {
@ -85,7 +85,7 @@ export class VideoService {
} else {
formData.append('episode', null);
}
formData.append('title', title);
formData.append('title', title?? null);
if(typeId !== null) {
formData.append('typeId', typeId.toString());