diff --git a/back/src/org/kar/karideo/api/NodeInterface.java b/back/src/org/kar/karideo/api/NodeInterface.java
index dee715c..07320dd 100644
--- a/back/src/org/kar/karideo/api/NodeInterface.java
+++ b/back/src/org/kar/karideo/api/NodeInterface.java
@@ -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();
}
diff --git a/back/src/org/kar/karideo/api/VideoResource.java b/back/src/org/kar/karideo/api/VideoResource.java
index 4971383..dd25311 100644
--- a/back/src/org/kar/karideo/api/VideoResource.java
+++ b/back/src/org/kar/karideo/api/VideoResource.java
@@ -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")
diff --git a/front/src/app/scene/upload/upload.html b/front/src/app/scene/upload/upload.html
index c7882c0..3adc21a 100644
--- a/front/src/app/scene/upload/upload.html
+++ b/front/src/app/scene/upload/upload.html
@@ -33,11 +33,11 @@
-
+
Meta-data:
-
+
@@ -49,9 +49,9 @@
Type: |
-
|
@@ -61,7 +61,7 @@
|
@@ -71,7 +71,7 @@
|
@@ -79,7 +79,7 @@
|
-
@@ -98,7 +98,7 @@
|
@@ -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"
/>
@@ -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 === ''"
/>
-
+
^^^This title already exist !!!
|
@@ -164,7 +164,7 @@
-
+
@@ -179,14 +179,14 @@
- {{data.episode}} |
- {{data.name}} |
+ {{data.episode}} |
+ {{data.name}} |
-
+
diff --git a/front/src/app/scene/upload/upload.ts b/front/src/app/scene/upload/upload.ts
index 403848a..e084301 100644
--- a/front/src/app/scene/upload/upload.ts
+++ b/front/src/app/scene/upload/upload.ts
@@ -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;
diff --git a/front/src/app/service/video.ts b/front/src/app/service/video.ts
index f18e480..9d4be34 100644
--- a/front/src/app/service/video.ts
+++ b/front/src/app/service/video.ts
@@ -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());