Got tv working, just need to do styling. I suck at this part !wip

pull/2089/head^2
tidusjar 7 years ago
parent df95962aa6
commit 3496cce670

@ -40,8 +40,8 @@ namespace Ombi.Core.Engine
public IEnumerable<RecentlyAddedTvModel> GetRecentlyAddedTv(DateTime from, DateTime to, bool groupBySeason)
{
var plexTv = _plex.GetAll().Where(x => x.Type == PlexMediaTypeEntity.Show && x.AddedAt > from && x.AddedAt < to);
var embyTv = _emby.GetAll().Where(x => x.Type == EmbyMediaType.Series && x.AddedAt > from && x.AddedAt < to);
var plexTv = _plex.GetAll().Include(x => x.Seasons).Include(x => x.Episodes).Where(x => x.Type == PlexMediaTypeEntity.Show && x.AddedAt > from && x.AddedAt < to);
var embyTv = _emby.GetAll().Include(x => x.Episodes).Where(x => x.Type == EmbyMediaType.Series && x.AddedAt > from && x.AddedAt < to);
return GetRecentlyAddedTv(plexTv, embyTv, groupBySeason).Take(30);
}
@ -49,8 +49,8 @@ namespace Ombi.Core.Engine
public IEnumerable<RecentlyAddedTvModel> GetRecentlyAddedTv(bool groupBySeason)
{
var plexTv = _plex.GetAll().Where(x => x.Type == PlexMediaTypeEntity.Show);
var embyTv = _emby.GetAll().Where(x => x.Type == EmbyMediaType.Series);
var plexTv = _plex.GetAll().Include(x => x.Seasons).Include(x => x.Episodes).Where(x => x.Type == PlexMediaTypeEntity.Show);
var embyTv = _emby.GetAll().Include(x => x.Episodes).Where(x => x.Type == EmbyMediaType.Series);
return GetRecentlyAddedTv(plexTv, embyTv, groupBySeason);
}

@ -15,6 +15,7 @@ export interface IRecentlyAddedMovies {
export interface IRecentlyAddedTvShows extends IRecentlyAddedMovies {
seasonNumber: number;
episodeNumber: number;
tvDbId: number;
}
export interface IRecentlyAddedRangeModel {

@ -1,13 +1,31 @@
<h1>Recently Added</h1>
<input type="checkbox" [(ngModel)]="groupTv" (click)="change()" />
<hr />
<p-calendar [(ngModel)]="range" showButtonBar="true" selectionMode="range" (onClose)="close()"></p-calendar>
<hr />
<style>
.img-conatiner {
position: relative;
text-align: center;
color: white;
}
/* Bottom left text */
.bottom-left {
position: absolute;
bottom: 8px;
left: 16px;
}
</style>
<ngu-carousel [inputs]="carouselTile">
<ngu-tile NguCarouselItem *ngFor="let movie of movies">
<img class="img-responsive poster" src="{{movie.posterPath}}" style="width: 300px" alt="poster">
<b>{{movie.title}}</b>
<div class="img-container">
<img class="img-responsive poster" src="{{movie.posterPath}}" style="width: 300px" alt="poster">
<div class="bottom-left"> {{movie.title}}</div>
</div>
</ngu-tile>
<button NguCarouselPrev class='leftRs'><i class="fa fa-arrow-left"></i></button>
@ -22,6 +40,10 @@
<ngu-tile NguCarouselItem *ngFor="let t of tv">
<img class="img-responsive poster" src="{{t.posterPath}}" style="width: 300px" alt="poster">
<b>{{t.title}}</b>
<br>
<b>Season: {{t.seasonNumber}}</b>
<br>
<b>Episode: {{t.episodeNumber}}</b>
</ngu-tile>
<button NguCarouselPrev class='leftRs'><i class="fa fa-arrow-left"></i></button>

@ -39,6 +39,8 @@ export class RecentlyAddedComponent implements OnInit {
public movies: IRecentlyAddedMovies[];
public tv: IRecentlyAddedTvShows[];
public range: Date[];
public groupTv: boolean;
// https://github.com/sheikalthaf/ngu-carousel
public carouselTile: NguCarousel;
@ -74,25 +76,33 @@ export class RecentlyAddedComponent implements OnInit {
}
this.getMovies();
}
public change() {
this.getShows();
}
private getShows() {
this.recentlyAddedService.getRecentlyAddedTv().subscribe(x => {
this.tv = x;
this.tv.forEach((t) => {
if(t.theMovieDbId) {
this.imageService.getTvPoster(t.imdbId).subscribe(p => {
t.posterPath = p;
if(this.groupTv) {
this.recentlyAddedService.getRecentlyAddedTvGrouped().subscribe(x => {
this.tv = x;
this.tv.forEach((t) => {
this.imageService.getTvPoster(t.tvDbId).subscribe(p => {
t.posterPath = p;
});
});
} else if(t.imdbId) {
this.imageService.getMoviePoster(t.imdbId).subscribe(p => {
});
} else {
this.recentlyAddedService.getRecentlyAddedTv().subscribe(x => {
this.tv = x;
this.tv.forEach((t) => {
this.imageService.getTvPoster(t.tvDbId).subscribe(p => {
t.posterPath = p;
});
} else {
t.posterPath = "";
}
});
});
});
}
}
private getMovies() {

@ -44,11 +44,15 @@ namespace Ombi.Controllers
}
if (images.tvbanner != null)
{
return images.tvbanner.FirstOrDefault()?.url ?? string.Empty;
var enImage = images.tvbanner.Where(x => x.lang == "en").OrderByDescending(x => x.likes).Select(x => x.url).FirstOrDefault();
if (enImage == null)
{
return images.tvbanner.OrderByDescending(x => x.likes).Select(x => x.url).FirstOrDefault();
}
}
if (images.showbackground != null)
if (images.seasonposter != null)
{
return images.showbackground.FirstOrDefault()?.url ?? string.Empty;
return images.seasonposter.FirstOrDefault()?.url ?? string.Empty;
}
return string.Empty;
}
@ -97,7 +101,12 @@ namespace Ombi.Controllers
if (images.tvposter?.Any() ?? false)
{
return images.tvposter.OrderBy(x => x.likes).Select(x => x.url).FirstOrDefault();
var enImage = images.tvposter.Where(x => x.lang == "en").OrderByDescending(x => x.likes).Select(x => x.url).FirstOrDefault();
if (enImage == null)
{
return images.tvposter.OrderByDescending(x => x.likes).Select(x => x.url).FirstOrDefault();
}
return enImage;
}
if (images.tvthumb?.Any() ?? false)

Loading…
Cancel
Save