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
@@ -70,7 +70,7 @@ export class EntryPageComponent implements OnInit {
|
||||
this.route.data.subscribe(
|
||||
(data) => {
|
||||
this.entry = data['entry'] as Entry;
|
||||
// console.log(this.entry);
|
||||
this.entry.isInLibrary = true;
|
||||
|
||||
if (this.entry.is_tvseries) {
|
||||
// ? sorting seasons
|
||||
@@ -98,6 +98,7 @@ export class EntryPageComponent implements OnInit {
|
||||
{
|
||||
tapToDismiss: true,
|
||||
progressBar: true,
|
||||
positionClass: 'bottom-right',
|
||||
progressAnimation: 'increasing',
|
||||
}
|
||||
);
|
||||
@@ -205,6 +206,7 @@ export class EntryPageComponent implements OnInit {
|
||||
this.toastr.success('success', `Removed successfuly.`, {
|
||||
tapToDismiss: true,
|
||||
progressBar: true,
|
||||
positionClass: 'bottom-right',
|
||||
progressAnimation: 'increasing',
|
||||
});
|
||||
this.entry.entrySeen = this.entry.entrySeen.filter(
|
||||
@@ -279,7 +281,12 @@ export class EntryPageComponent implements OnInit {
|
||||
next: (entry) => {
|
||||
this.entry = entry;
|
||||
// console.log(`Entry refreched: `, entry);
|
||||
// TODO show updated notification
|
||||
this.toastr.success(`Movie refreshed successfuly.`, 'Success', {
|
||||
tapToDismiss: true,
|
||||
progressBar: true,
|
||||
positionClass: 'bottom-right',
|
||||
progressAnimation: 'increasing',
|
||||
});
|
||||
},
|
||||
error: (error) => {
|
||||
// TODO show error notification
|
||||
@@ -484,13 +491,45 @@ export class EntryPageComponent implements OnInit {
|
||||
this.showAll = !this.showAll;
|
||||
}
|
||||
|
||||
enlargePoster() {
|
||||
redirectToTmdb() {
|
||||
let type = this.entry.is_tvseries ? 'tv' : 'movie';
|
||||
window.open(
|
||||
'https://image.tmdb.org/t/p/original' + this.entry.poster_path,
|
||||
`https://www.themoviedb.org/${type}/${this.entry.entryId.tmdb_id}`,
|
||||
'_blank'
|
||||
);
|
||||
}
|
||||
|
||||
enlargePoster() {
|
||||
let poster;
|
||||
// * Not in library, use TMDB poster
|
||||
if (!this.entry.isInLibrary)
|
||||
poster = `https://image.tmdb.org/t/p/w300` + this.entry.poster_path;
|
||||
|
||||
// * Is in library: use a local poster
|
||||
if (!poster && this.entry.medias) {
|
||||
const selectedPosters = this.entry.medias.filter(
|
||||
(m) => m.type == 'poster' && m.is_selected
|
||||
);
|
||||
|
||||
if (
|
||||
selectedPosters.length &&
|
||||
selectedPosters[0] &&
|
||||
selectedPosters[0].path
|
||||
) {
|
||||
poster = `http://localhost:4000/api/v1/media/entries/posters/${selectedPosters[0].path}`;
|
||||
}
|
||||
}
|
||||
|
||||
// * No local poster available, Use TMDB poster
|
||||
if (!poster && this.entry.poster_path)
|
||||
poster = `https://image.tmdb.org/t/p/original` + this.entry.poster_path;
|
||||
|
||||
// * No poster found, use default poster image as a last stand
|
||||
if (!poster) poster = 'assets/images/default/default-poster.png';
|
||||
|
||||
window.open(poster, '_blank');
|
||||
}
|
||||
|
||||
// * getters
|
||||
get status() {
|
||||
return this.entry.status;
|
||||
@@ -505,17 +544,55 @@ export class EntryPageComponent implements OnInit {
|
||||
}
|
||||
|
||||
get poster(): string {
|
||||
if (this.entry.poster_path == null)
|
||||
return 'assets/images/default/default-poster.png';
|
||||
// * 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
|
||||
) {
|
||||
return `http://localhost:4000/api/v1/media/entries/posters/${selectedPosters[0].path}`;
|
||||
}
|
||||
}
|
||||
|
||||
// * 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';
|
||||
}
|
||||
|
||||
get banner(): string {
|
||||
if (this.entry.banner_path == null)
|
||||
return 'assets/images/default/default-poster.png';
|
||||
// * Is in library: use a local backdrop
|
||||
if (this.entry.medias) {
|
||||
const selectedBackdrop = this.entry.medias.filter(
|
||||
(m) => m.type == 'backdrop' && m.is_selected
|
||||
);
|
||||
|
||||
return `https://image.tmdb.org/t/p/w1280` + this.entry.banner_path;
|
||||
if (
|
||||
selectedBackdrop.length &&
|
||||
selectedBackdrop[0] &&
|
||||
selectedBackdrop[0].path
|
||||
) {
|
||||
return `http://localhost:4000/api/v1/media/entries/backdrops/${selectedBackdrop[0].path}`;
|
||||
}
|
||||
}
|
||||
|
||||
// * No local backdrop available, Use TMDB backdrop
|
||||
if (this.entry.banner_path)
|
||||
return `https://image.tmdb.org/t/p/w1280` + this.entry.banner_path;
|
||||
|
||||
// * No backdrop found, use default backdrop image as a last stand
|
||||
return 'assets/images/default/default-poster.png';
|
||||
}
|
||||
|
||||
get nextEpisode() {
|
||||
|
||||
Reference in new issue
Block a user