diff --git a/front/package.json b/front/package.json index e1f09d5..b4bcd25 100644 --- a/front/package.json +++ b/front/package.json @@ -1,7 +1,7 @@ { "name": "karusic", "version": "0.0.0", - "license": "MIT", + "license": "MPL-2", "scripts": { "all": "npm run build && npm run test", "ng": "ng", @@ -9,6 +9,7 @@ "build": "ng build --prod", "test": "ng test", "lint": "ng lint", + "style": "prettier --write .", "e2e": "ng e2e", "update_packages": "ncu --upgrade", "install_dependency": "npm install" @@ -40,4 +41,4 @@ "@angular/language-service": "^17.2.0", "npm-check-updates": "^16.14.15" } -} \ No newline at end of file +} diff --git a/front/src/app/app.component.html b/front/src/app/app.component.html index 3cb06f0..d34a6b0 100644 --- a/front/src/app/app.component.html +++ b/front/src/app/app.component.html @@ -1,15 +1,17 @@ -
+
+@if(autoConnectedDone) { -
-
+} +@else {
Auto-connection in progress
+}
diff --git a/front/src/app/component/element-series/element-series.html b/front/src/app/component/element-series/element-series.html index 557d0b0..0e754c1 100644 --- a/front/src/app/component/element-series/element-series.html +++ b/front/src/app/component/element-series/element-series.html @@ -20,9 +20,4 @@
{{name}}
-
\ No newline at end of file diff --git a/front/src/app/component/element-track/element-track.html b/front/src/app/component/element-track/element-track.html index da7dc1a..30aae15 100644 --- a/front/src/app/component/element-track/element-track.html +++ b/front/src/app/component/element-track/element-track.html @@ -2,7 +2,9 @@
{{name}}
-
- n° {{track}} -
+ @if(track) { +
+ n° {{track}} +
+ } \ No newline at end of file diff --git a/front/src/app/component/element-type/element-type.html b/front/src/app/component/element-type/element-type.html index ebc4865..04b129a 100644 --- a/front/src/app/component/element-type/element-type.html +++ b/front/src/app/component/element-type/element-type.html @@ -1,7 +1,9 @@
-
- {{counttrack}} -
+ @if(counttrack) { +
+ {{counttrack}} +
+ }
@if(covers && covers.length > 0) {
@@ -12,7 +14,9 @@
{{name}}
-
- {{description}} -
+ @if(description) { +
+ {{description}} +
+ }
\ No newline at end of file diff --git a/front/src/app/component/element-video/element-video.html b/front/src/app/component/element-video/element-video.html index f1cd526..270f026 100644 --- a/front/src/app/component/element-video/element-video.html +++ b/front/src/app/component/element-video/element-video.html @@ -10,15 +10,14 @@
}
-
- {{episodeDisplay}} {{name}} -
-
- Error meda: {{element?.id}} -
- + @if(data) { +
+ {{episodeDisplay}} {{name}} +
+ } + @else { +
+ Error meda: {{element?.id}} +
+ }
diff --git a/front/src/app/scene/album-edit/album-edit.html b/front/src/app/scene/album-edit/album-edit.html index e9f5587..2c7cfed 100644 --- a/front/src/app/scene/album-edit/album-edit.html +++ b/front/src/app/scene/album-edit/album-edit.html @@ -2,146 +2,160 @@
Edit album
-
-
-


- The album has been removed -


-
-
-
-
-


- The album does not exist -


-
-
-
-
-


- Loading ...
- Please wait. -


