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 { PasswordValidator } from "./misc/password-validator";
|
||||||
import { MatCheckboxModule } from "@angular/material/checkbox";
|
import { MatCheckboxModule } from "@angular/material/checkbox";
|
||||||
import { MatDialogModule } from "@angular/material/dialog";
|
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 { AuthModule } from "./auth/auth.module";
|
||||||
import { AuthRoutingModule } from "./auth/auth-routing.module";
|
import { AuthRoutingModule } from "./auth/auth-routing.module";
|
||||||
import { TrailerDialogComponent } from "./pages/trailer-dialog/trailer-dialog.component";
|
import { TrailerDialogComponent } from "./pages/trailer-dialog/trailer-dialog.component";
|
||||||
@ -73,7 +73,8 @@ import { MatDatepickerModule } from "@angular/material/datepicker";
|
|||||||
BufferToWidthPipe,
|
BufferToWidthPipe,
|
||||||
VolumeToButtonPipe,
|
VolumeToButtonPipe,
|
||||||
SupportedButtonPipe,
|
SupportedButtonPipe,
|
||||||
LongPressDirective
|
LongPressDirective,
|
||||||
|
FallbackPipe
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@ -110,7 +111,8 @@ import { MatDatepickerModule } from "@angular/material/datepicker";
|
|||||||
],
|
],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
exports: [
|
exports: [
|
||||||
FallbackDirective
|
FallbackDirective,
|
||||||
|
FallbackPipe
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
StartupService,
|
StartupService,
|
||||||
|
@ -25,6 +25,8 @@ export class EpisodesListComponent extends HorizontalScroller
|
|||||||
|
|
||||||
sanitize(url: string): SafeStyle
|
sanitize(url: string): SafeStyle
|
||||||
{
|
{
|
||||||
|
if (!url)
|
||||||
|
return undefined;
|
||||||
return this.sanitizer.bypassSecurityTrustStyle("url(" + url + ")");
|
return this.sanitizer.bypassSecurityTrustStyle("url(" + url + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,6 +276,8 @@ export class ItemsGridComponent implements OnInit
|
|||||||
|
|
||||||
getPoster(obj: LibraryItem | Show | ShowRole | Collection): SafeStyle
|
getPoster(obj: LibraryItem | Show | ShowRole | Collection): SafeStyle
|
||||||
{
|
{
|
||||||
|
if (!obj.poster)
|
||||||
|
return undefined;
|
||||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${obj.poster})`);
|
return this.sanitizer.bypassSecurityTrustStyle(`url(${obj.poster})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ export class ItemsListComponent extends HorizontalScroller
|
|||||||
|
|
||||||
getPoster(item: LibraryItem | Show | ShowRole | Collection): SafeUrl
|
getPoster(item: LibraryItem | Show | ShowRole | Collection): SafeUrl
|
||||||
{
|
{
|
||||||
|
if (!item.poster)
|
||||||
|
return undefined;
|
||||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${item.poster})`);
|
return this.sanitizer.bypassSecurityTrustStyle(`url(${item.poster})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ export class PeopleListComponent extends HorizontalScroller
|
|||||||
|
|
||||||
getPeopleIcon(item: People): SafeStyle
|
getPeopleIcon(item: People): SafeStyle
|
||||||
{
|
{
|
||||||
|
if (!item.poster)
|
||||||
|
return undefined;
|
||||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${item.poster})`);
|
return this.sanitizer.bypassSecurityTrustStyle(`url(${item.poster})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ export class ShowGridComponent
|
|||||||
|
|
||||||
getThumb(show: Show): SafeStyle
|
getThumb(show: Show): SafeStyle
|
||||||
{
|
{
|
||||||
|
if (!show.poster)
|
||||||
|
return undefined;
|
||||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${show.poster})`);
|
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 */
|
/* tslint:disable:directive-selector */
|
||||||
@Directive({
|
@Directive({
|
||||||
@ -17,3 +17,15 @@ export class FallbackDirective
|
|||||||
html.src = this.fallback;
|
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;
|
studio: Studio;
|
||||||
people: People[];
|
people: People[];
|
||||||
seasons: Season[];
|
seasons: Season[];
|
||||||
trailerUrl: string;
|
trailer: string;
|
||||||
isMovie: boolean;
|
isMovie: boolean;
|
||||||
startAir: Date;
|
startAir: Date;
|
||||||
endAir: Date;
|
endAir: Date;
|
||||||
poster: string;
|
poster: string;
|
||||||
logo: string;
|
logo: string;
|
||||||
backdrop: string;
|
thumbnail: string;
|
||||||
|
|
||||||
externalIDs: ExternalID[];
|
externalIDs: ExternalID[];
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ export interface WatchItem
|
|||||||
duration: number;
|
duration: number;
|
||||||
releaseDate: string;
|
releaseDate: string;
|
||||||
isMovie: boolean;
|
isMovie: boolean;
|
||||||
|
|
||||||
poster: string;
|
poster: string;
|
||||||
backdrop: string;
|
backdrop: string;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
<mat-form-field class="w-100">
|
<mat-form-field class="w-100">
|
||||||
<mat-label>Trailer</mat-label>
|
<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>
|
||||||
|
|
||||||
<mat-form-field class="w-100">
|
<mat-form-field class="w-100">
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
<div class="controller container-fluid" id="controller">
|
<div class="controller container-fluid" id="controller">
|
||||||
<div class="img d-none d-sm-block">
|
<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>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h3 *ngIf="!this.item.isMovie">S{{this.item.seasonNumber}}:E{{this.item.episodeNumber}} - {{this.item.title}}</h3>
|
<h3 *ngIf="!this.item.isMovie">S{{this.item.seasonNumber}}:E{{this.item.episodeNumber}} - {{this.item.title}}</h3>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<div class="backdrop">
|
<div class="backdrop">
|
||||||
<img id="backdrop" [src]="this.show.backdrop" alt="backdrop" />
|
<img id="backdrop" [src]="this.show.thumbnail | fallback" alt="backdrop" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="header container pt-sm-5">
|
<div class="header container pt-sm-5">
|
||||||
@ -16,7 +16,7 @@
|
|||||||
<button mat-mini-fab matTooltipPosition="above" matTooltip="Play" class="mr-3" (click)="playClicked()">
|
<button mat-mini-fab matTooltipPosition="above" matTooltip="Play" class="mr-3" (click)="playClicked()">
|
||||||
<mat-icon>play_arrow</mat-icon>
|
<mat-icon>play_arrow</mat-icon>
|
||||||
</button>
|
</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>
|
<mat-icon>local_movies</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<a *ngIf="this.show.isMovie" [href]="'/video/' + this.show.slug" download>
|
<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, {
|
this.dialog.open(TrailerDialogComponent, {
|
||||||
width: "80%",
|
width: "80%",
|
||||||
height: "45vw",
|
height: "45vw",
|
||||||
data: this.show.trailerUrl,
|
data: this.show.trailer,
|
||||||
panelClass: "panel"
|
panelClass: "panel"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user