[DEV] migrate with succes to angular17

This commit is contained in:
Edouard DUPIN 2024-02-26 00:01:37 +01:00
parent 0af1bbfb52
commit c3e2b7240b
19 changed files with 763 additions and 761 deletions

View File

@ -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"

View File

@ -1,15 +1,17 @@
<!-- Generig global menu -->
<app-top-menu [menu]="currentMenu" (callback)="eventOnMenu($event)"></app-top-menu>
<!-- all interfaced pages -->
<div class="main-content" *ngIf="autoConnectedDone">
<div class="main-content">
@if(autoConnectedDone) {
<router-outlet ></router-outlet>
</div>
<div class="main-content" *ngIf="!autoConnectedDone">
}
@else {
<div class="generic-page">
<div class="fill-all colomn_mutiple">
<b style="color:red;">Auto-connection in progress</b>
<div class="clear"></div>
</div>
</div>
}
</div>
<app-element-player-audio></app-element-player-audio>

View File

@ -20,9 +20,4 @@
<div class="title-small">
{{name}}
</div>
<!--
<div class="description-small" *ngIf="description">
{{description}}
</div>
-->
</div>

View File

@ -2,7 +2,9 @@
<div class="season-small">
{{name}}
</div>
<div class="description-small" *ngIf="track">
@if(track) {
<div class="description-small">
n° {{track}}
</div>
}
</div>

View File

@ -1,7 +1,9 @@
<div>
<div class="count-base" *ngIf="counttrack">
@if(counttrack) {
<div class="count-base">
<span class="count">{{counttrack}}</span>
</div>
}
<div class="imgContainer-small">
@if(covers && covers.length > 0) {
<div>
@ -12,7 +14,9 @@
<div class="title-small">
{{name}}
</div>
<div class="description-small" *ngIf="description">
@if(description) {
<div class="description-small">
{{description}}
</div>
}
</div>

View File

@ -10,15 +10,14 @@
<div class="noImage"></div>
}
</div>
<div class="title-small" *ngIf="data">
@if(data) {
<div class="title-small">
{{episodeDisplay}} {{name}}
</div>
<div class="title-small" *ngIf="!data">
}
@else {
<div class="title-small">
Error meda: {{element?.id}}
</div>
<!--
<div class="description-small" *ngIf="description">
{{description}}
</div>
-->
}
</div>

View File

@ -2,21 +2,26 @@
<div class="title">
Edit album
</div>
<div class="fill-all" *ngIf="itemIsRemoved">
@if(itemIsRemoved) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
The album has been removed
<br/><br/><br/>
</div>
</div>
<div class="fill-all" *ngIf="itemIsNotFound">
}
@else if (itemIsNotFound) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
The album does not exist
<br/><br/><br/>
</div>
</div>
<div class="fill-all" *ngIf="itemIsLoading">
}
@else if (itemIsLoading) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
Loading ...<br/>
@ -24,7 +29,9 @@
<br/><br/><br/>
</div>
</div>
<div class="fill-all" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
}
@else {
<div class="fill-all">
<div class="request_raw">
<div class="label">
name:
@ -68,10 +75,10 @@
<div class="clear"></div>
</div>
<!-- ------------------------- Cover section --------------------------------- -->
<div class="title" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
<div class="title">
Covers
</div>
<div class="fill-all" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
<div class="fill-all">
<div class="hide-element">
<input type="file"
#fileInput
@ -81,7 +88,8 @@
</div>
<div class="request_raw">
<div class="input">
<div class="cover" *ngFor="let element of coversDisplay">
@for (element of coversDisplay; track element.id;) {
<div class="cover">
<div class="cover-image">
<img src="{{element.url}}"/>
</div>
@ -91,6 +99,7 @@
</button>
</div>
</div>
}
<div class="cover">
<div class="cover-no-image">
</div>
@ -105,10 +114,10 @@
<div class="clear"></div>
</div>
<!-- ------------------------- ADMIN section --------------------------------- -->
<div class="title" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
<div class="title">
Administration
</div>
<div class="fill-all" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
<div class="fill-all">
<div class="request_raw">
<div class="label">
<i class="material-icons">data_usage</i> ID:
@ -131,17 +140,22 @@
<div class="label">
<i class="material-icons">delete_forever</i> Trash:
</div>
<div class="input" *ngIf="(trackCount == '0')">
@if(trackCount == '0') {
<div class="input">
<button class="button color-button-cancel color-shadow-black" (click)="removeItem()" type="submit">
<i class="material-icons">delete</i> Remove album
</button>
</div>
<div class="input" *ngIf="(trackCount != '0')">
}
@else {
<div class="input">
<i class="material-icons">new_releases</i> Can not remove album, track depending on it
</div>
}
</div>
<div class="clear"></div>
</div>
}
</div>
<upload-progress [mediaTitle]="upload.labelMediaTitle"
[mediaUploaded]="upload.mediaSendSize"

