add media download service and started using it
This commit is contained in:
1 parent
78399912f7
commit
06be888123
12 files changed
+614
-80
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
||||
<div class="movie-card" @fadeInOut>
|
||||
<div class="card-head">
|
||||
<img class="card-img" [src]="getPostPath()" alt="Movie Poster">
|
||||
<img class="card-img" [src]="posterPath" alt="Movie Poster">
|
||||
|
||||
<div class="card-overlay">
|
||||
<div class="rating">
|
||||
|
||||
+28
-8
@@ -1,6 +1,5 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { LibraryService } from '../../../../core/services/library.service';
|
||||
import { Entry } from '../../../../shared/models/entry.model';
|
||||
import { trigger, transition, style, animate } from '@angular/animations';
|
||||
import { UserCollectionService } from '../../../../core/services/userCollection.service';
|
||||
@@ -27,14 +26,12 @@ export class UserCollectionGridCardComponent implements OnInit {
|
||||
@Output() refrechEvent = new EventEmitter();
|
||||
|
||||
constructor(
|
||||
private libraryService: LibraryService,
|
||||
private userCollectionService: UserCollectionService,
|
||||
public dialog: MatDialog,
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
ngOnInit(): void {}
|
||||
|
||||
get releaseYear(): number {
|
||||
return new Date(this.entry.release_date).getFullYear();
|
||||
@@ -49,13 +46,36 @@ export class UserCollectionGridCardComponent implements OnInit {
|
||||
return `https://www.themoviedb.org/${type}/${this.entry.entryId.tmdb_id}`;
|
||||
}
|
||||
|
||||
getPostPath() {
|
||||
if (this.entry.poster_path == null) return 'https://pic.pnnet.dev/256x256';
|
||||
get posterPath() {
|
||||
// * Not in library, use TMDB poster
|
||||
if (!this.entry.isInLibrary)
|
||||
return `https://image.tmdb.org/t/p/w300` + this.entry.poster_path;
|
||||
|
||||
return `https://image.tmdb.org/t/p/w500` + this.entry.poster_path;
|
||||
// * Is in library: use a local poster
|
||||
if (this.entry.medias) {
|
||||
const selectedPosters = this.entry.medias.filter(
|
||||
(m) => m.type == 'poster' && m.is_selected
|
||||
);
|
||||
|
||||
if (
|
||||
selectedPosters.length &&
|
||||
selectedPosters[0] &&
|
||||
selectedPosters[0].path
|
||||
) {
|
||||
const name = selectedPosters[0].path.split('.')[0];
|
||||
const extention = selectedPosters[0].path.split('.')[1];
|
||||
return `http://localhost:4000/api/v1/media/entries/posters/${name}_preview.${extention}`;
|
||||
}
|
||||
}
|
||||
|
||||
// * No local poster available, Use TMDB poster
|
||||
if (this.entry.poster_path)
|
||||
return `https://image.tmdb.org/t/p/w300` + this.entry.poster_path;
|
||||
|
||||
// * No poster found, use default poster image as a last stand
|
||||
return 'assets/images/default/default-poster.png';
|
||||
}
|
||||
|
||||
|
||||
removeEntryFromList() {
|
||||
const dialogRef = this.dialog.open(ConfirmModalComponent, {
|
||||
width: '400px',
|
||||
|
||||
Reference in new issue
Block a user