Fix lint issues

This commit is contained in:
Tomas Groth 2022-07-26 23:38:08 +02:00
parent 5196f522dc
commit 20289e8ef4
3 changed files with 16 additions and 26 deletions

View File

@ -19,48 +19,38 @@ export class ChordViewComponent extends StageViewComponent {
setNewSlides(slides: Slide[]): void {
super.setNewSlides(slides);
// if this song is already known
if (this.songTransposeMap.has(this.serviceItem.id))
{
if (this.songTransposeMap.get(this.serviceItem.id) != 0)
{
if (this.songTransposeMap.has(this.serviceItem.id)) {
if (this.songTransposeMap.get(this.serviceItem.id) !== 0) {
this.transpose();
}
}
else
{
} else {
this.songTransposeMap.set(this.serviceItem.id, 0);
}
}
transposeUp(): void {
if (this.songTransposeMap.has(this.serviceItem.id))
{
let tmpTranspose = this.songTransposeMap.get(this.serviceItem.id) + 1;
if (this.songTransposeMap.has(this.serviceItem.id)) {
const tmpTranspose = this.songTransposeMap.get(this.serviceItem.id) + 1;
this.songTransposeMap.set(this.serviceItem.id, tmpTranspose);
}
else
{
} else {
this.songTransposeMap.set(this.serviceItem.id, 1);
}
this.transpose();
}
transposeDown(): void {
if (this.songTransposeMap.has(this.serviceItem.id))
{
let tmpTranspose = this.songTransposeMap.get(this.serviceItem.id) - 1;
if (this.songTransposeMap.has(this.serviceItem.id)) {
const tmpTranspose = this.songTransposeMap.get(this.serviceItem.id) - 1;
this.songTransposeMap.set(this.serviceItem.id, tmpTranspose);
}
else
{
} else {
this.songTransposeMap.set(this.serviceItem.id, -1);
}
this.transpose();
}
transpose(): void {
let tmpTranspose = this.songTransposeMap.get(this.serviceItem.id);
const tmpTranspose = this.songTransposeMap.get(this.serviceItem.id);
this.openlpService.transposeSong(tmpTranspose).subscribe(transposedLyrics => {
// Replace the chords in the currentSlides with the returned transposed chords
if (transposedLyrics instanceof Array) {
@ -77,14 +67,14 @@ export class ChordViewComponent extends StageViewComponent {
if (!slide) {
return '';
}
let chordpro: string = slide.chords;
/*chordpro = chordpro.replace(/<span class="\w*\s*\w*">/g, '');
/*let chordpro: string = slide.chords;
chordpro = chordpro.replace(/<span class="\w*\s*\w*">/g, '');
chordpro = chordpro.replace(/<span>/g, '');
chordpro = chordpro.replace(/<\/span>/g, '');
chordpro = chordpro.replace(/<strong>/g, '[');
chordpro = chordpro.replace(/<\/strong>/g, ']');
chordpro = chordpro.replace(/<br>/g, '\n');*/
return chordpro;
return slide.chords;
}
}

View File

@ -169,8 +169,8 @@ export class ChordProPipe implements PipeTransform {
lastChord = lastChord.split('/').map(chord => {
const chordRoot = comp.chordRoot(chord);
// No need to transpose here - will be done in the new web api endpoint
//const newRoot = comp.transposeChord(chordRoot, nHalfSteps);
//return newRoot + comp.restOfChord(chord);
// const newRoot = comp.transposeChord(chordRoot, nHalfSteps);
// return newRoot + comp.restOfChord(chord);
return chordRoot + comp.restOfChord(chord);
}).join('/');
}

View File

@ -183,7 +183,7 @@ export class OpenLPService {
return this.http.post(`${this.apiURL}/plugins/${plugin}/add`, {'id': id}, httpOptions);
}
transposeSong(transpose_value : any): Observable<any> {
transposeSong(transpose_value): Observable<any> {
return this.http.get(`${this.apiURL}/plugins/songs/transpose-live-item/${transpose_value}`, httpOptions);
}