View File

@ -5,11 +5,12 @@
[cover1]="covers"
(play)="playAll()"
(shuffle)="playShuffle()"/>
<div class="fill-content colomn_single" *ngIf="albums">
@if(albums) {
<div class="fill-content colomn_single">
<div class="clear"></div>
<div class="title">Album{{albums.length > 1?"s":""}}: <app-entry placeholder="Search..." (changeValue)="onSearch($event)"></app-entry></div>
<div *ngFor="let data of albums"
class="item-list"
@for (data of albums; track data.id;) {
<div class="item-list"
(click)="onSelectAlbum($event, data.id)"
(auxclick)="onSelectAlbum($event, data.id)"
>
@ -20,7 +21,9 @@
subValues="Artist"
[subValuesCallBack]="getArtistsString"/>
</div>
}
</div>
}
@if(tracks) {
<div class="fill-content colomn_mutiple">
<div class="clear"></div>

View File

@ -2,21 +2,26 @@
<div class="title">
Edit artist
</div>
<div class="fill-all" *ngIf="itemIsRemoved">
@if(itemIsRemoved) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
The artist has been removed
<br/><br/><br/>
</div>
</div>
<div class="fill-all" *ngIf="itemIsNotFound">
}
@else if (itemIsNotFound) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
The artist does not exist
<br/><br/><br/>
</div>
</div>
<div class="fill-all" *ngIf="itemIsLoading">
}
@else if (itemIsLoading) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
Loading ...<br/>
@ -24,7 +29,9 @@
<br/><br/><br/>
</div>
</div>
<div class="fill-all" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
}
@else {
<div class="fill-all">
<div class="request_raw">
<div class="label">
Type:
@ -32,7 +39,9 @@
<div class="input">
<select [ngModel]="typeId"
(ngModelChange)="onChangeType($event)">
<option *ngFor="let element of listType" [ngValue]="element.value">{{element.label}}</option>
@for (element of listType; track element.value;) {
<option [ngValue]="element.value">{{element.label}}</option>
}
</select>
</div>
</div>
@ -66,10 +75,10 @@
<div class="clear"></div>
</div>
<!-- ------------------------- Cover section --------------------------------- -->
<div class="title" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
<div class="title">
Covers
</div>
<div class="fill-all" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
<div class="fill-all">
<div class="hide-element">
<input type="file"
#fileInput
@ -79,7 +88,8 @@
</div>
<div class="request_raw">
<div class="input">
<div class="cover" *ngFor="let element of coversDisplay">
@for (element of coversDisplay; track element.id;) {
<div class="cover">
<div class="cover-image">
<img src="{{element.url}}"/>
</div>
@ -89,6 +99,7 @@
</button>
</div>
</div>
}
<div class="cover">
<div class="cover-no-image">
</div>
@ -103,10 +114,10 @@
<div class="clear"></div>
</div>
<!-- ------------------------- ADMIN section --------------------------------- -->
<div class="title" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
<div class="title">
Administration
</div>
<div class="fill-all" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
<div class="fill-all">
<div class="request_raw">
<div class="label">
<i class="material-icons">data_usage</i> ID:
@ -138,17 +149,22 @@
<div class="label">
<i class="material-icons">delete_forever</i> Trash:
</div>
<div class="input" *ngIf="(trackCount == '0' && albumsCount == '0')">
@if(trackCount == '0' && albumsCount == '0') {
<div class="input">
<button class="button color-button-cancel color-shadow-black" (click)="removeItem()" type="submit">
<i class="material-icons">delete</i> Remove Artist
</button>
</div>
<div class="input" *ngIf="(trackCount != '0' || albumsCount != '0')">
}
@else {
<div class="input">
<i class="material-icons">new_releases</i> Can not remove album or track depending on it
</div>
}
</div>
<div class="clear"></div>
</div>
}
</div>
<upload-progress [mediaTitle]="upload.labelMediaTitle"

View File

@ -7,7 +7,8 @@
[cover2]="albumCovers"
(play)="playAll()"
(shuffle)="playShuffle()"/>
<div class="fill-content colomn_single" *ngIf="tracks">
@if(tracks) {
<div class="fill-content colomn_single">
<div class="clear"></div>
<div class="title">Track{{tracks.length > 1?"s":""}}:</div>
@for (data of tracks; track data.id;) {
@ -19,5 +20,6 @@
Aucune piste accessible.
}
</div>
}
<div class="clear-end"></div>
</div>

View File

