mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Adding an identifying search bar
This commit is contained in:
parent
034d326730
commit
65563611f4
@ -84,7 +84,11 @@
|
||||
<mat-panel-title>Identify show</mat-panel-title>
|
||||
<mat-panel-description>Search on metadata providers</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<app-show-grid [shows]="this.identityShow(this.show.title) | async"></app-show-grid>
|
||||
<mat-form-field class="w-100 mx-5">
|
||||
<mat-label>Search for</mat-label>
|
||||
<input matInput value="{{show.title}}" (input)="this.reIdentify($event.target.value)">
|
||||
</mat-form-field>
|
||||
<app-show-grid #identifyGrid [externalShows]="true"></app-show-grid>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
</div>
|
||||
|
@ -8,6 +8,7 @@ import {MatAutocompleteSelectedEvent} from "@angular/material/autocomplete";
|
||||
import {Observable, of} from "rxjs";
|
||||
import {tap} from "rxjs/operators";
|
||||
import {Studio} from "../../models/studio";
|
||||
import {ShowGridComponent} from "../show-grid/show-grid.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-metadata-edit',
|
||||
@ -23,6 +24,7 @@ export class MetadataEditComponent implements OnInit
|
||||
|
||||
private identifing: Observable<Show[]>;
|
||||
private identifiedShows: [string, Show[]];
|
||||
@ViewChild("identifyGrid") private identifyGrid: ShowGridComponent;
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<MetadataEditComponent>, @Inject(MAT_DIALOG_DATA) public show: Show, private http: HttpClient)
|
||||
{
|
||||
@ -34,6 +36,8 @@ export class MetadataEditComponent implements OnInit
|
||||
{
|
||||
this.allStudios = result;
|
||||
});
|
||||
|
||||
this.reIdentify(this.show.title);
|
||||
}
|
||||
|
||||
ngOnInit(): void
|
||||
@ -89,8 +93,6 @@ export class MetadataEditComponent implements OnInit
|
||||
|
||||
identityShow(name: string): Observable<Show[]>
|
||||
{
|
||||
if (this.identifing)
|
||||
return this.identifing;
|
||||
if (this.identifiedShows && this.identifiedShows[0] === name)
|
||||
return of(this.identifiedShows[1]);
|
||||
this.identifing = this.http.get<Show[]>("/api/show/identify/" + name + "?isMovie=" + this.show.isMovie).pipe(
|
||||
@ -98,4 +100,10 @@ export class MetadataEditComponent implements OnInit
|
||||
);
|
||||
return this.identifing;
|
||||
}
|
||||
|
||||
reIdentify(search: string)
|
||||
{
|
||||
console.log("Searching for " + search);
|
||||
this.identityShow(search).subscribe(x => this.identifyGrid.shows = x);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div *ngFor="let show of this.shows" class="show-container">
|
||||
<mat-card class="show">
|
||||
<a href="/show/{{show.slug}}" routerLink="show/{{show.slug}}" class="d-flex">
|
||||
<a [href]="getLink(show)" [routerLink]="getLink(show)" class="d-flex">
|
||||
<div class="thumb">
|
||||
<div [style.background-image]="getThumb(show)"> </div>
|
||||
</div>
|
||||
|
@ -18,4 +18,11 @@ export class ShowGridComponent
|
||||
{
|
||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${show.poster})`);
|
||||
}
|
||||
|
||||
getLink(show: Show)
|
||||
{
|
||||
if (this.externalShows)
|
||||
return null;
|
||||
return `/show/${show.slug}`;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user