Solving a few bugs and styling more.

This commit is contained in:
Zoe Roux 2019-09-02 16:45:40 +02:00
parent 37fdcfa2a3
commit bc695560ae
13 changed files with 252 additions and 95 deletions

View File

@ -1,6 +1,6 @@
<div class="root"> <div class="root">
<div class="episodes" id="episodes"> <div class="episodes" id="episodes">
<div class="episode" *ngFor="let episode of this.episodes" id="{{episode.episodeNumber}}"> <div class="episode" *ngFor="let episode of this.episodes" id="el-{{episode.episodeNumber}}">
<div class="img" [style.background-image]="sanitize(episode.thumb)"> <div class="img" [style.background-image]="sanitize(episode.thumb)">
<button mat-icon-button id="playBtn"><i class="material-icons playIcon">play_circle_outline</i></button> <button mat-icon-button id="playBtn"><i class="material-icons playIcon">play_circle_outline</i></button>
</div> </div>
@ -8,6 +8,6 @@
<p class="overview">{{episode.overview}}</p> <p class="overview">{{episode.overview}}</p>
</div> </div>
</div> </div>
<button mat-raised-button color="accent" class="scrollBtn d-none" id="leftBtn" (click)="scrollLeft()"><mat-icon>arrow_left</mat-icon></button> <button mat-raised-button color="accent" class="scrollBtn d-none" id="el-leftBtn" (click)="scrollLeft()"><mat-icon>arrow_left</mat-icon></button>
<button mat-raised-button color="accent" class="scrollBtn" id="rightBtn" (click)="scrollRight()"><mat-icon>arrow_right</mat-icon></button> <button mat-raised-button color="accent" class="scrollBtn" id="el-rightBtn" (click)="scrollRight()"><mat-icon>arrow_right</mat-icon></button>
</div> </div>

View File