-
-
-
-
-
- name: -
-
- + @if(itemIsRemoved) { +
+
+


+ The album has been removed +


- -
-
- Description: -
-
- -
-
-
- -
-
-
- -
- Covers -
-
-
- -
-
-
-
-
- + +
+
+ Description: +
+
+ +
+
+
+ +
+
+
+ +
+ Covers +
+
+
+ +
+
+
+ @for (element of coversDisplay; track element.id;) { +
+
+ +
+
+ +
+
+ } +
+
+
+
+ +
+
+
+
+
+
+ +
+ Administration +
+
+
+
+ data_usage ID: +
+
+ {{idAlbum}} +
+
+
+
+
+ Tracks: +
+
+ {{trackCount}} +
+
+
+
+
+ delete_forever Trash: +
+ @if(trackCount == '0') { +
+
-
-
-
+ } + @else { +
+ new_releases Can not remove album, track depending on it
-
- -
-
+ }
+
-
-
- -
- Administration -
-
-
-
- data_usage ID: -
-
- {{idAlbum}} -
-
-
-
-
- Tracks: -
-
- {{trackCount}} -
-
-
-
-
- delete_forever Trash: -
-
- -
-
- new_releases Can not remove album, track depending on it -
-
-
-
+ }
-
-
-
Album{{albums.length > 1?"s":""}}:
-
- + @if(albums) { +
+
+
Album{{albums.length > 1?"s":""}}:
+ @for (data of albums; track data.id;) { +
+ +
+ }
-
+ } @if(tracks) {
diff --git a/front/src/app/scene/artist-edit/artist-edit.html b/front/src/app/scene/artist-edit/artist-edit.html index c9ef96a..9c9e63d 100644 --- a/front/src/app/scene/artist-edit/artist-edit.html +++ b/front/src/app/scene/artist-edit/artist-edit.html @@ -2,153 +2,169 @@
Edit artist
-
-
-


- The artist has been removed -


-
-
-
-
-


- The artist does not exist -


-
-
-
-
-


- Loading ...
- Please wait. -


-
-
-
-
-
- Type: -
-
- + @if(itemIsRemoved) { +
+
+


+ The artist has been removed +


-
-
- Name: -
-
- + } + @else if (itemIsNotFound) { +
+
+


+ The artist does not exist +


-
-
- Description: -
-
- + } + @else if (itemIsLoading) { +
+
+


+ Loading ...
+ Please wait. +


-
-
- -
-
-
- -
- Covers -
-
-
- -
-
-
-
-
- -
-
- -
+ } + @else { +
+
+
+ Type:
-
-
-
-
- +
+ +
+
+
+
+ Name: +
+
+ +
+
+
+
+ Description: +
+
+ +
+
+
+
+ +
+
+
+ +
+ Covers +
+
+
+ +
+
+
+ @for (element of coversDisplay; track element.id;) { +
+
+ +
+
+ +
+
+ } +
+
+
+
+ +
+
-
-
- -
- Administration -
-
-
-
- data_usage ID: -
-
- {{idArtist}} -
+ +
+ Administration
-
-
-
- Albums: +
+
+
+ data_usage ID: +
+
+ {{idArtist}} +
-
- {{albumsCount}} +
+
+
+ Albums: +
+
+ {{albumsCount}} +
+
+
+
+ Tracks: +
+
+ {{trackCount}} +
+
+
+
+
+ delete_forever Trash: +
+ @if(trackCount == '0' && albumsCount == '0') { +
+ +
+ } + @else { +
+ new_releases Can not remove album or track depending on it +
+ } +
+
-
-
-
- Tracks: -
-
- {{trackCount}} -
-
-
-
-
- delete_forever Trash: -
-
- -
-
- new_releases Can not remove album or track depending on it -
-
-
-
+ }
-
-
-
Track{{tracks.length > 1?"s":""}}:
- @for (data of tracks; track data.id;) { - - } @empty { - Aucune piste accessible. - } -
+ @if(tracks) { +
+
+
Track{{tracks.length > 1?"s":""}}:
+ @for (data of tracks; track data.id;) { + + } @empty { + Aucune piste accessible. + } +
+ }
\ No newline at end of file diff --git a/front/src/app/scene/artist/artist.html b/front/src/app/scene/artist/artist.html index 8293c61..330cddf 100644 --- a/front/src/app/scene/artist/artist.html +++ b/front/src/app/scene/artist/artist.html @@ -9,24 +9,28 @@
Album{{albums.length > 1?"s":""}}:
-
- -
+ @for (data of albums; track data.id;) { +
+ +
+ }
} @if(tracks) {
Track{{tracks.length > 1?"s":""}}:
-
- -
+ @for (data of tracks; track data.id;) { +
+ +
+ }
}
diff --git a/front/src/app/scene/artist/artists.html b/front/src/app/scene/artist/artists.html index 9740155..090a718 100644 --- a/front/src/app/scene/artist/artists.html +++ b/front/src/app/scene/artist/artists.html @@ -5,20 +5,22 @@ [cover1]="covers" (play)="playAll()" (shuffle)="playShuffle()"/> -
-
-
Artist{{artists.length > 1?"s":""}}:
- @for (data of artists; track data.id;) { -
- -
- } -
+ @if(artists) { +
+
+
Artist{{artists.length > 1?"s":""}}:
+ @for (data of artists; track data.id;) { +
+ +
+ } +
+ }
\ No newline at end of file diff --git a/front/src/app/scene/gender/gender.html b/front/src/app/scene/gender/gender.html index b635be2..7d7f4f6 100644 --- a/front/src/app/scene/gender/gender.html +++ b/front/src/app/scene/gender/gender.html @@ -11,9 +11,11 @@
{{name}}
-
- {{description}} -
+ @if(description) { +
+ {{description}} +
+ }
diff --git a/front/src/app/scene/track-edit/track-edit.html b/front/src/app/scene/track-edit/track-edit.html index fe69d54..b89e014 100644 --- a/front/src/app/scene/track-edit/track-edit.html +++ b/front/src/app/scene/track-edit/track-edit.html @@ -2,148 +2,161 @@
Edit Media
-
-
-


- The media has been removed -


-
-
-
-
-


- The media does not exist -


-
-
-
-
-


- Loading ...
- Please wait. -


