[DEV] multiple file upload
This commit is contained in:
parent
9538581a97
commit
e98fe27a94
@ -1,5 +1,5 @@
|
||||
# base image
|
||||
FROM node:latest as build
|
||||
FROM node:lts as build
|
||||
|
||||
# add `/application/node_modules/.bin` to $PATH
|
||||
ENV PATH /application/node_modules/.bin:$PATH
|
||||
|
@ -6,38 +6,10 @@
|
||||
"all": "npm run build && npm run test",
|
||||
"ng": "ng",
|
||||
"start": "ng serve --watch",
|
||||
"_____test": "npm run test-unit && npm run test-readme && npm run test-component",
|
||||
"build": "ng build --prod",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
|
||||
"__all": "npm run build && npm run test && npm run generate-specs && npm run docs",
|
||||
"__build": "npm run lint-src && npm run clean-dist && npm run plint && npm run check-copyright && webpack-cli --type production && npx downlevel-dts dist/typings dist/typings3.6",
|
||||
"__build-dev": "npm run clean-dist && webpack-cli --type development",
|
||||
"__clean-dist": "rimraf dist/*",
|
||||
"__clean-lint": "rimraf target/lint/*",
|
||||
"__clean-test-component": "rimraf target/test/component/*",
|
||||
"__clean-test-unit": "rimraf target/test/unit/*",
|
||||
"__deps-checker": "node ./scripts/ifabric-last",
|
||||
"__generate-specs": "specgen . -i .gitignore -t node_modules/@ifabric-dev/specgen/templates/specs.md.mustache -x target/test/unit/junit-report.xml -f docs/fma/renderer-fma.json -o REQUIREMENTS.md",
|
||||
"__lint": "npm run clean-lint && npm run lint-src && npm run lint-unit && npm run lint-component",
|
||||
"__lint-component": "tslint -c ./test/tslint.json -p ./tsconfig.json \"./test/**/*.ts\"",
|
||||
"__lint-src": "tslint -p ./tsconfig.json \"./src/**/*.ts\"",
|
||||
"__lint-unit": "tslint -c ./test/tslint.json -p ./tsconfig.json \"./src/**/*.spec.ts\"",
|
||||
"__plint": "plint package.json",
|
||||
"__start": "webpack-dev-server --type development",
|
||||
"__start-ts": "rollup -w -c dev/ts/rollup.config.js",
|
||||
"__test": "npm run test-unit && npm run test-readme && npm run test-component",
|
||||
"__test-component": "npm run lint-component && npm run clean-test-component && karma start ./test/karma-crs.conf.js --grep \"!@performance|readme\"",
|
||||
"__test-perf": "npm run lint-component && npm run clean-test-component && karma start ./test/karma-crs-performance.conf.js --grep @performance",
|
||||
"__test-readme": "npm run lint-component && npm run clean-test-component && karma start ./test/karma-crs.conf.js --grep @readme",
|
||||
"__test-unit": "npm run lint-unit && npm run clean-test-unit && karma start ./test/karma-unit.conf.js",
|
||||
"__test-watch": "karma start ./test/karma-unit.conf.js --no-single-run --auto-watch",
|
||||
"__test-watch-comp": "npm run clean-test-component && karma start ./test/karma-crs.conf.js --no-single-run --auto-watch",
|
||||
"__docs": "rimraf docs/md && typedoc --options ./typedoc.json && api-extractor run --local",
|
||||
"__check-copyright": "check-copyright -f src/**/*.ts"
|
||||
|
||||
"e2e": "ng e2e"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
@ -25,6 +25,7 @@ export class TypeScene implements OnInit {
|
||||
name: string = "";
|
||||
description: string = "";
|
||||
cover:string = null;
|
||||
covers:string[] = [];
|
||||
seriess_error = "";
|
||||
seriess = [];
|
||||
videos_error = "";
|
||||
@ -53,9 +54,21 @@ export class TypeScene implements OnInit {
|
||||
.then(function(response) {
|
||||
self.name = response.name;
|
||||
self.description = response.description;
|
||||
|
||||
if (response.covers === undefined || response.covers === null || response.covers.length === 0) {
|
||||
self.cover = null;
|
||||
self.covers = []
|
||||
} else {
|
||||
self.cover = self.typeService.getCoverUrl(response.covers[0]);
|
||||
for (let iii=0; iii<response.covers.length; iii++) {
|
||||
self.covers.push(self.typeService.getCoverUrl(response.covers[iii]));
|
||||
}
|
||||
}
|
||||
}).catch(function(response) {
|
||||
self.name = "???";
|
||||
self.description = "";
|
||||
self.covers = [];
|
||||
self.cover = null;
|
||||
});
|
||||
this.typeService.getSubSeries(this.type_id, ["id", "name"])
|
||||
.then(function(response) {
|
||||
|
@ -3,130 +3,144 @@
|
||||
Upload Media
|
||||
</div>
|
||||
<div class="clear"><br/></div>
|
||||
<div class="fill-all">
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
format:
|
||||
</div>
|
||||
<div class="input">
|
||||
The format of the media permit to automatic find meta-data:<br/>
|
||||
Media series name-media universe name-sXX-eXX-my name of my media.mkv<br/>
|
||||
<b> example:</b> Captain America-Marvel-e02-The winter soldier.mkv
|
||||
</div>
|
||||
</div>
|
||||
<div class="request_raw2">
|
||||
<div class="label">
|
||||
Media:
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="file"
|
||||
(change)="onChangeFile($event.target)"
|
||||
placeholder="Select a media file"
|
||||
accept=".mkv,.webm"
|
||||
width="90%" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="request_raw2" *ngIf="mediaFile != null">
|
||||
{{mediaFile.name}}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="request_raw_table">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width:10%">
|
||||
<col style="width:80%">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="left-colomn">format:</td>
|
||||
<td class="right-colomn">
|
||||
The format of the media permit to automatic find meta-data:<br/>
|
||||
Univers:Series name-sXX-eXX-my name of my media.mkv<br/>
|
||||
<b>example:</b> Stargate:SG1-s55-e22-Asgard.mkv <br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left-colomn">Media:</td>
|
||||
<td class="right-colomn">
|
||||
<input type="file"
|
||||
(change)="onChangeFile($event.target)"
|
||||
placeholder="Select a media file"
|
||||
accept=".mkv,.webm"
|
||||
width="90%"
|
||||
multiple/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div *ngIf="mediaFile != null" class="title">
|
||||
|
||||
<div *ngIf="this.parsedElement.length != 0" class="title">
|
||||
Meta-data:
|
||||
</div>
|
||||
<div class="clear"><br/></div>
|
||||
<div *ngIf="mediaFile != null" class="fill-all">
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
Type:
|
||||
</div>
|
||||
<div class="input" element.value>
|
||||
<select [ngModel]="type_id"
|
||||
(ngModelChange)="onChangeType($event)"
|
||||
[class.error]="type_id == null">
|
||||
<option *ngFor="let element of listType" [ngValue]="element.value">{{element.label}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div *ngIf="this.parsedElement.length != 0" class="fill-all">
|
||||
<div class="request_raw_table">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width:10%">
|
||||
<col style="width:70%">
|
||||
<col style="width:10%">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="left-colomn">Type:</td>
|
||||
<td class="right-colomn">
|
||||
<select [ngModel]="type_id"
|
||||
(ngModelChange)="onChangeType($event)"
|
||||
[class.error]="type_id == null">
|
||||
<option *ngFor="let element of listType" [ngValue]="element.value">{{element.label}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left-colomn">Universe:</td>
|
||||
<td class="right-colomn">
|
||||
<input type="text"
|
||||
placeholder="Universe of the Media"
|
||||
[value]="global_universe"
|
||||
(input)="onUniverse($event.target.value)"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left-colomn">Series:</td>
|
||||
<td class="right-colomn">
|
||||
<input type="text"
|
||||
placeholder="Series of the Media"
|
||||
[value]="global_series"
|
||||
(input)="onSeries($event.target.value)"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left-colomn"></td>
|
||||
<td class="right-colomn">
|
||||
<select [ngModel]="series_id"
|
||||
(ngModelChange)="onChangeSeries($event)">
|
||||
<option *ngFor="let element of listSeries" [ngValue]="element.value">{{element.label}}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="tool-colomn">
|
||||
<!--
|
||||
<button class="button color-button-normal color-shadow-black" (click)="newSeries()" type="submit">
|
||||
<i class="material-icons">add_circle_outline</i>
|
||||
</button>
|
||||
-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left-colomn">Season:</td>
|
||||
<td class="right-colomn">
|
||||
<input type="number"
|
||||
pattern="[0-9]{0-4}"
|
||||
placeholder="season of the Media"
|
||||
[value]="global_season"
|
||||
(input)="onSeason($event.target.value)"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
Universe:
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="text"
|
||||
placeholder="Universe of the Media"
|
||||
[value]="parse_universe"
|
||||
(input)="onUniverse($event.target.value)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
Series:
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="text"
|
||||
placeholder="Series of the Media"
|
||||
[value]="parse_series"
|
||||
(input)="onSeries($event.target.value)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="request_raw">
|
||||
<div class="label label2">
|
||||
==>
|
||||
</div>
|
||||
<div class="input input2">
|
||||
<select [ngModel]="series_id"
|
||||
(ngModelChange)="onChangeSeries($event)">
|
||||
<option *ngFor="let element of listSeries" [ngValue]="element.value">{{element.label}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- <div class="input_add">
|
||||
<button class="button color-button-normal color-shadow-black" (click)="newSeries()" type="submit">
|
||||
<i class="material-icons">add_circle_outline</i>
|
||||
</button>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
Season:
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="number"
|
||||
pattern="[0-9]{0-4}"
|
||||
placeholder="season of the Media"
|
||||
[value]="parse_season"
|
||||
(input)="onSeason($event.target.value)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
Episode:
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="number"
|
||||
pattern="[0-9]{0-4}"
|
||||
placeholder="Episode of the Media"
|
||||
[value]="parse_episode"
|
||||
(input)="onEpisode($event.target.value)"
|
||||
/>
|
||||
</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 class="clear"></div>
|
||||
<div class="request_raw_table">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width:10%">
|
||||
<col style="width:70%">
|
||||
<col style="width:10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Episode ID:</th>
|
||||
<th>Episode Title:</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of this.parsedElement">
|
||||
<td class="left-colomn">
|
||||
<input type="number"
|
||||
pattern="[0-9]{0-4}"
|
||||
placeholder="e?"
|
||||
[value]="data.episode"
|
||||
(input)="onEpisode(data, $event.target.value)"
|
||||
/>
|
||||
</td>
|
||||
<td class="right-colomn" >
|
||||
<input type="text"
|
||||
placeholder="Name of the Media"
|
||||
[value]="data.title"
|
||||
(input)="onTitle(data, $event.target.value)"
|
||||
[class.error]="data.title == ''"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="send_value">
|
||||
@ -137,9 +151,34 @@
|
||||
<i class="material-icons">cloud_upload</i> Upload
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div *ngIf="this.parsedElement.length != 0" class="fill-all">
|
||||
<div class="request_raw_table">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width:10%">
|
||||
<col style="width:80%">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<!-- no need
|
||||
<tr *ngFor="let data of this.parsedElement">
|
||||
<td class="left-colomn">Keep:</td>
|
||||
<td class="right-colomn">
|
||||
{{data.file.name}}
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
<tr *ngFor="let data of this.parsedFaledElement">
|
||||
<td class="left-colomn">Rejected:</td>
|
||||
<td class="right-colomn">
|
||||
{{data.file.name}}<br/> ==> {{data.reason}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<upload-progress [mediaTitle]="upload.labelMediaTitle"
|
||||
[mediaUploaded]="upload.mediaSendSize"
|
||||
|
@ -38,6 +38,47 @@ d.fill-all{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.request_raw_table {
|
||||
display: block;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
table {
|
||||
width: 100%;
|
||||
th {
|
||||
text-align: left;
|
||||
}
|
||||
.left-colomn {
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
input {
|
||||
width: 95%;
|
||||
font-size: 20px;
|
||||
border: 0px;
|
||||
}
|
||||
}
|
||||
.right-colomn {
|
||||
input {
|
||||
width: 95%;
|
||||
font-size: 20px;
|
||||
border: 0px;
|
||||
}
|
||||
select {
|
||||
width: 95%;
|
||||
font-size: 20px;
|
||||
border: 0px;
|
||||
}
|
||||
}
|
||||
.tool-colomn {
|
||||
|
||||
}
|
||||
}
|
||||
.error {
|
||||
border-color: rgba(200,0,0,1.0);
|
||||
background-color: rgba(256,220,220,1.0);
|
||||
}
|
||||
}
|
||||
|
||||
.request_raw {
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
@ -49,6 +90,26 @@ d.fill-all{
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
||||
.input2 {
|
||||
width: 75%;
|
||||
float: left;
|
||||
display: block;
|
||||
.number-input {
|
||||
clear: none;
|
||||
width: 75px;
|
||||
font-size: 20px;
|
||||
border: 0px;
|
||||
}
|
||||
.title-input {
|
||||
width: calc(100% - 75px);
|
||||
font-size: 20px;
|
||||
border: 0px;
|
||||
}
|
||||
.error {
|
||||
border-color: rgba(200,0,0,1.0);
|
||||
background-color: rgba(256,220,220,1.0);
|
||||
}
|
||||
}
|
||||
.input {
|
||||
width: 75%;
|
||||
float: left;
|
||||
|
@ -22,14 +22,31 @@ import { ArianeService } from '../../service/ariane';
|
||||
import { UploadProgress } from '../../popin/upload-progress/upload-progress';
|
||||
|
||||
export class ElementList {
|
||||
value: number;
|
||||
label: string;
|
||||
constructor(_value: number, _label: string) {
|
||||
this.value = _value;
|
||||
this.label = _label;
|
||||
constructor(
|
||||
public value: number,
|
||||
public label: string) {
|
||||
// nothing to do.
|
||||
}
|
||||
}
|
||||
export class FileParsedElement {
|
||||
public isSended: false;
|
||||
constructor(
|
||||
public file: File,
|
||||
public universe: string,
|
||||
public series: string,
|
||||
public season: number,
|
||||
public episode: number,
|
||||
public title: string) {
|
||||
// nothiing to do.
|
||||
}
|
||||
}
|
||||
export class FileFailParsedElement {
|
||||
constructor(
|
||||
public file: File,
|
||||
public reason: string) {
|
||||
// nothiing to do.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-video-edit',
|
||||
@ -44,7 +61,9 @@ export class UploadScene implements OnInit {
|
||||
|
||||
error: string = "";
|
||||
|
||||
mediaFile: File = null;
|
||||
mediaFile: File[] = null;
|
||||
parsedElement: FileParsedElement[] = [];
|
||||
parsedFaledElement: FileFailParsedElement[] = [];
|
||||
upload_file_value: string = ""
|
||||
selectedFiles: FileList;
|
||||
type_id: number = null
|
||||
@ -56,8 +75,6 @@ export class UploadScene implements OnInit {
|
||||
// section tha define the upload value to display in the pop-in of upload
|
||||
public upload:UploadProgress = new UploadProgress();
|
||||
|
||||
|
||||
|
||||
listType: ElementList[] = [
|
||||
{ value: null, label: '---' },
|
||||
];
|
||||
@ -90,11 +107,9 @@ export class UploadScene implements OnInit {
|
||||
listSeason: ElementList[] = [
|
||||
{ value: null, label: '---' },
|
||||
];
|
||||
parse_universe: string = "";
|
||||
parse_series: string = "";
|
||||
parse_season: number = null;
|
||||
parse_episode: number = null;
|
||||
parse_title: string = "";
|
||||
global_universe: string = "";
|
||||
global_series: string = "";
|
||||
global_season: number = null;
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private locate: Location,
|
||||
@ -115,8 +130,10 @@ export class UploadScene implements OnInit {
|
||||
return;
|
||||
}
|
||||
this.need_send = true;
|
||||
if (this.parse_title === undefined || this.parse_title === null || this.parse_title === "") {
|
||||
this.need_send = false;
|
||||
for (let iii = 0; iii< this.parsedElement.length; iii++) {
|
||||
if (this.parsedElement[iii].title === undefined || this.parsedElement[iii].title === null || this.parsedElement[iii].title === "") {
|
||||
this.need_send = false;
|
||||
}
|
||||
}
|
||||
if (this.type_id === undefined || this.type_id === null) {
|
||||
this.need_send = false;
|
||||
@ -148,54 +165,6 @@ export class UploadScene implements OnInit {
|
||||
}).catch(function (response2) {
|
||||
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
||||
});
|
||||
//this.seriesService.getOrder()
|
||||
/*
|
||||
this.seriesService.getData()
|
||||
.then(function (response3) {
|
||||
for (let iii = 0; iii < response3.length; iii++) {
|
||||
self.listSeries.push({ value: response3[iii].id, label: response3[iii].name });
|
||||
//console.log("Get series: " + response3[iii].id + ", label:" + response3[iii].name)
|
||||
}
|
||||
}).catch(function (response3) {
|
||||
console.log("get response3 : " + JSON.stringify(response3, null, 2));
|
||||
});
|
||||
*/
|
||||
/*
|
||||
this.videoService.get(this.id_video)
|
||||
.then(function (response) {
|
||||
console.log("get response of video : " + JSON.stringify(response, null, 2));
|
||||
self.data.name = response.name;
|
||||
self.data.description = response.description;
|
||||
self.data.episode = response.episode;
|
||||
self.data.universe_id = response.univers_id;
|
||||
self.data.data_id = response.data_id;
|
||||
self.data.time = response.time;
|
||||
self.data.generated_name = response.generated_name;
|
||||
self.onChangeType(response.type_id);
|
||||
self.onChangeSeries(response.series_id);
|
||||
self.data.season_id = response.season_id;
|
||||
self.data_ori = self.data.clone();
|
||||
if (response.covers !== undefined && response.covers !== null) {
|
||||
for (let iii = 0; iii < response.covers.length; iii++) {
|
||||
self.data.covers.push(response.covers[iii]);
|
||||
self.covers_display.push({
|
||||
id: response.covers[iii],
|
||||
url: self.videoService.getCoverUrl(response.covers[iii])
|
||||
});
|
||||
}
|
||||
} else {
|
||||
self.covers_display = []
|
||||
}
|
||||
self.updateNeedSend();
|
||||
console.log("covers_list : " + JSON.stringify(self.covers_display, null, 2));
|
||||
}).catch(function (response) {
|
||||
self.error = "Can not get the data";
|
||||
self.data = new DataToSend();
|
||||
self.covers_display = [];
|
||||
self.data_ori = self.data.clone();
|
||||
self.updateNeedSend();
|
||||
});
|
||||
*/
|
||||
console.log(" END INIT ");
|
||||
}
|
||||
|
||||
@ -234,7 +203,7 @@ export class UploadScene implements OnInit {
|
||||
} else {
|
||||
for (let iii = 0 ; iii<this.listSeries.length ; iii++) {
|
||||
if (this.listSeries[iii].value == _value) {
|
||||
this.parse_series = this.listSeries[iii].label;
|
||||
this.global_series = this.listSeries[iii].label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -242,31 +211,31 @@ export class UploadScene implements OnInit {
|
||||
this.updateNeedSend();
|
||||
}
|
||||
onSeason (_value: any): void {
|
||||
this.parse_season = _value;
|
||||
this.global_season = _value;
|
||||
//console.log("change episode ID: " + _value + " ==> " + this.parse_season.toString());
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
onTitle (_value: any): void {
|
||||
this.parse_title = _value;
|
||||
onTitle (data: FileParsedElement, _value: any): void {
|
||||
data.title = _value;
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
onUniverse (_value: any): void {
|
||||
this.parse_universe = _value;
|
||||
this.global_universe = _value;
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
onEpisode (_value: any): void {
|
||||
this.parse_episode = _value;
|
||||
onEpisode (data: FileParsedElement, _value: any): void {
|
||||
data.episode = _value;
|
||||
//console.log("change episode ID: " + _value + " ==> " + this.parse_episode.toString());
|
||||
this.updateNeedSend();
|
||||
}
|
||||
onSeries (_value: any): void {
|
||||
this.parse_series = _value;
|
||||
this.global_series = _value;
|
||||
let self = this;
|
||||
if (this.parse_series != "") {
|
||||
this.seriesService.getLike(this.parse_series)
|
||||
if (this.global_series != "") {
|
||||
this.seriesService.getLike(this.global_series)
|
||||
.then(function(response: any[]) {
|
||||
console.log("find element: " + response.length);
|
||||
for (let iii = 0; iii<response.length; iii++) {
|
||||
@ -285,31 +254,13 @@ export class UploadScene implements OnInit {
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
sendFile(): void {
|
||||
console.log("Send file requested ... " + this.mediaFile);
|
||||
this.uploadFile(this.mediaFile);
|
||||
}
|
||||
|
||||
// At the drag drop area
|
||||
// (drop)="onDropFile($event)"
|
||||
onDropFile (_event: DragEvent) {
|
||||
_event.preventDefault();
|
||||
this.uploadFile(_event.dataTransfer.files[0]);
|
||||
}
|
||||
|
||||
// At the drag drop area
|
||||
// (dragover)="onDragOverFile($event)"
|
||||
onDragOverFile (_event) {
|
||||
_event.stopPropagation();
|
||||
_event.preventDefault();
|
||||
}
|
||||
|
||||
clearData() {
|
||||
this.parse_universe = "";
|
||||
this.parse_series = "";
|
||||
this.parse_season = null;
|
||||
this.parse_episode = null;
|
||||
this.parse_title = "";
|
||||
this.global_universe = "";
|
||||
this.global_series = "";
|
||||
this.global_season = null;
|
||||
this.parsedElement = [];
|
||||
this.parsedFaledElement = [];
|
||||
|
||||
this.type_id = null;
|
||||
this.series_id = null;
|
||||
@ -317,54 +268,61 @@ export class UploadScene implements OnInit {
|
||||
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.clearData();
|
||||
|
||||
console.log("select file " + this.mediaFile.name);
|
||||
const splitElement = this.mediaFile.name.split('-');
|
||||
addFileWithMetaData(file: File) {
|
||||
//parsedElement: FileParsedElement[] = [];
|
||||
let universe: string = null;
|
||||
let series: string = null;
|
||||
let season: number | null = null;
|
||||
let episode: number | null = null;
|
||||
let title: string = "";
|
||||
|
||||
console.log("select file " + file.name);
|
||||
let tmpName = file.name.replace(/[ \t]*-[ \t]*/g,'-');
|
||||
tmpName = tmpName.replace(/[Ss]([0-9]+)[- \t]+[Ee]([0-9]+)/g,'-s$1-e$2-');
|
||||
tmpName = tmpName.replace(/[Ee]([0-9]+)[- \t]+[Ss]([0-9]+)/g,'-s$2-e$1-');
|
||||
tmpName = tmpName.replace(/_/g,'-');
|
||||
tmpName = tmpName.replace(/--/g,'-');
|
||||
console.log("select file " + tmpName);
|
||||
const splitElement = tmpName.split('-');
|
||||
if (splitElement.length == 1) {
|
||||
this.parse_title = splitElement[0];
|
||||
title = splitElement[0];
|
||||
} else {
|
||||
if (splitElement.length>=2) {
|
||||
this.parse_series = splitElement[0];
|
||||
series = splitElement[0];
|
||||
}
|
||||
splitElement.splice(0,1);
|
||||
if (splitElement.length == 1) {
|
||||
this.parse_title = splitElement[0];
|
||||
title = splitElement[0];
|
||||
} else {
|
||||
while (splitElement.length>0) {
|
||||
let element = splitElement[0];
|
||||
let find = false;
|
||||
if (this.parse_season == null) {
|
||||
if (element.length >= 1 && (element[0] == 's' || element[0] == 'S') ) {
|
||||
if (season === null) {
|
||||
if (element.length >= 1 && (element[0] === 's' || element[0] === 'S') ) {
|
||||
element = element.substring(1);
|
||||
this.parse_season = parseInt(element, 10);
|
||||
season = parseInt(element, 10);
|
||||
find = true;
|
||||
}
|
||||
}
|
||||
if (this.parse_episode == null && find == false) {
|
||||
if (element.length >= 1 && (element[0] == 'e' || element[0] == 'E') ) {
|
||||
if (episode === null && find === false) {
|
||||
if (element.length >= 1 && (element[0] === 'e' || element[0] === 'E') ) {
|
||||
element = element.substring(1);
|
||||
this.parse_episode = parseInt(element, 10);
|
||||
episode = parseInt(element, 10);
|
||||
find = true;
|
||||
}
|
||||
}
|
||||
if (find == false) {
|
||||
if (this.parse_season == null && this.parse_episode == null) {
|
||||
if (this.parse_universe == "") {
|
||||
this.parse_universe = element;
|
||||
if (find === false) {
|
||||
if (season === null && episode === null) {
|
||||
if (universe === "") {
|
||||
universe = element;
|
||||
} else {
|
||||
this.parse_universe = this.parse_universe + "-" + element;
|
||||
universe = universe + "-" + element;
|
||||
}
|
||||
} else {
|
||||
if (this.parse_title == "") {
|
||||
this.parse_title = element;
|
||||
if (title === "") {
|
||||
title = element;
|
||||
} else {
|
||||
this.parse_title = this.parse_title + "-" + element;
|
||||
title = title + "-" + element;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -372,13 +330,82 @@ export class UploadScene implements OnInit {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isNaN(episode)) {
|
||||
episode = null;
|
||||
}
|
||||
if (isNaN(season)) {
|
||||
season = null;
|
||||
}
|
||||
// remove extention
|
||||
this.parse_title = this.parse_title.replace(new RegExp("\.(mkv|MKV|Mkv|webm|WEBM|Webm|mp4)"),"");
|
||||
title = title.replace(new RegExp("\.(mkv|MKV|Mkv|webm|WEBM|Webm|mp4)"),"");
|
||||
let tmp = new FileParsedElement(file, universe, series, season, episode, title);
|
||||
console.log("==>" + JSON.stringify(tmp));
|
||||
// add it in the list.
|
||||
this.parsedElement.push(tmp);
|
||||
}
|
||||
|
||||
|
||||
// At the file input element
|
||||
// (change)="selectFile($event)"
|
||||
onChangeFile (_value: any): void {
|
||||
this.mediaFile = [];
|
||||
for (var i = 0; i < _value.files.length; i++) {
|
||||
this.mediaFile.push(_value.files[i]);
|
||||
}
|
||||
//console.log("get files: " + JSON.stringify(tmpFileList));
|
||||
//this.selectedFiles =_value.files;
|
||||
//this.mediaFile = this.selectedFiles[0];
|
||||
this.clearData();
|
||||
|
||||
for (let iii=0; iii<_value.files.length; iii++) {
|
||||
this.addFileWithMetaData(_value.files[iii]);
|
||||
}
|
||||
// check if all global parameters are generic:
|
||||
if (this.parsedElement.length == 0) {
|
||||
this.updateNeedSend();
|
||||
return;
|
||||
}
|
||||
// we verify fith the first value to remove all unknown ...
|
||||
// clean different univers:
|
||||
for (let iii=1; iii<this.parsedElement.length; iii++) {
|
||||
console.log("check universe [" + (iii+1) + "/" + this.parsedElement.length + "] '" + this.parsedElement[0].universe + " !== " + this.parsedElement[iii].universe + "'");
|
||||
if (this.parsedElement[0].universe !== this.parsedElement[iii].universe) {
|
||||
this.parsedFaledElement.push(new FileFailParsedElement(this.parsedElement[iii].file, "Remove from list due to wrong universe value"));
|
||||
console.log("Remove from list (!= universe) : [" + (iii+1) + "/" + this.parsedElement.length + "] '" + this.parsedElement[iii].file.name + "'");
|
||||
this.parsedElement.splice(iii,1);
|
||||
iii--;
|
||||
}
|
||||
}
|
||||
// clean different series:
|
||||
for (let iii=1; iii<this.parsedElement.length; iii++) {
|
||||
console.log("check series [" + (iii+1) + "/" + this.parsedElement.length + "] '" + this.parsedElement[0].series + " !== " + this.parsedElement[iii].series + "'");
|
||||
if (this.parsedElement[0].series !== this.parsedElement[iii].series) {
|
||||
this.parsedFaledElement.push(new FileFailParsedElement(this.parsedElement[iii].file, "Remove from list due to wrong series value"));
|
||||
console.log("Remove from list (!= series) : [" + (iii+1) + "/" + this.parsedElement.length + "] '" + this.parsedElement[iii].file.name + "'");
|
||||
this.parsedElement.splice(iii,1);
|
||||
iii--;
|
||||
}
|
||||
}
|
||||
// clean different season:
|
||||
for (let iii=1; iii<this.parsedElement.length; iii++) {
|
||||
console.log("check season [" + (iii+1) + "/" + this.parsedElement.length + "] '" + this.parsedElement[0].season + " !== " + this.parsedElement[iii].season + "'");
|
||||
if (this.parsedElement[0].season !== this.parsedElement[iii].season) {
|
||||
this.parsedFaledElement.push(new FileFailParsedElement(this.parsedElement[iii].file, "Remove from list due to wrong season value"));
|
||||
console.log("Remove from list (!= season) : [" + (iii+1) + "/" + this.parsedElement.length + "] '" + this.parsedElement[iii].file.name + "'");
|
||||
this.parsedElement.splice(iii,1);
|
||||
iii--;
|
||||
}
|
||||
}
|
||||
|
||||
this.global_universe = this.parsedElement[0].universe;
|
||||
this.global_series = this.parsedElement[0].series;
|
||||
this.global_season = this.parsedElement[0].season;
|
||||
|
||||
this.updateNeedSend();
|
||||
this.series_id = null;
|
||||
let self = this;
|
||||
if (this.parse_series != "") {
|
||||
this.seriesService.getLike(this.parse_series)
|
||||
if (this.global_series != "") {
|
||||
this.seriesService.getLike(this.global_series)
|
||||
.then(function(response: any[]) {
|
||||
console.log("find element: " + response.length);
|
||||
for (let iii = 0; iii<response.length; iii++) {
|
||||
@ -397,91 +424,85 @@ export class UploadScene implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uploadFile (_file: File) {
|
||||
if (_file == undefined) {
|
||||
console.log("No file selected!");
|
||||
return;
|
||||
}
|
||||
let self = this;
|
||||
|
||||
/*
|
||||
this.parse_series = "";
|
||||
this.parse_season = null;
|
||||
this.parse_episode = null;
|
||||
this.parse_title = "";
|
||||
*/
|
||||
sendFile(): void {
|
||||
console.log("Send file requested ... " + this.mediaFile);
|
||||
this.upload = new UploadProgress();
|
||||
// add universe
|
||||
if (this.parse_universe !== null) {
|
||||
this.upload.labelMediaTitle += this.parse_universe;
|
||||
}
|
||||
// add series
|
||||
if (this.parse_series !== null) {
|
||||
if (this.upload.labelMediaTitle.length != 0) {
|
||||
this.upload.labelMediaTitle += "/";
|
||||
}
|
||||
this.upload.labelMediaTitle += this.parse_series;
|
||||
}
|
||||
// add season
|
||||
if (this.parse_season !== null && this.parse_season !== undefined && this.parse_season.toString().length != 0) {
|
||||
if (this.upload.labelMediaTitle.length != 0) {
|
||||
this.upload.labelMediaTitle += "-";
|
||||
}
|
||||
this.upload.labelMediaTitle += "s" + this.parse_season.toString();
|
||||
}
|
||||
// add episode ID
|
||||
if (this.parse_episode !== null && this.parse_episode !== undefined && this.parse_episode.toString().length != 0) {
|
||||
if (this.upload.labelMediaTitle.length != 0) {
|
||||
this.upload.labelMediaTitle += "-";
|
||||
}
|
||||
this.upload.labelMediaTitle += "e" + this.parse_episode.toString();
|
||||
}
|
||||
// add title
|
||||
if (this.upload.labelMediaTitle.length != 0) {
|
||||
this.upload.labelMediaTitle += "-";
|
||||
}
|
||||
this.upload.labelMediaTitle += this.parse_title;
|
||||
// display the upload pop-in
|
||||
this.popInService.open("popin-upload-progress");
|
||||
this.globalUpLoad(0, this.parsedElement.length);
|
||||
}
|
||||
|
||||
this.videoService.uploadFile(_file,
|
||||
this.parse_universe,
|
||||
this.parse_series,
|
||||
this.series_id,
|
||||
this.parse_season,
|
||||
this.parse_episode,
|
||||
this.parse_title,
|
||||
this.type_id,
|
||||
globalUpLoad(id: number, total: number): void {
|
||||
let self = this;
|
||||
this.uploadFile(this.parsedElement[id], id, total, () => {
|
||||
let id2 = id + 1;
|
||||
if (id2 < total) {
|
||||
self.globalUpLoad(id2, total);
|
||||
} else {
|
||||
self.upload.result = "Media creation done";
|
||||
}
|
||||
}, (value:string) => {
|
||||
self.upload.error = "Error in the upload of the data..." + value;
|
||||
});
|
||||
|
||||
}
|
||||
uploadFile (eleemnent: FileParsedElement, id: number, total: number, _sendDone: any, _errorOccured: any): void {
|
||||
let self = this;
|
||||
|
||||
self.upload.labelMediaTitle = '';
|
||||
// add universe
|
||||
if (self.global_universe !== null) {
|
||||
self.upload.labelMediaTitle += self.global_universe;
|
||||
}
|
||||
// add series
|
||||
if (self.global_series !== null) {
|
||||
if (self.upload.labelMediaTitle.length != 0) {
|
||||
self.upload.labelMediaTitle += ":";
|
||||
}
|
||||
self.upload.labelMediaTitle += self.global_series;
|
||||
}
|
||||
// add season
|
||||
if (self.global_season !== null && self.global_season !== undefined && self.global_season.toString().length != 0) {
|
||||
if (self.upload.labelMediaTitle.length != 0) {
|
||||
self.upload.labelMediaTitle += "-";
|
||||
}
|
||||
self.upload.labelMediaTitle += "s" + self.global_season.toString();
|
||||
}
|
||||
// add episode ID
|
||||
if (eleemnent.episode !== null && eleemnent.episode !== undefined && eleemnent.episode.toString().length != 0) {
|
||||
if (self.upload.labelMediaTitle.length != 0) {
|
||||
self.upload.labelMediaTitle += "-";
|
||||
}
|
||||
self.upload.labelMediaTitle += "e" + eleemnent.episode.toString();
|
||||
}
|
||||
// add title
|
||||
if (self.upload.labelMediaTitle.length != 0) {
|
||||
self.upload.labelMediaTitle += "-";
|
||||
}
|
||||
self.upload.labelMediaTitle = '[' + (id+1) + '/' + total + ']' + self.upload.labelMediaTitle + eleemnent.title;
|
||||
|
||||
self.videoService.uploadFile(eleemnent.file,
|
||||
self.global_universe,
|
||||
self.global_series,
|
||||
self.series_id,
|
||||
self.global_season,
|
||||
eleemnent.episode,
|
||||
eleemnent.title,
|
||||
self.type_id,
|
||||
function(count, total) {
|
||||
//console.log("upload : " + count*100/total);
|
||||
self.upload.mediaSendSize = count;
|
||||
self.upload.mediaSize = total;
|
||||
|
||||
})
|
||||
//console.log("upload : " + count*100/total);
|
||||
self.upload.mediaSendSize = count;
|
||||
self.upload.mediaSize = total;
|
||||
})
|
||||
.then(function (response) {
|
||||
console.log("get response of video : " + JSON.stringify(response, null, 2));
|
||||
self.upload.result = "Media creation done";
|
||||
_sendDone();
|
||||
}).catch(function (response) {
|
||||
//self.error = "Can not get the data";
|
||||
console.log("Can not add the data in the system...");
|
||||
self.upload.error = "Error in the upload of the data..." + JSON.stringify(response, null, 2);
|
||||
_errorOccured(JSON.stringify(response, null, 2));
|
||||
});
|
||||
}
|
||||
removeCover (_id) {
|
||||
console.log("Request remove cover: " + _id);
|
||||
}
|
||||
removeMedia () {
|
||||
console.log("Request remove Media...");
|
||||
this.videoService.delete(this.id_video)
|
||||
.then(function (response3) {
|
||||
//self.data_ori = tmpp;
|
||||
//self.updateNeedSend();
|
||||
}).catch(function (response3) {
|
||||
|
||||
//self.updateNeedSend();
|
||||
});
|
||||
}
|
||||
|
||||
eventPopUpSeason (_event: string): void {
|
||||
console.log("GET event: " + _event);
|
||||
|
@ -216,7 +216,7 @@ export class VideoScene implements OnInit {
|
||||
} else {
|
||||
self.video_source = "";
|
||||
}
|
||||
if (response.covers == undefined || response.covers == null || response.covers.length == 0) {
|
||||
if (response.covers === undefined || response.covers === null || response.covers.length === 0) {
|
||||
self.cover = null;
|
||||
} else {
|
||||
self.cover = self.videoService.getCoverUrl(response.covers[0]);
|
||||
|
@ -15,14 +15,10 @@
|
||||
top: 50px;
|
||||
width: 400px;
|
||||
float: left;
|
||||
//height: 400px;
|
||||
padding: 1%;
|
||||
.cover-area {
|
||||
//position:relative;
|
||||
float: right;
|
||||
//right: 0px;
|
||||
width: 100%;
|
||||
//height: 100%;
|
||||
.cover {
|
||||
align: center;
|
||||
width: 60%;
|
||||
@ -39,15 +35,8 @@
|
||||
width: 100%;
|
||||
}
|
||||
.description-area {
|
||||
//position: sticky;
|
||||
float: left;
|
||||
//height: 100%;
|
||||
//margin: 0;
|
||||
//border: solid 1px;
|
||||
//border-color: rgba(255, 0, 0, 0.7);
|
||||
|
||||
.title {
|
||||
background-color: green;
|
||||
font-size: 45px;
|
||||
font-weight: bold;
|
||||
line-height: 60px;
|
||||
|
Loading…
Reference in New Issue
Block a user