@ -24,10 +24,34 @@
min-width: 100%; min-width: 100%;
flex-shrink: 0; flex-shrink: 0;
flex-direction: row; flex-direction: row;
visibility: hidden;
&:hover
{
visibility: visible;
}
&::-webkit-scrollbar
{
height: 4px;
background: transparent;
}
&::-webkit-scrollbar-thumb
{
background-color: #999;
border-radius: 90px;
&:hover
{
background-color: rgb(134, 127, 127);
}
}
} }
.episode .episode
{ {
visibility: visible;
display: inline-block; display: inline-block;
padding: .25rem; padding: .25rem;
flex-shrink: 0; flex-shrink: 0;
@ -82,15 +106,28 @@
{ {
font-weight: 600; font-weight: 600;
margin-bottom: 0; margin-bottom: 0;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
} }
.overview .overview
{ {
font-weight: 300; font-weight: 300;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
overflow: hidden;
} }
&:hover &:hover
{ {
.img
{
outline: solid var(--accentColor);
}
.title .title
{ {
text-decoration: underline; text-decoration: underline;
@ -121,14 +158,14 @@
bottom: 60%; bottom: 60%;
display: none; display: none;
&#leftBtn &#el-leftBtn
{ {
left: 0; left: 0;
padding-left: 10px; padding-left: 10px;
padding-right: 2px; padding-right: 2px;
} }
&#rightBtn &#el-rightBtn
{ {
right: 0; right: 0;
padding-right: 10px; padding-right: 10px;

View File

@ -29,25 +29,25 @@ export class EpisodesListComponent implements OnInit
let scroll: number = this.roundScroll(this.root.offsetWidth * 0.80); let scroll: number = this.roundScroll(this.root.offsetWidth * 0.80);
this.root.scrollBy({ top: 0, left: -scroll, behavior: "smooth" }); this.root.scrollBy({ top: 0, left: -scroll, behavior: "smooth" });
document.getElementById("rightBtn").classList.remove("d-none"); document.getElementById("el-rightBtn").classList.remove("d-none");
if (this.root.scrollLeft - scroll <= 0) if (this.root.scrollLeft - scroll <= 0)
document.getElementById("leftBtn").classList.add("d-none"); document.getElementById("el-leftBtn").classList.add("d-none");
} }
scrollRight() scrollRight()
{ {
let scroll: number = this.roundScroll(this.root.offsetWidth * 0.80); let scroll: number = this.roundScroll(this.root.offsetWidth * 0.80);
this.root.scrollBy({ top: 0, left: scroll, behavior: "smooth" }); this.root.scrollBy({ top: 0, left: scroll, behavior: "smooth" });
document.getElementById("leftBtn").classList.remove("d-none"); document.getElementById("el-leftBtn").classList.remove("d-none");
if (this.root.scrollLeft + scroll >= this.root.scrollWidth - this.root.clientWidth) if (this.root.scrollLeft + scroll >= this.root.scrollWidth - this.root.clientWidth)
document.getElementById("rightBtn").classList.add("d-none"); document.getElementById("el-rightBtn").classList.add("d-none");
} }
roundScroll(offset: number): number roundScroll(offset: number): number
{ {
let episodeSize: number = document.getElementById("1").scrollWidth; let episodeSize: number = document.getElementById("el-1").scrollWidth;
offset = Math.round(offset / episodeSize) * episodeSize; offset = Math.round(offset / episodeSize) * episodeSize;
if (offset == 0) if (offset == 0)

View File

@ -13,7 +13,7 @@
<button mat-mini-fab data-toggle="tooltip" data-placement="top" title="Play" class="mr-3"> <button mat-mini-fab data-toggle="tooltip" data-placement="top" title="Play" class="mr-3">
<mat-icon>play_arrow</mat-icon> <mat-icon>play_arrow</mat-icon>
</button> </button>
<button mat-icon-button data-toggle="tooltip" data-placement="top" title="Trailer"> <button *ngIf="this.show.trailerUrl" mat-icon-button data-toggle="tooltip" data-placement="top" title="Trailer">
<mat-icon>local_movies</mat-icon> <mat-icon>local_movies</mat-icon>
</button> </button>
<button mat-icon-button data-toggle="tooltip" data-placement="top" title="Download"> <button mat-icon-button data-toggle="tooltip" data-placement="top" title="Download">
@ -63,29 +63,27 @@
<div class="container-fluid"> <div class="container-fluid mt-3">
<mat-form-field> <mat-form-field>
<mat-label>Season</mat-label> <mat-label>Season</mat-label>
<mat-select [(value)]="season"> <mat-select [(value)]="season" (selectionChange)="getEpisodes()">
<mat-option *ngFor="let season of this.show.seasons" [value]="season.seasonNumber">{{season.title}}</mat-option> <mat-option *ngFor="let season of this.show.seasons" [value]="season.seasonNumber">{{season.title}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<app-episodes-list [episodes]="episodes"></app-episodes-list> <app-episodes-list [episodes]="episodes"></app-episodes-list>
<!--<div class="container-fluid"> <div class="container-fluid mt-5">
<div class="row"> <h3>Staff</h3>
<h3 class="col">Staff</h3> </div>
<div class="scroll-row" style="position: relative;"> <div class="scroll-row mb-5">
<button mat-raised-button color="accent" id="leftBtn"><mat-icon>arrow_left</mat-icon></button> <div class="people-container" id="peopleScroll">
<div class="justify-content-left people-container"> <a class="people" *ngFor="let people of this.show.people" routerLink="/people/{{people.slug}}">
<a class="people" *ngFor="let people of this.show.people" routerLink="/people/{{people.slug}}"> <img [style.background-image]="getPeopleIcon(people.slug)" />
<img [style.background-image]="getPeopleIcon(people.slug)" /> <p class="name">{{people.name}}</p>
<p class="title">{{people.name}}</p> <p class="role">{{people.role}}</p>
<p class="role">{{people.role}}</p> </a>
</a>
</div>
<button mat-fab id="rightBtn"></button>
</div>
</div> </div>
</div>--> <button mat-raised-button color="accent" class="scrollBtn d-none" id="pl-leftBtn" (click)="scrollLeft()"><mat-icon>arrow_left</mat-icon></button>
<button mat-raised-button color="accent" class="scrollBtn" id="pl-rightBtn" (click)="scrollRight()"><mat-icon>arrow_right</mat-icon></button>
</div>

View File

@ -116,47 +116,110 @@ hr
height: inherit; height: inherit;
} }
.scroll-row
{
position: relative;
&:hover
{
.scrollBtn
{
display: block;
}
}
}
.scrollBtn
{
padding: 0;
outline: none;
min-width: 0;
position: absolute;
top: 30%;
bottom: 40%;
display: none;
&#pl-leftBtn
{
left: 0;
padding-left: 10px;
padding-right: 2px;
}
&#pl-rightBtn
{
right: 0;
padding-right: 10px;
padding-left: 2px;
}
}
.people-container .people-container
{ {
display: flex; display: flex;
overflow: hidden; padding-left: 15px;
padding-right: 15px;
overflow-x: auto;
min-width: 100%;
flex-shrink: 0;
flex-direction: row;
visibility: hidden;
&:hover
{
visibility: visible;
}
&::-webkit-scrollbar
{
height: 4px;
background: transparent;
}
&::-webkit-scrollbar-thumb
{
background-color: #999;
border-radius: 90px;
&:hover
{
background-color: rgb(134, 127, 127);
}
}
} }
.people .people
{ {
width: 15%; visibility: visible;
margin: 1em; margin: .25rem;
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
outline: none; outline: none;
flex-shrink: 0; flex-shrink: 0;
flex-grow: 0; flex-grow: 0;
/*@include media-breakpoint-up(md) width: 33%;
{
width: 25%;
}
@include media-breakpoint-up(lg) @include media-breakpoint-up(sm)
{
width: 20%;
}
@include media-breakpoint-up(xl)
{
width: 18%;
}*/
/*&:focus, &:hover
{
> img
{ {
outline: solid var(--accentColor); width: 22%;
} }
> .title @include media-breakpoint-up(md)
{ {
text-decoration: underline; width: 20%;
} }
}*/
@include media-breakpoint-up(lg)
{
width: 15%;
}
@include media-breakpoint-up(xl)
{
width: 10%;
}
> img > img
{ {
width: 100%; width: 100%;
@ -184,6 +247,16 @@ hr
&:hover &:hover
{ {
cursor: pointer; cursor: pointer;
> img
{
outline: solid var(--accentColor);
}
.name
{
text-decoration: underline;
}
} }
} }

View File

@ -17,8 +17,9 @@ export class ShowDetailsComponent implements OnInit
episodes: Episode[] = null; episodes: Episode[] = null;
season: number; season: number;
private toolbar: HTMLElement private toolbar: HTMLElement;
private backdrop: HTMLElement private backdrop: HTMLElement;
private peopleScroll: HTMLElement;
constructor(private route: ActivatedRoute, private sanitizer: DomSanitizer, private http: HttpClient, private snackBar: MatSnackBar, private title: Title) constructor(private route: ActivatedRoute, private sanitizer: DomSanitizer, private http: HttpClient, private snackBar: MatSnackBar, private title: Title)
{ {
@ -34,10 +35,11 @@ export class ShowDetailsComponent implements OnInit
this.title.setTitle(this.show.title + " - Kyoo"); this.title.setTitle(this.show.title + " - Kyoo");
if (this.season == null || this.show.seasons.find(x => x.seasonNumber == this.season) == null) if (this.season == null || this.show.seasons.find(x => x.seasonNumber == this.season) == null)
this.season = this.show.seasons[0].seasonNumber; this.season = 1;
this.toolbar = document.getElementById("toolbar"); this.toolbar = document.getElementById("toolbar");
this.backdrop = document.getElementById("backdrop"); this.backdrop = document.getElementById("backdrop");
this.peopleScroll = document.getElementById("peopleScroll");
window.addEventListener("scroll", this.scroll, true); window.addEventListener("scroll", this.scroll, true);
this.toolbar.setAttribute("style", `background-color: rgba(0, 0, 0, 0) !important`); this.toolbar.setAttribute("style", `background-color: rgba(0, 0, 0, 0) !important`);
@ -48,6 +50,7 @@ export class ShowDetailsComponent implements OnInit
{ {
window.removeEventListener("scroll", this.scroll, true); window.removeEventListener("scroll", this.scroll, true);
this.title.setTitle("Kyoo"); this.title.setTitle("Kyoo");
this.toolbar.setAttribute("style", `background-color: #000000 !important`);
} }
scroll = () => scroll = () =>
@ -61,13 +64,13 @@ export class ShowDetailsComponent implements OnInit
if (this.show == null) if (this.show == null)
return; return;
if (this.show.seasons[this.season - 1].episodes != null) if (this.show.seasons.find(x => x.seasonNumber == this.season).episodes != null)
this.episodes = this.show.seasons[this.season - 1].episodes; this.episodes = this.show.seasons.find(x => x.seasonNumber == this.season).episodes;
this.http.get<Episode[]>("api/episodes/" + this.show.slug + "/season/" + this.season).subscribe((episodes: Episode[]) => this.http.get<Episode[]>("api/episodes/" + this.show.slug + "/season/" + this.season).subscribe((episodes: Episode[]) =>
{ {
this.show.seasons[this.season - 1].episodes = episodes; this.show.seasons.find(x => x.seasonNumber == this.season).episodes = episodes;
this.episodes = episodes; this.episodes = episodes;
}, error => }, error =>
{ {
@ -77,6 +80,27 @@ export class ShowDetailsComponent implements OnInit
} }
scrollLeft()
{
let scroll: number = this.peopleScroll.offsetWidth * 0.80;
this.peopleScroll.scrollBy({ top: 0, left: -scroll, behavior: "smooth" });
document.getElementById("pl-rightBtn").classList.remove("d-none");
if (this.peopleScroll.scrollLeft - scroll <= 0)
document.getElementById("pl-leftBtn").classList.add("d-none");
}
scrollRight()
{
let scroll: number = this.peopleScroll.offsetWidth * 0.80;
console.log("Scroll: " + scroll);
this.peopleScroll.scrollBy({ top: 0, left: scroll, behavior: "smooth" });
document.getElementById("pl-leftBtn").classList.remove("d-none");
if (this.peopleScroll.scrollLeft + scroll >= this.peopleScroll.scrollWidth - this.peopleScroll.clientWidth)
document.getElementById("pl-rightBtn").classList.add("d-none");
}
getPeopleIcon(slug: string) getPeopleIcon(slug: string)
{ {

View File

@ -8,6 +8,7 @@ export interface Show
//IEnumerable < > Aliases; //IEnumerable < > Aliases;
path: string; path: string;
overview: string; overview: string;
trailer: string;
//IEnumerable < > Genres; //IEnumerable < > Genres;
//Status ? Status; //Status ? Status;

View File

@ -7,7 +7,7 @@
$theme-colors: ( $theme-colors: (
"primary": #0a1128, "primary": #0a1128,
"secondary": #080708, "secondary": #000000,
"accentColor": #e23c00, "accentColor": #e23c00,
"textPrimary": #ffffff "textPrimary": #ffffff
); );

View File

@ -1,52 +1,72 @@
using Kyoo.InternalAPI; using Kyoo.InternalAPI;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using System.IO;
namespace Kyoo.Controllers namespace Kyoo.Controllers
{ {
public class ThumbnailController : Controller public class ThumbnailController : Controller
{ {
private ILibraryManager libraryManager; private readonly ILibraryManager libraryManager;
private readonly string peoplePath;
public ThumbnailController(ILibraryManager libraryManager)
public ThumbnailController(ILibraryManager libraryManager, IConfiguration config)
{ {
this.libraryManager = libraryManager; this.libraryManager = libraryManager;
peoplePath = config.GetValue<string>("peoplePath");
} }
[HttpGet("thumb/{showSlug}")] [HttpGet("thumb/{showSlug}")]
public IActionResult GetShowThumb(string showSlug) public IActionResult GetShowThumb(string showSlug)
{ {
string thumbPath = libraryManager.GetShowBySlug(showSlug)?.ImgPrimary; string path = libraryManager.GetShowBySlug(showSlug)?.Path;
if (thumbPath == null) if (path == null)
return NotFound(); return NotFound();
return new PhysicalFileResult(thumbPath, "image/jpg"); string thumb = Path.Combine(path, "poster.jpg");
if (System.IO.File.Exists(thumb))
return new PhysicalFileResult(thumb, "image/jpg");
else
return NotFound();
} }
[HttpGet("logo/{showSlug}")] [HttpGet("logo/{showSlug}")]
public IActionResult GetShowLogo(string showSlug) public IActionResult GetShowLogo(string showSlug)
{ {
string thumbPath = libraryManager.GetShowBySlug(showSlug)?.ImgLogo; string path = libraryManager.GetShowBySlug(showSlug)?.Path;
if (thumbPath == null) if (path == null)
return NotFound(); return NotFound();
return new PhysicalFileResult(thumbPath, "image/png"); string thumb = Path.Combine(path, "logo.png");
if (System.IO.File.Exists(thumb))
return new PhysicalFileResult(thumb, "image/jpg");
else
return NotFound();
} }
[HttpGet("backdrop/{showSlug}")] [HttpGet("backdrop/{showSlug}")]
public IActionResult GetShowBackground(string showSlug) public IActionResult GetShowBackdrop(string showSlug)
{ {
string thumbPath = libraryManager.GetShowBySlug(showSlug)?.ImgBackdrop; string path = libraryManager.GetShowBySlug(showSlug)?.Path;
if (thumbPath == null) if (path == null)
return NotFound(); return NotFound();
return new PhysicalFileResult(thumbPath, "image/jpg"); string thumb = Path.Combine(path, "backdrop.jpg");
if (System.IO.File.Exists(thumb))
return new PhysicalFileResult(thumb, "image/jpg");
else
return NotFound();
} }
[HttpGet("peopleimg/{peopleSlug}")] [HttpGet("peopleimg/{peopleSlug}")]
public IActionResult GetPeopleIcon(string peopleSlug) public IActionResult GetPeopleIcon(string peopleSlug)
{ {
string thumbPath = libraryManager.GetPeopleBySlug(peopleSlug)?.imgPrimary; string thumbPath = Path.Combine(peoplePath, peopleSlug + ".jpg");
if (thumbPath == null) if (!System.IO.File.Exists(thumbPath))
return NotFound(); return NotFound();
return new PhysicalFileResult(thumbPath, "image/jpg"); return new PhysicalFileResult(thumbPath, "image/jpg");
@ -55,11 +75,16 @@ namespace Kyoo.Controllers
[HttpGet("thumb/{showSlug}/s{seasonNumber}/e{episodeNumber}")] [HttpGet("thumb/{showSlug}/s{seasonNumber}/e{episodeNumber}")]
public IActionResult GetEpisodeThumb(string showSlug, long seasonNumber, long episodeNumber) public IActionResult GetEpisodeThumb(string showSlug, long seasonNumber, long episodeNumber)
{ {
string thumbPath = libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber)?.ImgPrimary; string path = libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber)?.Path;
if (thumbPath == null) if (path == null)
return NotFound(); return NotFound();
return new PhysicalFileResult(thumbPath, "image/jpg"); string thumb = Path.ChangeExtension(path, "jpg");
if (System.IO.File.Exists(thumb))
return new PhysicalFileResult(thumb, "image/jpg");
else
return NotFound();
} }
} }
} }

View File

@ -31,7 +31,8 @@ namespace Kyoo.InternalAPI
title TEXT, title TEXT,
aliases TEXT, aliases TEXT,
path TEXT UNIQUE, path TEXT UNIQUE,
overview TEXT, overview TEXT,
trailerUrl TEXT,
status TEXT, status TEXT,
startYear INTEGER, startYear INTEGER,
endYear INTEGER, endYear INTEGER,
@ -425,7 +426,7 @@ namespace Kyoo.InternalAPI
#region Check if items exists #region Check if items exists
public bool IsShowRegistered(string showPath) public bool IsShowRegistered(string showPath)
{ {
string query = "SELECT 1 FROM shows WHERE path = $path;"; string query = "SELECT (id) FROM shows WHERE path = $path;";
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection)) using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
{ {
cmd.Parameters.AddWithValue("$path", showPath); cmd.Parameters.AddWithValue("$path", showPath);
@ -436,7 +437,7 @@ namespace Kyoo.InternalAPI
public bool IsShowRegistered(string showPath, out long showID) public bool IsShowRegistered(string showPath, out long showID)
{ {
string query = "SELECT 1 FROM shows WHERE path = $path;"; string query = "SELECT (id) FROM shows WHERE path = $path;";
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection)) using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
{ {
cmd.Parameters.AddWithValue("$path", showPath); cmd.Parameters.AddWithValue("$path", showPath);
@ -448,7 +449,7 @@ namespace Kyoo.InternalAPI
public bool IsSeasonRegistered(long showID, long seasonNumber) public bool IsSeasonRegistered(long showID, long seasonNumber)
{ {
string query = "SELECT 1 FROM seasons WHERE showID = $showID AND seasonNumber = $seasonNumber;"; string query = "SELECT (id) FROM seasons WHERE showID = $showID AND seasonNumber = $seasonNumber;";
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection)) using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
{ {
cmd.Parameters.AddWithValue("$showID", showID); cmd.Parameters.AddWithValue("$showID", showID);
@ -460,7 +461,7 @@ namespace Kyoo.InternalAPI
public bool IsSeasonRegistered(long showID, long seasonNumber, out long seasonID) public bool IsSeasonRegistered(long showID, long seasonNumber, out long seasonID)
{ {
string query = "SELECT 1 FROM seasons WHERE showID = $showID AND seasonNumber = $seasonNumber;"; string query = "SELECT (id) FROM seasons WHERE showID = $showID AND seasonNumber = $seasonNumber;";
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection)) using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
{ {
cmd.Parameters.AddWithValue("$showID", showID); cmd.Parameters.AddWithValue("$showID", showID);
@ -473,7 +474,7 @@ namespace Kyoo.InternalAPI
public bool IsEpisodeRegistered(string episodePath) public bool IsEpisodeRegistered(string episodePath)
{ {
string query = "SELECT 1 FROM episodes WHERE path = $path;"; string query = "SELECT (id) FROM episodes WHERE path = $path;";
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection)) using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
{ {
cmd.Parameters.AddWithValue("$path", episodePath); cmd.Parameters.AddWithValue("$path", episodePath);
@ -524,7 +525,7 @@ namespace Kyoo.InternalAPI
#region Write Into The Database #region Write Into The Database
public long RegisterShow(Show show) public long RegisterShow(Show show)
{ {
string query = "INSERT INTO shows (slug, title, aliases, path, overview, startYear, endYear, imgPrimary, imgThumb, imgLogo, imgBackdrop, externalIDs) VALUES($slug, $title, $aliases, $path, $overview, $startYear, $endYear, $imgPrimary, $imgThumb, $imgLogo, $imgBackdrop, $externalIDs);"; string query = "INSERT INTO shows (slug, title, aliases, path, overview, trailerUrl, startYear, endYear, imgPrimary, imgThumb, imgLogo, imgBackdrop, externalIDs) VALUES($slug, $title, $aliases, $path, $overview, $trailerUrl, $startYear, $endYear, $imgPrimary, $imgThumb, $imgLogo, $imgBackdrop, $externalIDs);";
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection)) using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
{ {
cmd.Parameters.AddWithValue("$slug", show.Slug); cmd.Parameters.AddWithValue("$slug", show.Slug);
@ -532,6 +533,7 @@ namespace Kyoo.InternalAPI
cmd.Parameters.AddWithValue("$aliases", show.GetAliases()); cmd.Parameters.AddWithValue("$aliases", show.GetAliases());
cmd.Parameters.AddWithValue("$path", show.Path); cmd.Parameters.AddWithValue("$path", show.Path);
cmd.Parameters.AddWithValue("$overview", show.Overview); cmd.Parameters.AddWithValue("$overview", show.Overview);
cmd.Parameters.AddWithValue("$trailerUrl", show.TrailerUrl);
cmd.Parameters.AddWithValue("$status", show.Status); cmd.Parameters.AddWithValue("$status", show.Status);
cmd.Parameters.AddWithValue("$startYear", show.StartYear); cmd.Parameters.AddWithValue("$startYear", show.StartYear);
cmd.Parameters.AddWithValue("$endYear", show.EndYear); cmd.Parameters.AddWithValue("$endYear", show.EndYear);

View File

@ -118,6 +118,7 @@ namespace Kyoo.InternalAPI.MetadataProvider
data.aliases, data.aliases,
showPath, showPath,
data.overview, data.overview,
null, //trailer
null, //genres (no info with this request) null, //genres (no info with this request)
GetStatus(data.status), GetStatus(data.status),
GetYear(data.firstAired), GetYear(data.firstAired),
@ -176,6 +177,7 @@ namespace Kyoo.InternalAPI.MetadataProvider
data.aliases, data.aliases,
null, //Path null, //Path
data.overview, data.overview,
null, //Trailer
GetGenres(data.genre), GetGenres(data.genre),
GetStatus(data.status), GetStatus(data.status),
GetYear(data.firstAired), GetYear(data.firstAired),
@ -281,10 +283,7 @@ namespace Kyoo.InternalAPI.MetadataProvider
if (token == null) if (token == null)
return null; return null;
int page = (int)episodeNumber / 100 + 1; WebRequest request = WebRequest.Create("https://api.thetvdb.com/series/" + id + "/episodes/query?airedSeason=" + seasonNumber + "&airedEpisode=" + episodeNumber);
int index = (int)episodeNumber % 100 - 1; //The -1 is for array binding
WebRequest request = WebRequest.Create("https://api.thetvdb.com/series/" + id + "/episodes?page=" + page);
request.Method = "GET"; request.Method = "GET";
request.Timeout = 12000; request.Timeout = 12000;
request.ContentType = "application/json"; request.ContentType = "application/json";
@ -304,7 +303,7 @@ namespace Kyoo.InternalAPI.MetadataProvider
response.Close(); response.Close();
dynamic data = JsonConvert.DeserializeObject(content); dynamic data = JsonConvert.DeserializeObject(content);
dynamic episode = data.data[index]; dynamic episode = data.data[0];
DateTime dateTime = DateTime.ParseExact((string)episode.firstAired, "yyyy-MM-dd", CultureInfo.InvariantCulture); DateTime dateTime = DateTime.ParseExact((string)episode.firstAired, "yyyy-MM-dd", CultureInfo.InvariantCulture);
return new Episode(seasonNumber, episodeNumber, (string)episode.episodeName, (string)episode.overview, dateTime, -1, "https://www.thetvdb.com/banners/" + episode.filename, string.Format("TvDB={0}|", episode.id)); return new Episode(seasonNumber, episodeNumber, (string)episode.episodeName, (string)episode.overview, dateTime, -1, "https://www.thetvdb.com/banners/" + episode.filename, string.Format("TvDB={0}|", episode.id));

View File

@ -34,7 +34,6 @@ namespace Kyoo.InternalAPI.ThumbnailsManager
} }
} }
} }
show.ImgPrimary = localThumb;
if (show.ImgLogo != null) if (show.ImgLogo != null)
{ {
@ -46,7 +45,6 @@ namespace Kyoo.InternalAPI.ThumbnailsManager
} }
} }
} }
show.ImgLogo = localLogo;
if (show.ImgBackdrop != null) if (show.ImgBackdrop != null)
{ {
@ -58,7 +56,6 @@ namespace Kyoo.InternalAPI.ThumbnailsManager
} }
} }
} }
show.ImgBackdrop = localBackdrop;
return show; return show;
} }
@ -79,8 +76,6 @@ namespace Kyoo.InternalAPI.ThumbnailsManager
client.DownloadFileAsync(new Uri(people[i].imgPrimary), localThumb); client.DownloadFileAsync(new Uri(people[i].imgPrimary), localThumb);
} }
} }
people[i].imgPrimary = localThumb;
} }
return people; return people;
@ -97,7 +92,6 @@ namespace Kyoo.InternalAPI.ThumbnailsManager
} }
} }
episode.ImgPrimary = localThumb;
return episode; return episode;
} }
} }