-
-
- -
-
-
- Title: -
-
- + @if(itemIsRemoved) { +
+
+


+ The media has been removed +


-
-
- description Description: -
-
- - + } + @else if (itemIsNotFound) { +
+
+


+ The media does not exist +


-
-
- Gender: -
-
- -
-
- + } + @else if (itemIsLoading) { +
+
+


+ Loading ...
+ Please wait. +


-
-
- Artist: + } + @else { +
+
+
+ Title: +
+
+ +
-
- +
+
+ description Description: +
+
+ + +
-
- +
+
+ Gender: +
+
+ +
+
+ +
+
+
+ Artist: +
+
+ +
+
+ +
+
+
+
+ Album: +
+
+ +
+
+ +
+
+
+
+ Track n°: +
+
+ +
+
+
+ +
+
-
-
- Album: -
-
- -
-
- -
+ +
+ Administration
-
-
- Track n°: +
+
+
+ data_usage ID: +
+
+ {{data.dataId}} +
-
- +
+
+
+ delete_forever Trash: +
+
+ +
+
-
- -
-
-
- -
- Administration -
-
-
-
- data_usage ID: -
-
- {{data.dataId}} -
-
-
-
-
- delete_forever Trash: -
-
- -
-
-
-
+ }
diff --git a/front/src/app/scene/track/track.html b/front/src/app/scene/track/track.html index 4263721..31178f6 100644 --- a/front/src/app/scene/track/track.html +++ b/front/src/app/scene/track/track.html @@ -1,17 +1,21 @@
-
-
- Play media




