mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-07 10:14:13 -04:00
Updating to the new images API
This commit is contained in:
parent
7bf53b4008
commit
846dbcb22e
@ -34,7 +34,7 @@ import { MatTabsModule } from "@angular/material/tabs";
|
||||
import { PasswordValidator } from "./misc/password-validator";
|
||||
import { MatCheckboxModule } from "@angular/material/checkbox";
|
||||
import { MatDialogModule } from "@angular/material/dialog";
|
||||
import { FallbackDirective } from "./misc/fallback.directive";
|
||||
import { FallbackDirective, FallbackPipe } from "./misc/fallback.directive";
|
||||
import { AuthModule } from "./auth/auth.module";
|
||||
import { AuthRoutingModule } from "./auth/auth-routing.module";
|
||||
import { TrailerDialogComponent } from "./pages/trailer-dialog/trailer-dialog.component";
|
||||
@ -73,7 +73,8 @@ import { MatDatepickerModule } from "@angular/material/datepicker";
|
||||
BufferToWidthPipe,
|
||||
VolumeToButtonPipe,
|
||||
SupportedButtonPipe,
|
||||
LongPressDirective
|
||||
LongPressDirective,
|
||||
FallbackPipe
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -110,7 +111,8 @@ import { MatDatepickerModule } from "@angular/material/datepicker";
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
exports: [
|
||||
FallbackDirective
|
||||
FallbackDirective,
|
||||
FallbackPipe
|
||||
],
|
||||
providers: [
|
||||
StartupService,
|
||||
|
@ -25,6 +25,8 @@ export class EpisodesListComponent extends HorizontalScroller
|
||||
|
||||
sanitize(url: string): SafeStyle
|
||||
{
|
||||
if (!url)
|
||||
return undefined;
|
||||
return this.sanitizer.bypassSecurityTrustStyle("url(" + url + ")");
|
||||
}
|
||||
|
||||
|
@ -276,6 +276,8 @@ export class ItemsGridComponent implements OnInit
|
||||
|
||||
getPoster(obj: LibraryItem | Show | ShowRole | Collection): SafeStyle
|
||||
{
|
||||
if (!obj.poster)
|
||||
return undefined;
|
||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${obj.poster})`);
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,8 @@ export class ItemsListComponent extends HorizontalScroller
|
||||
|
||||
getPoster(item: LibraryItem | Show | ShowRole | Collection): SafeUrl
|
||||
{
|
||||
if (!item.poster)
|
||||
return undefined;
|
||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${item.poster})`);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@ export class PeopleListComponent extends HorizontalScroller
|
||||
|
||||
getPeopleIcon(item: People): SafeStyle
|
||||
{
|
||||
if (!item.poster)
|
||||
return undefined;
|
||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${item.poster})`);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ export class ShowGridComponent
|
||||
|
||||
getThumb(show: Show): SafeStyle
|
||||
{
|
||||
if (!show.poster)
|
||||
return undefined;
|
||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${show.poster})`);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Directive, ElementRef, HostListener, Input } from "@angular/core";
|
||||
import { Directive, ElementRef, HostListener, Input, Pipe, PipeTransform } from "@angular/core";
|
||||
|
||||
/* tslint:disable:directive-selector */
|
||||
@Directive({
|
||||
@ -17,3 +17,15 @@ export class FallbackDirective
|
||||
html.src = this.fallback;
|
||||
}
|
||||
}
|
||||
|
||||
@Pipe({
|
||||
name: "fallback",
|
||||
pure: true
|
||||
})
|
||||
export class FallbackPipe implements PipeTransform
|
||||
{
|
||||
transform(value: any, ...args: any[]): any
|
||||
{
|
||||
return value ?? args.find(x => x);
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,13 @@ export interface Show extends IResource
|
||||
studio: Studio;
|
||||
people: People[];
|
||||
seasons: Season[];
|
||||
trailerUrl: string;
|
||||
trailer: string;
|
||||
isMovie: boolean;
|
||||
startAir: Date;
|
||||
endAir: Date;
|
||||
poster: string;
|
||||
logo: string;
|
||||
backdrop: string;
|
||||
thumbnail: string;
|
||||
|
||||
externalIDs: ExternalID[];
|
||||
}
|
||||
|
@ -71,7 +71,7 @@
|
||||
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>Trailer</mat-label>
|
||||
<input matInput [(ngModel)]="this.show.trailerUrl" name="trailer">
|
||||
<input matInput [(ngModel)]="this.show.trailer" name="trailer">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="w-100">
|
||||
|
@ -75,7 +75,7 @@
|
||||
|
||||
<div class="controller container-fluid" id="controller">
|
||||
<div class="img d-none d-sm-block">
|
||||
<img [src]="this.item.poster" alt="poster" />
|
||||
<img [src]="this.item.poster | fallback" alt="poster" />
|
||||
</div>
|
||||
<div class="content">
|
||||
<h3 *ngIf="!this.item.isMovie">S{{this.item.seasonNumber}}:E{{this.item.episodeNumber}} - {{this.item.title}}</h3>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="backdrop">
|
||||
<img id="backdrop" [src]="this.show.backdrop" alt="backdrop" />
|
||||
<img id="backdrop" [src]="this.show.thumbnail | fallback" alt="backdrop" />
|
||||
</div>
|
||||
|
||||
<div class="header container pt-sm-5">
|
||||
@ -16,7 +16,7 @@
|
||||
<button mat-mini-fab matTooltipPosition="above" matTooltip="Play" class="mr-3" (click)="playClicked()">
|
||||
<mat-icon>play_arrow</mat-icon>
|
||||
</button>
|
||||
<button *ngIf="this.show.trailerUrl" mat-icon-button matTooltipPosition="above" matTooltip="Trailer" (click)="openTrailer()">
|
||||
<button *ngIf="this.show.trailer" mat-icon-button matTooltipPosition="above" matTooltip="Trailer" (click)="openTrailer()">
|
||||
<mat-icon>local_movies</mat-icon>
|
||||
</button>
|
||||
<a *ngIf="this.show.isMovie" [href]="'/video/' + this.show.slug" download>
|
||||
|
@ -133,7 +133,7 @@ export class ShowDetailsComponent implements AfterViewInit, OnDestroy
|
||||
this.dialog.open(TrailerDialogComponent, {
|
||||
width: "80%",
|
||||
height: "45vw",
|
||||
data: this.show.trailerUrl,
|
||||
data: this.show.trailer,
|
||||
panelClass: "panel"
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user