View File

@ -16,6 +16,7 @@ namespace Kyoo.Models
public string Overview; public string Overview;
public IEnumerable<Genre> Genres; public IEnumerable<Genre> Genres;
public Status? Status; public Status? Status;
public string TrailerUrl;
public long? StartYear; public long? StartYear;
public long? EndYear; public long? EndYear;
@ -53,7 +54,7 @@ namespace Kyoo.Models
public Show() { } public Show() { }
public Show(long id, string slug, string title, IEnumerable<string> aliases, string path, string overview, IEnumerable<Genre> genres, Status? status, long? startYear, long? endYear, string externalIDs) public Show(long id, string slug, string title, IEnumerable<string> aliases, string path, string overview, string trailerUrl, IEnumerable<Genre> genres, Status? status, long? startYear, long? endYear, string externalIDs)
{ {
this.id = id; this.id = id;
Slug = slug; Slug = slug;
@ -61,6 +62,7 @@ namespace Kyoo.Models
Aliases = aliases; Aliases = aliases;
Path = path; Path = path;
Overview = overview; Overview = overview;
TrailerUrl = trailerUrl;
Genres = genres; Genres = genres;
Status = status; Status = status;
StartYear = startYear; StartYear = startYear;
@ -68,7 +70,7 @@ namespace Kyoo.Models
ExternalIDs = externalIDs; ExternalIDs = externalIDs;
} }
public Show(long id, string slug, string title, IEnumerable<string> aliases, string path, string overview, Status? status, long? startYear, long? endYear, string imgPrimary, string imgThumb, string imgLogo, string imgBackdrop, string externalIDs) public Show(long id, string slug, string title, IEnumerable<string> aliases, string path, string overview, string trailerUrl, Status? status, long? startYear, long? endYear, string imgPrimary, string imgThumb, string imgLogo, string imgBackdrop, string externalIDs)
{ {
this.id = id; this.id = id;
Slug = slug; Slug = slug;
@ -76,6 +78,7 @@ namespace Kyoo.Models
Aliases = aliases; Aliases = aliases;
Path = path; Path = path;
Overview = overview; Overview = overview;
TrailerUrl = trailerUrl;
Status = status; Status = status;
StartYear = startYear; StartYear = startYear;
EndYear = endYear; EndYear = endYear;
@ -94,6 +97,7 @@ namespace Kyoo.Models
(reader["aliases"] as string)?.Split('|') ?? null, (reader["aliases"] as string)?.Split('|') ?? null,
reader["path"] as string, reader["path"] as string,
reader["overview"] as string, reader["overview"] as string,
reader["trailerUrl"] as string,
reader["status"] as Status?, reader["status"] as Status?,
reader["startYear"] as long?, reader["startYear"] as long?,
reader["endYear"] as long?, reader["endYear"] as long?,