diff --git a/front/Dockerfile b/front/Dockerfile index 92823e7..6de2520 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -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 diff --git a/front/package.json b/front/package.json index d775d3c..8da9e24 100644 --- a/front/package.json +++ b/front/package.json @@ -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": { diff --git a/front/src/app/scene/type/type.ts b/front/src/app/scene/type/type.ts index 63aebf3..113e226 100644 --- a/front/src/app/scene/type/type.ts +++ b/front/src/app/scene/type/type.ts @@ -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

-
-
-
- format: -
-
- The format of the media permit to automatic find meta-data:
- Media series name-media universe name-sXX-eXX-my name of my media.mkv
- example: Captain America-Marvel-e02-The winter soldier.mkv -
-
-
-
- Media: -
-
- -
-
-
- {{mediaFile.name}} -
-
+
+ + + + + + + + + + + + + + + +
format: + The format of the media permit to automatic find meta-data:
+ Univers:Series name-sXX-eXX-my name of my media.mkv
+ example: Stargate:SG1-s55-e22-Asgard.mkv
+
Media: + +
-
+ +
Meta-data:

-
-
-
- Type: -
-
- -
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type: + +
Universe: + +
Series: + +
+ + + +
Season: + +
-
-
- Universe: -
-
- -
-
- -
-
- Series: -
-
- -
-
-
-
- ==> -
-
- -
- -
-
-
- Season: -
-
- -
-
-
-
- Episode: -
-
- -
-
-
-
- Title: -
-
- -
+
+
+ + + + + + + + + + + + + + + + + + +
Episode ID:Episode Title:
+ + + +
@@ -137,9 +151,34 @@ cloud_upload Upload
-
+
+
+ + + + + + + + + + + + +
Rejected: + {{data.file.name}}
==> {{data.reason}} +
+
+
" + 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=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 { + 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); diff --git a/front/src/app/scene/video/video.ts b/front/src/app/scene/video/video.ts index b9def2d..74f98c0 100644 --- a/front/src/app/scene/video/video.ts +++ b/front/src/app/scene/video/video.ts @@ -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]); diff --git a/front/src/generic_page.less b/front/src/generic_page.less index 5d3d728..f847a4c 100644 --- a/front/src/generic_page.less +++ b/front/src/generic_page.less @@ -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;