@ -9,24 +9,28 @@
<div class="fill-content colomn_single">
<div class="clear"></div>
<div class="title">Album{{albums.length > 1?"s":""}}:</div>
<div *ngFor="let data of albums" class="item-list" (click)="onSelectAlbum($event, data.id)" (auxclick)="onSelectAlbum($event, data.id)">
@for (data of albums; track data.id;) {
<div class="item-list" (click)="onSelectAlbum($event, data.id)" (auxclick)="onSelectAlbum($event, data.id)">
<app-element-season
[element]="data"
countSubType="Track"
[countSubTypeCallBack]="countTrack"
></app-element-season>
</div>
}
</div>
}
@if(tracks) {
<div class="fill-content colomn_mutiple">
<div class="clear"></div>
<div class="title">Track{{tracks.length > 1?"s":""}}:</div>
<div *ngFor="let data of tracks" class="item item-video" (click)="onSelectTrack($event, data.id)" (auxclick)="onSelectTrack($event, data.id)">
@for (data of tracks; track data.id;) {
<div class="item item-video" (click)="onSelectTrack($event, data.id)" (auxclick)="onSelectTrack($event, data.id)">
<app-element-video
[element]="data"
></app-element-video>
</div>
}
</div>
}
<div class="clear-end"></div>

View File

@ -5,7 +5,8 @@
[cover1]="covers"
(play)="playAll()"
(shuffle)="playShuffle()"/>
<div class="fill-content colomn_single" *ngIf="artists">
@if(artists) {
<div class="fill-content colomn_single">
<div class="clear"></div>
<div class="title">Artist{{artists.length > 1?"s":""}}: <app-entry placeholder="Search..." (changeValue)="onSearch($event)"></app-entry></div>
@for (data of artists; track data.id;) {
@ -20,5 +21,6 @@
</div>
}
</div>
}
<div class="clear-end"></div>
</div>

View File

@ -11,9 +11,11 @@
<div class="title">
{{name}}
</div>
<div class="description" *ngIf="description">
@if(description) {
<div class="description">
{{description}}
</div>
}
</div>
</div>
<div class="fill-content colomn_mutiple">

View File

@ -2,21 +2,26 @@
<div class="title">
Edit Media
</div>
<div class="fill-all" *ngIf="itemIsRemoved">
@if(itemIsRemoved) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
The media has been removed
<br/><br/><br/>
</div>
</div>
<div class="fill-all" *ngIf="itemIsNotFound">
}
@else if (itemIsNotFound) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
The media does not exist
<br/><br/><br/>
</div>
</div>
<div class="fill-all" *ngIf="itemIsLoading">
}
@else if (itemIsLoading) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
Loading ...<br/>
@ -24,8 +29,9 @@
<br/><br/><br/>
</div>
</div>
<div class="fill-all" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
}
@else {
<div class="fill-all">
<div class="request_raw">
<div class="label">
Title:
@ -57,7 +63,9 @@
<div class="input">
<select [ngModel]="data.genderId"
(ngModelChange)="onChangeGender($event)">
<option *ngFor="let element of listGender" [ngValue]="element.value">{{element.label}}</option>
@for (element of listGender; track element.value;) {
<option [ngValue]="element.value">{{element.label}}</option>
}
</select>
</div>
<div class="input_add">
@ -73,7 +81,9 @@
<div class="input">
<select [ngModel]="data.artistId"
(ngModelChange)="onChangeArtist($event)">
<option *ngFor="let element of listArtist" [ngValue]="element.value">{{element.label}}</option>
@for (element of listArtist; track element.value;) {
<option [ngValue]="element.value">{{element.label}}</option>
}
</select>
</div>
<div class="input_add">
@ -89,7 +99,9 @@
<div class="input">
<select [ngModel]="data.albumId"
(ngModelChange)="onChangeAlbum($event)">
<option *ngFor="let element of listAlbum" [ngValue]="element.value">{{element.label}}</option>
@for (element of listAlbum; track element.value;) {
<option [ngValue]="element.value">{{element.label}}</option>
}
</select>
</div>
<div class="input_add">
@ -119,10 +131,10 @@
<div class="clear"></div>
</div>
<!-- ------------------------- ADMIN section --------------------------------- -->
<div class="title" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
<div class="title">
Administration
</div>
<div class="fill-all" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
<div class="fill-all">
<div class="request_raw">
<div class="label">
<i class="material-icons">data_usage</i> ID:
@ -144,6 +156,7 @@
</div>
<div class="clear"></div>
</div>
}
</div>
<create-type ></create-type>

View File