- The media does not exist + @if(mediaIsNotFound) { +
+
+ Play media




+ The media does not exist +
-
-
-
- Play media




- Loading ...
- Please wait. + } + @if(mediaIsLoading) { +
+
+ Play media




+ Loading ...
+ Please wait. +
-
+ } @if(!mediaIsNotFound && !mediaIsLoading && !playTrack) {
@@ -20,7 +24,7 @@
@if (covers && covers.length > 0) { -
+
} @@ -134,15 +138,16 @@ }
} - -
- {{generatedName}} -
-
- -
+ @if(!isFullScreen || !isPlaying) { +
+ {{generatedName}} +
+
+ +
+ } @if (displayVolumeMenu && (!displayNeedHide || !isPlaying)) {
diff --git a/front/src/app/scene/upload/upload.html b/front/src/app/scene/upload/upload.html index 26c466c..5caffc5 100644 --- a/front/src/app/scene/upload/upload.html +++ b/front/src/app/scene/upload/upload.html @@ -63,7 +63,9 @@ @@ -89,7 +91,9 @@ @@ -115,7 +119,9 @@ @@ -144,36 +150,40 @@ - - - - - - + + - - ^^^This title already exist !!! - - - - - - + + + + @if(data.nameDetected === true) { + + ^^^This title already exist !!! + + } + + + + + + }
@@ -187,27 +197,31 @@
-
- - - - - - - - - - - - - - - - - - -
Track ID:Title:
{{data.episode}}{{data.name}}
-
+ @if(listFileInBdd) { +
+ + + + + + + + + + + + + + @for (data of listFileInBdd; track data.id;) { + + + + + } + +
Track ID:Title:
{{data.episode}}{{data.name}}
+
+ }
} @if(parsedElement.length !== 0) { @@ -219,20 +233,14 @@ - - - Rejected: - - {{data.file.name}}
==> {{data.reason}} - - + @for (data of parsedFailedElement; track data.id;) { + + Rejected: + + {{data.file.name}}
==> {{data.reason}} + + + }
diff --git a/front/src/app/scene/upload/upload.ts b/front/src/app/scene/upload/upload.ts index 25fe989..7db1b64 100644 --- a/front/src/app/scene/upload/upload.ts +++ b/front/src/app/scene/upload/upload.ts @@ -6,7 +6,7 @@ import { Component, OnInit } from '@angular/core'; -import { GenderService, ArtistService, TrackService, ArianeService, AlbumService } from 'app/service'; +import { GenderService, ArtistService, TrackService, AlbumService } from 'app/service'; import { NodeData } from 'common/model'; import { UploadProgress } from 'common/popin/upload-progress/upload-progress'; import { PopInService } from 'common/service'; @@ -22,28 +22,29 @@ export class ElementList { export class FileParsedElement { public isSended: boolean = false; public nameDetected: boolean = false; - public episodeDetected: boolean = false;s + public trackIdDetected: boolean = false; s constructor( public file: File, public artist: string, public album: string, public trackId: number, public title: string) { - // nothiing to do. + // nothing to do. } } export class FileFailParsedElement { constructor( + public id: number, public file: File, public reason: string) { - // nothiing to do. + // nothing to do. } } @Component({ selector: 'app-track-edit', templateUrl: './upload.html', - styleUrls: [ './upload.less' ] + styleUrls: ['./upload.less'] }) export class UploadScene implements OnInit { @@ -56,11 +57,11 @@ export class UploadScene implements OnInit { albumId: number = null; needSend: boolean = false; - // list of all files already registered in the bdd to compare with the curent list of files. + // list of all files already registered in the bdd to compare with the current list of files. listFileInBdd: any[] = undefined; // section tha define the upload value to display in the pop-in of upload - public upload:UploadProgress = new UploadProgress(); + public upload: UploadProgress = new UploadProgress(); listGender: ElementList[] = [ { value: null, label: '---' }, @@ -74,19 +75,19 @@ export class UploadScene implements OnInit { /* config = { - displayKey: "label", // if objects array passed which key to be displayed defaults to description - search: true, - limitTo: 3, + displayKey: "label", // if objects array passed which key to be displayed defaults to description + search: true, + limitTo: 3, }; */ config = { displayKey: 'description', // if objects array passed which key to be displayed defaults to description - search: true, // true/false for the search functionlity defaults to false, + search: true, // true/false for the search functionality defaults to false, height: 'auto', // height of the list so that if there are more no of items it can show a scroll defaults to auto. With auto height scroll will never appear placeholder: 'Select', // text to be displayed when no item is selected defaults to Select, - customComparator: () => {}, // a custom function using which user wants to sort the items. default is undefined and Array.sort() will be used in that case, + customComparator: () => { }, // a custom function using which user wants to sort the items. default is undefined and Array.sort() will be used in that case, limitTo: 10, // number thats limits the no of options displayed in the UI (if zero, options will not be limited) - moreText: 'more', // text to be displayed whenmore than one items are selected like Option 1 + 5 more + moreText: 'more', // text to be displayed when more than one items are selected like Option 1 + 5 more noResultsFound: 'No results found!', // text to be displayed when no items are found while searching searchPlaceholder: 'Search', // label thats displayed in search input, searchOnKey: 'description', // key on which search should be performed this will be selective search. if undefined this will be extensive search on all keys @@ -99,51 +100,45 @@ export class UploadScene implements OnInit { private artistService: ArtistService, private albumService: AlbumService, private trackService: TrackService, - private arianeService: ArianeService, private popInService: PopInService) { // nothing to do. } updateNeedSend(): boolean { - if(this.parsedElement.length === 0) { + if (this.parsedElement.length === 0) { this.needSend = false; return; } this.needSend = true; - for(let iii = 0; iii < this.parsedElement.length; iii++) { - if(isNullOrUndefined(this.parsedElement[iii].title) || this.parsedElement[iii].title === '') { + for (let iii = 0; iii < this.parsedElement.length; iii++) { + if (isNullOrUndefined(this.parsedElement[iii].title) || this.parsedElement[iii].title === '') { this.needSend = false; } } - /* - if(isNullOrUndefined(this.genderId)) { - this.needSend = false; - } - */ return this.needSend; } ngOnInit() { let self = this; - this.listGender = [ { value: null, label: '---' } ]; - this.listArtist = [ { value: null, label: '---' } ]; - this.listAlbum = [ { value: null, label: '---' } ]; + this.listGender = [{ value: null, label: '---' }]; + this.listArtist = [{ value: null, label: '---' }]; + this.listAlbum = [{ value: null, label: '---' }]; this.artistService.getOrder() .then((response2) => { - for(let iii = 0; iii < response2.length; iii++) { + for (let iii = 0; iii < response2.length; iii++) { self.listArtist.push({ value: response2[iii].id, label: response2[iii].name }); } }).catch((response2) => { - console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`); + console.log(`get response22 : ${JSON.stringify(response2, null, 2)}`); }); this.genderService.getOrder() .then((response2: NodeData[]) => { //console.error(`Keep gender : ${ JSON.stringify(response2, null, 2)} ==> ${response2.length}`); - for(let iii = 0; iii < response2.length; iii++) { + for (let iii = 0; iii < response2.length; iii++) { self.listGender.push({ value: response2[iii].id, label: response2[iii].name }); } }).catch((response2) => { - console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`); + console.log(`get response22 : ${JSON.stringify(response2, null, 2)}`); }); console.log(' END INIT '); } @@ -151,16 +146,16 @@ export class UploadScene implements OnInit { onGender(value: any): void { this.globalGender = value; let self = this; - if(this.globalGender !== '') { + if (this.globalGender !== '') { this.genderService.getLike(this.globalGender) .then((response: any[]) => { - console.log(`find element: ${ response.length}`); - for(let iii = 0; iii < response.length; iii++) { - console.log(` - ${ JSON.stringify(response[iii])}`); + console.log(`find element: ${response.length}`); + for (let iii = 0; iii < response.length; iii++) { + console.log(` - ${JSON.stringify(response[iii])}`); } - if(response.length === 0) { + if (response.length === 0) { self.genderId = undefined; - } else if(response.length === 1) { + } else if (response.length === 1) { self.genderId = response[0].id; } }).catch((response) => { @@ -174,9 +169,9 @@ export class UploadScene implements OnInit { onChangeGender(value: any): void { this.globalGender = value; - if(!isNullOrUndefined(value)) { - for(let iii = 0; iii < this.listGender.length; iii++) { - if(this.listGender[iii].value === value) { + if (!isNullOrUndefined(value)) { + for (let iii = 0; iii < this.listGender.length; iii++) { + if (this.listGender[iii].value === value) { this.globalGender = this.listGender[iii].label; break; } @@ -186,31 +181,31 @@ export class UploadScene implements OnInit { } private updateTheListOfAlbum() { - this.listAlbum = [ { value: null, label: '---' } ]; + this.listAlbum = [{ value: null, label: '---' }]; if (isNullOrUndefined(this.artistId)) { return; } let self = this; this.artistService.getAlbum(this.artistId) .then((response2) => { - for(let iii = 0; iii < response2.length; iii++) { + for (let iii = 0; iii < response2.length; iii++) { self.listAlbum.push({ value: response2[iii].id, label: response2[iii].name }); } }).catch((response2) => { - console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`); + console.log(`get response22 : ${JSON.stringify(response2, null, 2)}`); }); } onArtist(value: any): void { this.globalArtist = value; let self = this; - if(this.globalArtist !== '') { + if (this.globalArtist !== '') { console.log(`update artist List Element: ${this.globalArtist}`); this.artistService.getLike(this.globalArtist) .then((response: any[]) => { - console.log(` ==> find artist like ${this.globalArtist} : ${ JSON.stringify(response, null, 2)}`); - if(response.length === 0) { + console.log(` ==> find artist like ${this.globalArtist} : ${JSON.stringify(response, null, 2)}`); + if (response.length === 0) { self.artistId = undefined; - } else if(response.length === 1) { + } else if (response.length === 1) { self.artistId = response[0].id; self.updateTheListOfAlbum(); } @@ -220,7 +215,7 @@ export class UploadScene implements OnInit { self.updateListOfTrackToCheck(); } }).catch((response) => { - console.log(` ==> CAN NOT find artist like ${this.globalArtist} : ${ response.length}`); + console.log(` ==> CAN NOT find artist like ${this.globalArtist} : ${response.length}`); self.artistId = undefined; }); } @@ -228,9 +223,9 @@ export class UploadScene implements OnInit { } onChangeArtist(value: any): void { this.artistId = value; - if(!isNullOrUndefined(value)) { - for(let iii = 0; iii < this.listArtist.length; iii++) { - if(this.listArtist[iii].value === value) { + if (!isNullOrUndefined(value)) { + for (let iii = 0; iii < this.listArtist.length; iii++) { + if (this.listArtist[iii].value === value) { this.globalArtist = this.listArtist[iii].label; break; } @@ -250,18 +245,19 @@ export class UploadScene implements OnInit { data.title = value; this.updateNeedSend(); } - removeElmentFromList(data: FileParsedElement, value: any): void { - for(let iii = 0; iii < this.parsedElement.length; iii++) { - if(this.parsedElement[iii] === data) { + + removeElementFromList(data: FileParsedElement, value: any): void { + for (let iii = 0; iii < this.parsedElement.length; iii++) { + if (this.parsedElement[iii] === data) { this.parsedElement.splice(iii, 1); break; } } - this.parsedFailedElement.push(new FileFailParsedElement(data.file, 'Removed by user.')); + this.parsedFailedElement.push(new FileFailParsedElement(this.parsedFailedElement.length, data.file, 'Removed by user.')); this.updateNeedSend(); } - onEpisode(data: FileParsedElement, value: any): void { + onTrackId(data: FileParsedElement, value: any): void { data.trackId = value; // console.log("change episode ID: " + value + " ==> " + this.parseEpisode.toString()); this.updateNeedSend(); @@ -281,7 +277,7 @@ export class UploadScene implements OnInit { this.artistId = null; this.albumId = null; //this.listGender = [ { value: null, label: '---' } ]; - this.listAlbum = [ { value: null, label: '---' } ]; + this.listAlbum = [{ value: null, label: '---' }]; } addFileWithMetaData(file: File) { @@ -291,38 +287,38 @@ export class UploadScene implements OnInit { let trackIdNumber: number | null = undefined; let title: string = ''; - console.log(`select file ${ file.name}`); + console.log(`select file ${file.name}`); let tmpName = file.name.replace(/[ \t]*-[ \t]*/g, '-'); //tmpName = tmpName.replace(/_/g, '-'); //tmpName = tmpName.replace(/--/g, '-'); - console.log(`select file ${ tmpName}`); + console.log(`select file ${tmpName}`); const splitElement = tmpName.split('~'); - if(splitElement.length > 1) { + if (splitElement.length > 1) { artist = splitElement[0]; - tmpName = tmpName.substring(artist.length+1); + tmpName = tmpName.substring(artist.length + 1); } const splitElement2 = tmpName.split('\#'); - if(splitElement2.length > 1) { + if (splitElement2.length > 1) { album = splitElement2[0]; - tmpName = tmpName.substring(album.length+1); + tmpName = tmpName.substring(album.length + 1); } //console.log("ploppppp " + tmpName); const splitElement3 = tmpName.split('-'); - if(splitElement3.length > 1) { + if (splitElement3.length > 1) { trackIdNumber = parseInt(splitElement3[0], 10); - tmpName = tmpName.substring(splitElement3[0].length+1); + tmpName = tmpName.substring(splitElement3[0].length + 1); } //console.log("KKKppppp " + tmpName); //console.log(" ===> " + splitElement3[0]); title = tmpName; - - if(isNaN(trackIdNumber)) { + + if (isNaN(trackIdNumber)) { trackIdNumber = undefined; } // remove extention title = title.replace(new RegExp('\\.(webm|WEBM|Webm)'), ''); let tmp = new FileParsedElement(file, artist, album, trackIdNumber, title); - console.log(`==>${ JSON.stringify(tmp)}`); + console.log(`==>${JSON.stringify(tmp)}`); // add it in the list. this.parsedElement.push(tmp); } @@ -333,11 +329,11 @@ export class UploadScene implements OnInit { onChangeFile(value: any): void { this.clearData(); - for(let iii = 0; iii < value.files.length; iii++) { + 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) { + if (this.parsedElement.length === 0) { this.updateNeedSend(); return; } @@ -346,7 +342,7 @@ export class UploadScene implements OnInit { /*for(let iii = 1; iii < this.parsedElement.length; iii++) { console.log(`check gender [${ iii + 1 }/${ this.parsedElement.length }] '${ this.parsedElement[0].gender } !== ${ this.parsedElement[iii].gender }'`); if(this.parsedElement[0].gender !== this.parsedElement[iii].gender) { - this.parsedFailedElement.push(new FileFailParsedElement(this.parsedElement[iii].file, 'Remove from list due to wrong gender value')); + this.parsedFailedElement.push(new FileFailParsedElement(this.parsedFailedElement.length, this.parsedElement[iii].file, 'Remove from list due to wrong gender value')); console.log(`Remove from list (!= playlist) : [${ iii + 1 }/${ this.parsedElement.length }] '${ this.parsedElement[iii].file.name }'`); this.parsedElement.splice(iii, 1); iii--; @@ -354,21 +350,21 @@ export class UploadScene implements OnInit { } */ // clean different artist: - for(let iii = 1; iii < this.parsedElement.length; iii++) { - console.log(`check artist [${ iii + 1 }/${ this.parsedElement.length }] '${ this.parsedElement[0].artist } !== ${ this.parsedElement[iii].artist }'`); - if(this.parsedElement[0].artist !== this.parsedElement[iii].artist) { - this.parsedFailedElement.push(new FileFailParsedElement(this.parsedElement[iii].file, 'Remove from list due to wrong artist value')); - console.log(`Remove from list (!= artist) : [${ iii + 1 }/${ this.parsedElement.length }] '${ this.parsedElement[iii].file.name }'`); + for (let iii = 1; iii < this.parsedElement.length; iii++) { + console.log(`check artist [${iii + 1}/${this.parsedElement.length}] '${this.parsedElement[0].artist} !== ${this.parsedElement[iii].artist}'`); + if (this.parsedElement[0].artist !== this.parsedElement[iii].artist) { + this.parsedFailedElement.push(new FileFailParsedElement(this.parsedFailedElement.length, this.parsedElement[iii].file, 'Remove from list due to wrong artist value')); + console.log(`Remove from list (!= artist) : [${iii + 1}/${this.parsedElement.length}] '${this.parsedElement[iii].file.name}'`); this.parsedElement.splice(iii, 1); iii--; } } // clean different album: - for(let iii = 1; iii < this.parsedElement.length; iii++) { - console.log(`check album [${ iii + 1 }/${ this.parsedElement.length }] '${ this.parsedElement[0].album } !== ${ this.parsedElement[iii].album }'`); - if(this.parsedElement[0].album !== this.parsedElement[iii].album) { - this.parsedFailedElement.push(new FileFailParsedElement(this.parsedElement[iii].file, 'Remove from list due to wrong album value')); - console.log(`Remove from list (!= album) : [${ iii + 1 }/${ this.parsedElement.length }] '${ this.parsedElement[iii].file.name }'`); + for (let iii = 1; iii < this.parsedElement.length; iii++) { + console.log(`check album [${iii + 1}/${this.parsedElement.length}] '${this.parsedElement[0].album} !== ${this.parsedElement[iii].album}'`); + if (this.parsedElement[0].album !== this.parsedElement[iii].album) { + this.parsedFailedElement.push(new FileFailParsedElement(this.parsedFailedElement.length, this.parsedElement[iii].file, 'Remove from list due to wrong album value')); + console.log(`Remove from list (!= album) : [${iii + 1}/${this.parsedElement.length}] '${this.parsedElement[iii].file.name}'`); this.parsedElement.splice(iii, 1); iii--; } @@ -384,7 +380,7 @@ export class UploadScene implements OnInit { } sendFile(): void { - console.log(`Send file requested ... ${ this.parsedElement.length}`); + console.log(`Send file requested ... ${this.parsedElement.length}`); this.upload = new UploadProgress(); // display the upload pop-in this.popInService.open('popin-upload-progress'); @@ -395,16 +391,16 @@ export class UploadScene implements OnInit { let self = this; this.uploadFile(this.parsedElement[id], id, total, () => { let id2 = id + 1; - if(id2 < total) { + 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}`; + }, (value: string) => { + self.upload.error = `Error in the upload of the data...${value}`; }); } - uploadFile(elemnent: FileParsedElement, id: number, total: number, sendDone: any, errorOccured: any): void { + uploadFile(element: FileParsedElement, id: number, total: number, sendDone: any, errorOccurred: any): void { let self = this; self.upload.labelMediaTitle = ''; @@ -415,95 +411,95 @@ export class UploadScene implements OnInit { } */ // add artist - if(!isNullOrUndefined(self.globalArtist)) { - if(self.upload.labelMediaTitle.length !== 0) { - self.upload.labelMediaTitle = `${self.upload.labelMediaTitle }:`; + if (!isNullOrUndefined(self.globalArtist)) { + if (self.upload.labelMediaTitle.length !== 0) { + self.upload.labelMediaTitle = `${self.upload.labelMediaTitle}:`; } self.upload.labelMediaTitle = self.upload.labelMediaTitle + self.globalArtist; } // add album - if(!isNullOrUndefined(self.globalAlbum) && self.globalAlbum.toString().length !== 0) { - if(self.upload.labelMediaTitle.length !== 0) { - self.upload.labelMediaTitle = `${self.upload.labelMediaTitle }-`; + if (!isNullOrUndefined(self.globalAlbum) && self.globalAlbum.toString().length !== 0) { + if (self.upload.labelMediaTitle.length !== 0) { + self.upload.labelMediaTitle = `${self.upload.labelMediaTitle}-`; } - self.upload.labelMediaTitle = `${self.upload.labelMediaTitle }s${ self.globalAlbum.toString()}`; + self.upload.labelMediaTitle = `${self.upload.labelMediaTitle}s${self.globalAlbum.toString()}`; } // add episode ID - if(!isNullOrUndefined(elemnent.trackId) && elemnent.trackId.toString().length !== 0) { - if(self.upload.labelMediaTitle.length !== 0) { - self.upload.labelMediaTitle = `${self.upload.labelMediaTitle }-`; + if (!isNullOrUndefined(element.trackId) && element.trackId.toString().length !== 0) { + if (self.upload.labelMediaTitle.length !== 0) { + self.upload.labelMediaTitle = `${self.upload.labelMediaTitle}-`; } - self.upload.labelMediaTitle = `${self.upload.labelMediaTitle }e${ elemnent.trackId.toString()}`; + self.upload.labelMediaTitle = `${self.upload.labelMediaTitle}e${element.trackId.toString()}`; } // add title - if(self.upload.labelMediaTitle.length !== 0) { - self.upload.labelMediaTitle = `${self.upload.labelMediaTitle }-`; + if (self.upload.labelMediaTitle.length !== 0) { + self.upload.labelMediaTitle = `${self.upload.labelMediaTitle}-`; } - self.upload.labelMediaTitle = `[${ id + 1 }/${ total }]${ self.upload.labelMediaTitle }${elemnent.title}`; + self.upload.labelMediaTitle = `[${id + 1}/${total}]${self.upload.labelMediaTitle}${element.title}`; - self.trackService.uploadFile(elemnent.file, + self.trackService.uploadFile(element.file, self.globalGender, self.globalArtist, self.globalAlbum, - elemnent.trackId, - elemnent.title, + element.trackId, + element.title, (count, totalTmp) => { - // console.log("upload : " + count*100/totalTmp); + // console.log("upload : " + count*100/totalTmp); self.upload.mediaSendSize = count; self.upload.mediaSize = totalTmp; }) .then((response) => { - console.log(`get response of track : ${ JSON.stringify(response, null, 2)}`); + console.log(`get response of track : ${JSON.stringify(response, null, 2)}`); sendDone(); }).catch((response) => { - // self.error = "Can not get the data"; + // self.error = "Can not get the data"; console.log('Can not add the data in the system...'); - errorOccured(JSON.stringify(response, null, 2)); + errorOccurred(JSON.stringify(response, null, 2)); }); } - public checkSimilarString(valueA:string, valueB:string): boolean { + public checkSimilarString(valueA: string, valueB: string): boolean { let valueAL = valueA.toLowerCase(); let valueBL = valueB.toLowerCase(); valueAL = valueAL.replace(/[ \t\n\r-_#~@]/g, ''); valueBL = valueBL.replace(/[ \t\n\r-_#~@]/g, ''); - if(valueAL === valueBL) { + if (valueAL === valueBL) { return true; } - if(valueAL.startsWith(valueBL)) { + if (valueAL.startsWith(valueBL)) { return true; } - if(valueBL.startsWith(valueAL)) { + if (valueBL.startsWith(valueAL)) { return true; } return false; } - checkConcordence():void { - if(isNullOrUndefined(this.parsedElement)) { + checkConcordance(): void { + if (isNullOrUndefined(this.parsedElement)) { return; } // ckear checker - for(let iii = 0; iii < this.parsedElement.length; iii++) { + for (let iii = 0; iii < this.parsedElement.length; iii++) { this.parsedElement[iii].nameDetected = false; - this.parsedElement[iii].episodeDetected = false; + this.parsedElement[iii].trackIdDetected = false; } - if(isNullOrUndefined(this.listFileInBdd)) { + if (isNullOrUndefined(this.listFileInBdd)) { return; } - for(let iii = 0; iii < this.listFileInBdd.length; iii++) { + for (let iii = 0; iii < this.listFileInBdd.length; iii++) { this.listFileInBdd[iii].nameDetected = false; - this.listFileInBdd[iii].episodeDetected = false; + this.listFileInBdd[iii].trackIdDetected = false; } - for(let iii = 0; iii < this.parsedElement.length; iii++) { - for(let jjj = 0; jjj < this.listFileInBdd.length; jjj++) { - if(this.checkSimilarString(this.parsedElement[iii].title, this.listFileInBdd[jjj].name)) { + for (let iii = 0; iii < this.parsedElement.length; iii++) { + for (let jjj = 0; jjj < this.listFileInBdd.length; jjj++) { + if (this.checkSimilarString(this.parsedElement[iii].title, this.listFileInBdd[jjj].name)) { this.parsedElement[iii].nameDetected = true; this.listFileInBdd[jjj].nameDetected = true; } - if(this.parsedElement[iii].trackId === this.listFileInBdd[jjj].episode) { - this.parsedElement[iii].episodeDetected = true; - this.listFileInBdd[jjj].episodeDetected = true; + if (this.parsedElement[iii].trackId === this.listFileInBdd[jjj].episode) { + this.parsedElement[iii].trackIdDetected = true; + this.listFileInBdd[jjj].trackIdDetected = true; } } } @@ -511,13 +507,13 @@ export class UploadScene implements OnInit { updateListOfTrackToCheck(): void { // No artist ID set ==> nothing to do. - if(isNullOrUndefined(this.artistId)) { + if (isNullOrUndefined(this.artistId)) { this.listFileInBdd = undefined; return; } let self = this; // no album check only the artist files. - if(isNullOrUndefined(this.globalAlbum)) { + if (isNullOrUndefined(this.globalAlbum)) { console.error(`NO ALBUM ==> check artist ID...`); self.artistService.getAllTracks(self.artistId) .then((response: any[]) => { @@ -526,7 +522,7 @@ export class UploadScene implements OnInit { // for (let iii = 0; iii { self.listFileInBdd = undefined; }); @@ -539,14 +535,14 @@ export class UploadScene implements OnInit { this.artistService.getAlbum(this.artistId) .then((response: any[]) => { console.log(`find album: ${JSON.stringify(response, null, 2)}`); - for(let iii = 0; iii < response.length; iii++) { + for (let iii = 0; iii < response.length; iii++) { // console.log(" - " + JSON.stringify(response[iii]) + 'compare with : ' + JSON.stringify(self.globalAlbum)); - if(response[iii].name === `${self.globalAlbum}`) { + if (response[iii].name === `${self.globalAlbum}`) { self.albumId = response[iii].id; break; } } - if(isNullOrUndefined(self.albumId)) { + if (isNullOrUndefined(self.albumId)) { return; } self.albumService.getTrack(self.albumId) @@ -557,7 +553,7 @@ export class UploadScene implements OnInit { // for (let iii = 0; iii { self.listFileInBdd = undefined; }); @@ -567,19 +563,19 @@ export class UploadScene implements OnInit { } eventPopUpAlbum(event: string): void { - console.log(`GET event: ${ event}`); + console.log(`GET event: ${event}`); this.popInService.close('popin-new-album'); } eventPopUpArtist(event: string): void { - console.log(`GET event: ${ event}`); + console.log(`GET event: ${event}`); this.popInService.close('popin-new-artist'); } eventPopUpType(event: string): void { - console.log(`GET event: ${ event}`); + console.log(`GET event: ${event}`); this.popInService.close('popin-new-type'); } eventPopUpPlaylist(event: string): void { - console.log(`GET event: ${ event}`); + console.log(`GET event: ${event}`); this.popInService.close('popin-new-playlist'); } diff --git a/front/src/common b/front/src/common index 39b97f7..147a955 160000 --- a/front/src/common +++ b/front/src/common @@ -1 +1 @@ -Subproject commit 39b97f7c06e793ae05b6bad94d111adb878c9b7e +Subproject commit 147a955b195eb7c90e445d404f043d9a363087ca diff --git a/front/src/polyfills.ts b/front/src/polyfills.ts deleted file mode 100644 index 64c24d4..0000000 --- a/front/src/polyfills.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * This file includes polyfills needed by Angular and is loaded before the app. - * You can add your own extra polyfills to this file. - * - * This file is divided into 2 sections: - * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. - * 2. Application imports. Files imported after ZoneJS that should be loaded before your main - * file. - * - * The current setup is for so-called "evergreen" browsers; the last versions of browsers that - * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), - * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. - * - * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html - */ - -/*************************************************************************************************** - * BROWSER POLYFILLS - */ - -/** IE9, IE10 and IE11 requires all of the following polyfills. **/ -// import 'core-js/es6/symbol'; -// import 'core-js/es6/object'; -// import 'core-js/es6/function'; -// import 'core-js/es6/parse-int'; -// import 'core-js/es6/parse-float'; -// import 'core-js/es6/number'; -// import 'core-js/es6/math'; -// import 'core-js/es6/string'; -// import 'core-js/es6/date'; -// import 'core-js/es6/array'; -// import 'core-js/es6/regexp'; -// import 'core-js/es6/map'; -// import 'core-js/es6/weak-map'; -// import 'core-js/es6/set'; - -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. - -/** IE10 and IE11 requires the following for the Reflect API. */ -// import 'core-js/es6/reflect'; - -//import 'babel-polyfill'; - -/** Evergreen browsers require these. **/ -// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. -//import 'core-js/es7/reflect'; - - -/** - * Required to support Web Animations `@angular/platform-browser/animations`. - * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation - **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - - - -/*************************************************************************************************** - * Zone JS is required by default for Angular itself. - */ -import 'zone.js/dist/zone'; // Included with Angular CLI. - - -/*************************************************************************************************** - * APPLICATION IMPORTS - */ \ No newline at end of file