diff --git a/src/app/metadata-edit/metadata-edit.component.ts b/src/app/metadata-edit/metadata-edit.component.ts index d0965f61..cf5b790f 100644 --- a/src/app/metadata-edit/metadata-edit.component.ts +++ b/src/app/metadata-edit/metadata-edit.component.ts @@ -1,15 +1,16 @@ import {Component, ElementRef, Inject, OnInit, ViewChild} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; -import {HttpClient} from "@angular/common/http"; +import {HttpClient, HttpErrorResponse} from "@angular/common/http"; import {Show} from "../../models/show"; import {Genre} from "../../models/genre"; import {MatChipInputEvent} from "@angular/material/chips"; import {MatAutocompleteSelectedEvent} from "@angular/material/autocomplete"; import {Observable, of} from "rxjs"; -import {tap} from "rxjs/operators"; +import {catchError, tap} from "rxjs/operators"; import {Studio} from "../../models/studio"; import {ShowGridComponent} from "../show-grid/show-grid.component"; import {Provider} from "../../models/provider"; +import {MatSnackBar} from "@angular/material/snack-bar"; @Component({ selector: 'app-metadata-edit', @@ -29,7 +30,7 @@ export class MetadataEditComponent public metadataChanged: boolean = false; - constructor(public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public show: Show, private http: HttpClient) + constructor(public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public show: Show, private http: HttpClient, private snackBar: MatSnackBar) { this.http.get("/api/genres").subscribe(result => { @@ -49,10 +50,27 @@ export class MetadataEditComponent apply(): void { - this.http.post("/api/show/edit/" + this.show.slug, this.show).subscribe(() => + if (this.metadataChanged) { - this.dialogRef.close(this.show); - }); + this.http.post("/api/show/re-identify/" + this.show.slug, this.show).subscribe( + (show: Show) => + { + return; + }, + (error) => + { + this.snackBar.open("An unknown error occured.", null, { horizontalPosition: "left", panelClass: ['snackError'], duration: 2500 }); + } + ); + this.dialogRef.close(this.show); + } + else + { + this.http.post("/api/show/edit/" + this.show.slug, this.show).subscribe(() => + { + this.dialogRef.close(this.show); + }); + } } addAlias(event: MatChipInputEvent) diff --git a/src/app/show-details/show-details.component.html b/src/app/show-details/show-details.component.html index 8532fbaf..11a7cc61 100644 --- a/src/app/show-details/show-details.component.html +++ b/src/app/show-details/show-details.component.html @@ -42,6 +42,7 @@ +
diff --git a/src/app/show-details/show-details.component.ts b/src/app/show-details/show-details.component.ts index 86c1ec43..ae736ef7 100644 --- a/src/app/show-details/show-details.component.ts +++ b/src/app/show-details/show-details.component.ts @@ -105,4 +105,13 @@ export class ShowDetailsComponent implements OnInit this.show = result; }); } + + redownloadImages() + { + this.http.post("api/show/download-images/" + this.show.slug, undefined).subscribe(() => { }, error => + { + console.log(error.status + " - " + error.message); + this.snackBar.open("An unknown error occured while re-downloading images.", null, { horizontalPosition: "left", panelClass: ['snackError'], duration: 2500 }); + }); + } }