@ -1,17 +1,21 @@
<div class="main-reduce">
<div class="fill-all" *ngIf="mediaIsNotFound">
@if(mediaIsNotFound) {
<div class="fill-all">
<div class="title">
Play media<br/><br/><br/><br/><br/>
The media does not exist
</div>
</div>
<div class="fill-all" *ngIf="mediaIsLoading">
}
@if(mediaIsLoading) {
<div class="fill-all">
<div class="title">
Play media<br/><br/><br/><br/><br/>
Loading ...<br/>
Please wait.
</div>
</div>
}
@if(!mediaIsNotFound && !mediaIsLoading && !playTrack) {
<div class="fill-all">
<div class="title">
@ -20,7 +24,7 @@
<div class="cover-full">
<div class="cover">
@if (covers && covers.length > 0) {
<div class="cover-image" *ngIf="">
<div class="cover-image">
<img src="{{covers[0]}}"/>
</div>
}
@ -134,15 +138,16 @@
}
</div>
}
<div class="title-inline" *ngIf="!isFullScreen || !isPlaying">
@if(!isFullScreen || !isPlaying) {
<div class="title-inline">
{{generatedName}}
</div>
<div class="track-button" *ngIf="!isFullScreen || !isPlaying">
<div class="track-button">
<button (click)="onRequireStop()">
<i class="material-icons big-button">highlight_off</i>
</button>
</div>
}
@if (displayVolumeMenu && (!displayNeedHide || !isPlaying)) {
<div class="volume">
<div class="volume-menu">

View File

@ -63,7 +63,9 @@
<td class="right-colomn">
<!--<select [ngModel]="genreId"-->
<select (ngModelChange)="onChangeGender($event)">
<option *ngFor="let element of listGender" [ngValue]="element.value">{{element.label}}</option>
@for (element of listGender; track element.value;) {
<option [ngValue]="element.value">{{element.label}}</option>
}
</select>
</td>
<td class="tool-colomn">
@ -89,7 +91,9 @@
<td class="right-colomn">
<select [ngModel]="artistId"
(ngModelChange)="onChangeArtist($event)">
<option *ngFor="let element of listArtist" [ngValue]="element.value">{{element.label}}</option>
@for (element of listArtist; track element.value;) {
<option [ngValue]="element.value">{{element.label}}</option>
}
</select>
</td>
<td class="tool-colomn">
@ -115,7 +119,9 @@
<td class="right-colomn">
<select [ngModel]="albumId">
<!--(ngModelChange)="onChangeAlbum($event)">-->
<option *ngFor="let element of listAlbum" [ngValue]="element.value">{{element.label}}</option>
@for (element of listAlbum; track element.value;) {
<option [ngValue]="element.value">{{element.label}}</option>
}
</select>
</td>
<td class="tool-colomn">
@ -144,7 +150,8 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let data of this.parsedElement">
@for (data of parsedElement; track data.trackId;) {
<tr>
<td class="left-colomn">
<input type="number"
pattern="[0-9]{0-4}"
@ -161,19 +168,22 @@
(input)="onTitle(data, $event.target.value)"
[class.error]="data.title === ''"
/>
<span *ngIf="data.nameDetected === true" class="error">
@if(data.nameDetected === true) {
<span class="error">
^^^This title already exist !!!
</span>
}
</td>
<td class="tool-colomn" >
<button class="button color-button-cancel color-shadow-black"
(click)="removeElmentFromList(data, $event.target.value)"
(click)="removeElementFromList(data, $event.target.value)"
type="submit"
alt="Delete">
<i class="material-icons">delete</i>
</button>
</td>
</tr>
}
</tbody>
</table>
</div>
@ -187,7 +197,8 @@
</button>
</div>
<div class="clear"></div>
<div class="request_raw_table" *ngIf="this.listFileInBdd">
@if(listFileInBdd) {
<div class="request_raw_table">
<table>
<colgroup>
<col style="width:10%">
@ -201,13 +212,16 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let data of this.listFileInBdd">
@for (data of listFileInBdd; track data.id;) {
<tr>
<td class="left-colomn" [class.error]="data.episodeDetected === true">{{data.episode}}</td>
<td class="right-colomn" [class.error]="data.nameDetected === true">{{data.name}}</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
}
@if(parsedElement.length !== 0) {
@ -219,20 +233,14 @@
<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.parsedFailedElement">
@for (data of parsedFailedElement; track data.id;) {
<tr>
<td class="left-colomn">Rejected:</td>
<td class="right-colomn">
{{data.file.name}}<br/> ==&gt; {{data.reason}}
</td>
</tr>
}
</tbody>
</table>
</div>

View File

@ -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: '---' },
@ -81,12 +82,12 @@ export class UploadScene implements OnInit {
*/
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);
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";
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<response.length; iii++) {
// console.log(" - " + JSON.stringify(response[iii]));
// }
self.checkConcordence();
self.checkConcordance();
}).catch((response) => {
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<response2.length; iii++) {
// console.log(" - " + JSON.stringify(response2[iii]));
// }
self.checkConcordence();
self.checkConcordance();
}).catch((response3) => {
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');
}

@ -1 +1 @@
Subproject commit 39b97f7c06e793ae05b6bad94d111adb878c9b7e
Subproject commit 147a955b195eb7c90e445d404f043d9a363087ca

View File

@ -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
*/