mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Got tv working, just need to do styling. I suck at this part !wip
This commit is contained in:
parent
df95962aa6
commit
3496cce670
5 changed files with 67 additions and 25 deletions
|
@ -40,8 +40,8 @@ namespace Ombi.Core.Engine
|
||||||
|
|
||||||
public IEnumerable<RecentlyAddedTvModel> GetRecentlyAddedTv(DateTime from, DateTime to, bool groupBySeason)
|
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 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().Where(x => x.Type == EmbyMediaType.Series && 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);
|
return GetRecentlyAddedTv(plexTv, embyTv, groupBySeason).Take(30);
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ namespace Ombi.Core.Engine
|
||||||
|
|
||||||
public IEnumerable<RecentlyAddedTvModel> GetRecentlyAddedTv(bool groupBySeason)
|
public IEnumerable<RecentlyAddedTvModel> GetRecentlyAddedTv(bool groupBySeason)
|
||||||
{
|
{
|
||||||
var plexTv = _plex.GetAll().Where(x => x.Type == PlexMediaTypeEntity.Show);
|
var plexTv = _plex.GetAll().Include(x => x.Seasons).Include(x => x.Episodes).Where(x => x.Type == PlexMediaTypeEntity.Show);
|
||||||
var embyTv = _emby.GetAll().Where(x => x.Type == EmbyMediaType.Series);
|
var embyTv = _emby.GetAll().Include(x => x.Episodes).Where(x => x.Type == EmbyMediaType.Series);
|
||||||
|
|
||||||
return GetRecentlyAddedTv(plexTv, embyTv, groupBySeason);
|
return GetRecentlyAddedTv(plexTv, embyTv, groupBySeason);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ export interface IRecentlyAddedMovies {
|
||||||
export interface IRecentlyAddedTvShows extends IRecentlyAddedMovies {
|
export interface IRecentlyAddedTvShows extends IRecentlyAddedMovies {
|
||||||
seasonNumber: number;
|
seasonNumber: number;
|
||||||
episodeNumber: number;
|
episodeNumber: number;
|
||||||
|
tvDbId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRecentlyAddedRangeModel {
|
export interface IRecentlyAddedRangeModel {
|
||||||
|
|
|
@ -1,13 +1,31 @@
|
||||||
<h1>Recently Added</h1>
|
<h1>Recently Added</h1>
|
||||||
|
<input type="checkbox" [(ngModel)]="groupTv" (click)="change()" />
|
||||||
<hr />
|
<hr />
|
||||||
<p-calendar [(ngModel)]="range" showButtonBar="true" selectionMode="range" (onClose)="close()"></p-calendar>
|
<p-calendar [(ngModel)]="range" showButtonBar="true" selectionMode="range" (onClose)="close()"></p-calendar>
|
||||||
<hr />
|
<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-carousel [inputs]="carouselTile">
|
||||||
<ngu-tile NguCarouselItem *ngFor="let movie of movies">
|
<ngu-tile NguCarouselItem *ngFor="let movie of movies">
|
||||||
|
<div class="img-container">
|
||||||
<img class="img-responsive poster" src="{{movie.posterPath}}" style="width: 300px" alt="poster">
|
<img class="img-responsive poster" src="{{movie.posterPath}}" style="width: 300px" alt="poster">
|
||||||
<b>{{movie.title}}</b>
|
<div class="bottom-left"> {{movie.title}}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</ngu-tile>
|
</ngu-tile>
|
||||||
|
|
||||||
<button NguCarouselPrev class='leftRs'><i class="fa fa-arrow-left"></i></button>
|
<button NguCarouselPrev class='leftRs'><i class="fa fa-arrow-left"></i></button>
|
||||||
|
@ -22,6 +40,10 @@
|
||||||
<ngu-tile NguCarouselItem *ngFor="let t of tv">
|
<ngu-tile NguCarouselItem *ngFor="let t of tv">
|
||||||
<img class="img-responsive poster" src="{{t.posterPath}}" style="width: 300px" alt="poster">
|
<img class="img-responsive poster" src="{{t.posterPath}}" style="width: 300px" alt="poster">
|
||||||
<b>{{t.title}}</b>
|
<b>{{t.title}}</b>
|
||||||
|
<br>
|
||||||
|
<b>Season: {{t.seasonNumber}}</b>
|
||||||
|
<br>
|
||||||
|
<b>Episode: {{t.episodeNumber}}</b>
|
||||||
</ngu-tile>
|
</ngu-tile>
|
||||||
|
|
||||||
<button NguCarouselPrev class='leftRs'><i class="fa fa-arrow-left"></i></button>
|
<button NguCarouselPrev class='leftRs'><i class="fa fa-arrow-left"></i></button>
|
||||||
|
|
|
@ -40,6 +40,8 @@ export class RecentlyAddedComponent implements OnInit {
|
||||||
public tv: IRecentlyAddedTvShows[];
|
public tv: IRecentlyAddedTvShows[];
|
||||||
public range: Date[];
|
public range: Date[];
|
||||||
|
|
||||||
|
public groupTv: boolean;
|
||||||
|
|
||||||
// https://github.com/sheikalthaf/ngu-carousel
|
// https://github.com/sheikalthaf/ngu-carousel
|
||||||
public carouselTile: NguCarousel;
|
public carouselTile: NguCarousel;
|
||||||
|
|
||||||
|
@ -75,24 +77,32 @@ export class RecentlyAddedComponent implements OnInit {
|
||||||
this.getMovies();
|
this.getMovies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public change() {
|
||||||
|
this.getShows();
|
||||||
|
}
|
||||||
|
|
||||||
private getShows() {
|
private getShows() {
|
||||||
|
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 {
|
||||||
this.recentlyAddedService.getRecentlyAddedTv().subscribe(x => {
|
this.recentlyAddedService.getRecentlyAddedTv().subscribe(x => {
|
||||||
this.tv = x;
|
this.tv = x;
|
||||||
|
|
||||||
this.tv.forEach((t) => {
|
this.tv.forEach((t) => {
|
||||||
if(t.theMovieDbId) {
|
this.imageService.getTvPoster(t.tvDbId).subscribe(p => {
|
||||||
this.imageService.getTvPoster(t.imdbId).subscribe(p => {
|
|
||||||
t.posterPath = p;
|
t.posterPath = p;
|
||||||
});
|
});
|
||||||
} else if(t.imdbId) {
|
|
||||||
this.imageService.getMoviePoster(t.imdbId).subscribe(p => {
|
|
||||||
t.posterPath = p;
|
|
||||||
});
|
});
|
||||||
} else {
|
});
|
||||||
t.posterPath = "";
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getMovies() {
|
private getMovies() {
|
||||||
|
|
|
@ -44,11 +44,15 @@ namespace Ombi.Controllers
|
||||||
}
|
}
|
||||||
if (images.tvbanner != null)
|
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)
|
||||||
if (images.showbackground != null)
|
|
||||||
{
|
{
|
||||||
return images.showbackground.FirstOrDefault()?.url ?? string.Empty;
|
return images.tvbanner.OrderByDescending(x => x.likes).Select(x => x.url).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (images.seasonposter != null)
|
||||||
|
{
|
||||||
|
return images.seasonposter.FirstOrDefault()?.url ?? string.Empty;
|
||||||
}
|
}
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +101,12 @@ namespace Ombi.Controllers
|
||||||
|
|
||||||
if (images.tvposter?.Any() ?? false)
|
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)
|
if (images.tvthumb?.Any() ?? false)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue