diff --git a/Kyoo.Common/Models/Episode.cs b/Kyoo.Common/Models/Episode.cs index 0fd1efa3..8172aaa0 100644 --- a/Kyoo.Common/Models/Episode.cs +++ b/Kyoo.Common/Models/Episode.cs @@ -25,7 +25,7 @@ namespace Kyoo.Models [JsonIgnore] public string ImgPrimary { get; set; } public string ExternalIDs { get; set; } - public virtual IEnumerable Tracks { get; set; } + [JsonIgnore] public virtual IEnumerable Tracks { get; set; } public string ShowTitle; //Used in the API response only public string Link; //Used in the API response only diff --git a/Kyoo.Common/Models/Show.cs b/Kyoo.Common/Models/Show.cs index 10f3f4b7..141fa0f7 100644 --- a/Kyoo.Common/Models/Show.cs +++ b/Kyoo.Common/Models/Show.cs @@ -29,15 +29,15 @@ namespace Kyoo.Models public bool IsCollection; - public virtual IEnumerable Genres + [JsonIgnore] public virtual IEnumerable Genres { get { return GenreLinks?.Select(x => x.Genre).OrderBy(x => x.Name); } set { GenreLinks = value?.Select(x => new GenreLink(this, x)).ToList(); } } [JsonIgnore] public virtual List GenreLinks { get; set; } - public virtual Studio Studio { get; set; } - public virtual IEnumerable People { get; set; } - public virtual IEnumerable Seasons { get; set; } + [JsonIgnore] public virtual Studio Studio { get; set; } + [JsonIgnore] public virtual IEnumerable People { get; set; } + [JsonIgnore] public virtual IEnumerable Seasons { get; set; } [JsonIgnore] public virtual IEnumerable Episodes { get; set; } diff --git a/Kyoo/Controllers/LibraryManager.cs b/Kyoo/Controllers/LibraryManager.cs index 49c91c08..2a945cc3 100644 --- a/Kyoo/Controllers/LibraryManager.cs +++ b/Kyoo/Controllers/LibraryManager.cs @@ -67,6 +67,7 @@ namespace Kyoo.Controllers public IEnumerable GetShows(string searchQuery) { + // TODO use case insensitive queries. return (from show in _database.Shows from l in _database.CollectionLinks.DefaultIfEmpty() where l.CollectionID == null select show).AsEnumerable().Union( from collection in _database.Collections select collection.AsShow()) diff --git a/Kyoo/HtmlAPI/AdminAPI.cs b/Kyoo/HtmlAPI/AdminAPI.cs index 22c23900..346631a0 100644 --- a/Kyoo/HtmlAPI/AdminAPI.cs +++ b/Kyoo/HtmlAPI/AdminAPI.cs @@ -1,7 +1,8 @@ using Microsoft.AspNetCore.Mvc; using System.Threading; +using Kyoo.Controllers; -namespace Kyoo.Controllers +namespace Kyoo.Api { [Route("api/[controller]")] [ApiController] diff --git a/Kyoo/HtmlAPI/AuthentificationAPI.cs b/Kyoo/HtmlAPI/AuthentificationAPI.cs index 264bb3a8..1b60a9ee 100644 --- a/Kyoo/HtmlAPI/AuthentificationAPI.cs +++ b/Kyoo/HtmlAPI/AuthentificationAPI.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -namespace Kyoo.Controllers +namespace Kyoo.Api { public class AuthentificationAPI : Controller { diff --git a/Kyoo/HtmlAPI/CollectionAPI.cs b/Kyoo/HtmlAPI/CollectionAPI.cs index 8d1a8543..ae38b302 100644 --- a/Kyoo/HtmlAPI/CollectionAPI.cs +++ b/Kyoo/HtmlAPI/CollectionAPI.cs @@ -3,23 +3,23 @@ using Kyoo.Models; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; -namespace Kyoo.Controllers +namespace Kyoo.Api { [Route("api/[controller]")] [ApiController] public class CollectionController : ControllerBase { - private readonly ILibraryManager libraryManager; + private readonly ILibraryManager _libraryManager; public CollectionController(ILibraryManager libraryManager) { - this.libraryManager = libraryManager; + _libraryManager = libraryManager; } [HttpGet("{collectionSlug}")] public ActionResult GetShows(string collectionSlug) { - Collection collection = libraryManager.GetCollection(collectionSlug); + Collection collection = _libraryManager.GetCollection(collectionSlug); if (collection == null) return NotFound(); diff --git a/Kyoo/HtmlAPI/EpisodesAPI.cs b/Kyoo/HtmlAPI/EpisodesAPI.cs index 435cae9e..49ccab37 100644 --- a/Kyoo/HtmlAPI/EpisodesAPI.cs +++ b/Kyoo/HtmlAPI/EpisodesAPI.cs @@ -2,8 +2,9 @@ using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Linq; +using Kyoo.Controllers; -namespace Kyoo.Controllers +namespace Kyoo.Api { [Route("api/[controller]")] [ApiController] @@ -28,6 +29,7 @@ namespace Kyoo.Controllers } [HttpGet("{showSlug}/season/{seasonNumber}/episode/{episodeNumber}")] + [JsonDetailed] public ActionResult GetEpisode(string showSlug, long seasonNumber, long episodeNumber) { Episode episode = _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); diff --git a/Kyoo/HtmlAPI/JsonSerializer.cs b/Kyoo/HtmlAPI/JsonSerializer.cs new file mode 100644 index 00000000..7218272c --- /dev/null +++ b/Kyoo/HtmlAPI/JsonSerializer.cs @@ -0,0 +1,89 @@ +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Reflection; +using Kyoo.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.Formatters; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Kyoo.Controllers +{ + public class JsonPropertySelector : DefaultContractResolver + { + private readonly Dictionary> _ignored; + private readonly Dictionary> _forceSerialize; + + public JsonPropertySelector() + { + _ignored = new Dictionary>(); + _forceSerialize = new Dictionary>(); + } + + public JsonPropertySelector(Dictionary> ignored, Dictionary> forceSerialize) + { + _ignored = ignored ?? new Dictionary>(); + _forceSerialize = forceSerialize ?? new Dictionary>(); + } + + private bool IsIgnored(Type type, string propertyName) + { + if (_ignored.ContainsKey(type) && _ignored[type].Contains(propertyName)) + return true; + if (type.BaseType == null) + return false; + return _ignored.ContainsKey(type.BaseType) && _ignored[type.BaseType].Contains(propertyName); + } + + private bool IsSerializationForced(Type type, string propertyName) + { + if (_forceSerialize.ContainsKey(type) && _forceSerialize[type].Contains(propertyName)) + return true; + if (type.BaseType == null) + return false; + return _forceSerialize.ContainsKey(type.BaseType) && _forceSerialize[type.BaseType].Contains(propertyName); + } + + protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) + { + JsonProperty property = base.CreateProperty(member, memberSerialization); + + if (IsIgnored(property.DeclaringType, property.PropertyName)) + { + property.ShouldSerialize = i => false; + property.Ignored = true; + } + else if (IsSerializationForced(property.DeclaringType, property.PropertyName)) + { + property.ShouldSerialize = i => true; + property.Ignored = false; + } + return property; + } + } + + public class JsonDetailed : ActionFilterAttribute + { + public override void OnActionExecuted(ActionExecutedContext context) + { + if (context.Result is ObjectResult result) + { + result.Formatters.Add(new NewtonsoftJsonOutputFormatter( + new JsonSerializerSettings + { + ContractResolver = new JsonPropertySelector(null, new Dictionary>() + { + {typeof(Show), new HashSet {"Genres", "Studio", "People", "Seasons"}}, + {typeof(Episode), new HashSet {"Tracks"}} + }) + }, + context.HttpContext.RequestServices.GetRequiredService>(), + context.HttpContext.RequestServices.GetRequiredService>().Value)); + } + } + } +} \ No newline at end of file diff --git a/Kyoo/HtmlAPI/LibrariesAPI.cs b/Kyoo/HtmlAPI/LibrariesAPI.cs index fa466b5d..e1c985e9 100644 --- a/Kyoo/HtmlAPI/LibrariesAPI.cs +++ b/Kyoo/HtmlAPI/LibrariesAPI.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Linq; -namespace Kyoo.Controllers +namespace Kyoo.Api { [Route("api/libraries")] [ApiController] diff --git a/Kyoo/HtmlAPI/PeopleAPI.cs b/Kyoo/HtmlAPI/PeopleAPI.cs index 4fae762b..84f7b3f8 100644 --- a/Kyoo/HtmlAPI/PeopleAPI.cs +++ b/Kyoo/HtmlAPI/PeopleAPI.cs @@ -1,31 +1,30 @@ using Kyoo.Controllers; using Kyoo.Models; using Microsoft.AspNetCore.Mvc; -using System.Diagnostics; -namespace Kyoo.Controllers +namespace Kyoo.Api { [Route("api/[controller]")] [ApiController] public class PeopleController : ControllerBase { - private readonly ILibraryManager libraryManager; + private readonly ILibraryManager _libraryManager; public PeopleController(ILibraryManager libraryManager) { - this.libraryManager = libraryManager; + _libraryManager = libraryManager; } [HttpGet("{peopleSlug}")] public ActionResult GetPeople(string peopleSlug) { - People people = libraryManager.GetPeopleBySlug(peopleSlug); + People people = _libraryManager.GetPeopleBySlug(peopleSlug); if (people == null) return NotFound(); Collection collection = new Collection(people.Slug, people.Name, null, null) { - Shows = libraryManager.GetShowsByPeople(people.ID), + Shows = _libraryManager.GetShowsByPeople(people.ID), Poster = "peopleimg/" + people.Slug }; return collection; diff --git a/Kyoo/HtmlAPI/SearchAPI.cs b/Kyoo/HtmlAPI/SearchAPI.cs index f7527791..1d95fd24 100644 --- a/Kyoo/HtmlAPI/SearchAPI.cs +++ b/Kyoo/HtmlAPI/SearchAPI.cs @@ -2,7 +2,7 @@ using Kyoo.Models; using Microsoft.AspNetCore.Mvc; -namespace Kyoo.Controllers +namespace Kyoo.Api { [Route("api/[controller]")] [ApiController] diff --git a/Kyoo/HtmlAPI/ShowsAPI.cs b/Kyoo/HtmlAPI/ShowsAPI.cs index 436f6c45..77c87a43 100644 --- a/Kyoo/HtmlAPI/ShowsAPI.cs +++ b/Kyoo/HtmlAPI/ShowsAPI.cs @@ -1,35 +1,36 @@ -using Kyoo.Controllers; -using Kyoo.Models; +using Kyoo.Models; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; +using Kyoo.Controllers; -namespace Kyoo.Controllers +namespace Kyoo.Api { [Route("api/shows")] [ApiController] public class ShowsController : ControllerBase { - private readonly ILibraryManager libraryManager; + private readonly ILibraryManager _libraryManager; public ShowsController(ILibraryManager libraryManager) { - this.libraryManager = libraryManager; + _libraryManager = libraryManager; } [HttpGet] public IEnumerable GetShows() { - return libraryManager.GetShows(); + return _libraryManager.GetShows(); } [HttpGet("{slug}")] + [JsonDetailed] public ActionResult GetShow(string slug) { - Show show = libraryManager.GetShowBySlug(slug); + Show show = _libraryManager.GetShowBySlug(slug); if (show == null) return NotFound(); - + return show; } } diff --git a/Kyoo/HtmlAPI/SubtitleAPI.cs b/Kyoo/HtmlAPI/SubtitleAPI.cs index 3ce9bbeb..11119cef 100644 --- a/Kyoo/HtmlAPI/SubtitleAPI.cs +++ b/Kyoo/HtmlAPI/SubtitleAPI.cs @@ -3,20 +3,21 @@ using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using Kyoo.Controllers; -namespace Kyoo.Controllers +namespace Kyoo.Api { [Route("[controller]")] [ApiController] public class SubtitleController : ControllerBase { - private readonly ILibraryManager libraryManager; - private readonly ITranscoder transcoder; + private readonly ILibraryManager _libraryManager; + private readonly ITranscoder _transcoder; public SubtitleController(ILibraryManager libraryManager, ITranscoder transcoder) { - this.libraryManager = libraryManager; - this.transcoder = transcoder; + _libraryManager = libraryManager; + _transcoder = transcoder; } [HttpGet("{showSlug}-s{seasonNumber:int}e{episodeNumber:int}.{identifier}.{extension?}")] @@ -25,7 +26,7 @@ namespace Kyoo.Controllers string languageTag = identifier.Substring(0, 3); bool forced = identifier.Length > 3 && identifier.Substring(4) == "forced"; - Track subtitle = libraryManager.GetSubtitle(showSlug, seasonNumber, episodeNumber, languageTag, forced); + Track subtitle = _libraryManager.GetSubtitle(showSlug, seasonNumber, episodeNumber, languageTag, forced); if (subtitle == null) return NotFound(); @@ -49,14 +50,14 @@ namespace Kyoo.Controllers [HttpGet("extract/{showSlug}-s{seasonNumber}e{episodeNumber}")] public async Task ExtractSubtitle(string showSlug, long seasonNumber, long episodeNumber) { - Episode episode = libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); - libraryManager.ClearSubtitles(episode.ID); + Episode episode = _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); + _libraryManager.ClearSubtitles(episode.ID); - Track[] tracks = await transcoder.ExtractSubtitles(episode.Path); + Track[] tracks = await _transcoder.ExtractSubtitles(episode.Path); foreach (Track track in tracks) { track.EpisodeID = episode.ID; - libraryManager.RegisterTrack(track); + _libraryManager.RegisterTrack(track); } return "Done. " + tracks.Length + " track(s) extracted."; @@ -65,16 +66,16 @@ namespace Kyoo.Controllers [HttpGet("extract/{showSlug}")] public async Task ExtractSubtitle(string showSlug) { - IEnumerable episodes = libraryManager.GetEpisodes(showSlug); + IEnumerable episodes = _libraryManager.GetEpisodes(showSlug); foreach (Episode episode in episodes) { - libraryManager.ClearSubtitles(episode.ID); + _libraryManager.ClearSubtitles(episode.ID); - Track[] tracks = await transcoder.ExtractSubtitles(episode.Path); + Track[] tracks = await _transcoder.ExtractSubtitles(episode.Path); foreach (Track track in tracks) { track.EpisodeID = episode.ID; - libraryManager.RegisterTrack(track); + _libraryManager.RegisterTrack(track); } } @@ -85,11 +86,11 @@ namespace Kyoo.Controllers public class ConvertSubripToVtt : IActionResult { - private readonly string path; + private readonly string _path; public ConvertSubripToVtt(string subtitlePath) { - path = subtitlePath; + _path = subtitlePath; } public async Task ExecuteResultAsync(ActionContext context) @@ -100,13 +101,13 @@ namespace Kyoo.Controllers context.HttpContext.Response.StatusCode = 200; context.HttpContext.Response.Headers.Add("Content-Type", "text/vtt"); - using (StreamWriter writer = new StreamWriter(context.HttpContext.Response.Body)) + await using (StreamWriter writer = new StreamWriter(context.HttpContext.Response.Body)) { await writer.WriteLineAsync("WEBVTT"); await writer.WriteLineAsync(""); await writer.WriteLineAsync(""); - using (StreamReader reader = new StreamReader(path)) + using (StreamReader reader = new StreamReader(_path)) { while ((line = await reader.ReadLineAsync()) != null) { @@ -127,7 +128,7 @@ namespace Kyoo.Controllers await context.HttpContext.Response.Body.FlushAsync(); } - public List ConvertBlock(List lines) + private static List ConvertBlock(List lines) { lines[1] = lines[1].Replace(',', '.'); if (lines[2].Length > 5) diff --git a/Kyoo/HtmlAPI/ThumbnailAPI.cs b/Kyoo/HtmlAPI/ThumbnailAPI.cs index 6c0bd2ba..2274c8a7 100644 --- a/Kyoo/HtmlAPI/ThumbnailAPI.cs +++ b/Kyoo/HtmlAPI/ThumbnailAPI.cs @@ -1,25 +1,26 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using System.IO; +using Kyoo.Controllers; -namespace Kyoo.Controllers +namespace Kyoo.Api { public class ThumbnailController : ControllerBase { - private readonly ILibraryManager libraryManager; - private readonly string peoplePath; + private readonly ILibraryManager _libraryManager; + private readonly string _peoplePath; public ThumbnailController(ILibraryManager libraryManager, IConfiguration config) { - this.libraryManager = libraryManager; - peoplePath = config.GetValue("peoplePath"); + _libraryManager = libraryManager; + _peoplePath = config.GetValue("peoplePath"); } [HttpGet("poster/{showSlug}")] public IActionResult GetShowThumb(string showSlug) { - string path = libraryManager.GetShowBySlug(showSlug)?.Path; + string path = _libraryManager.GetShowBySlug(showSlug)?.Path; if (path == null) return NotFound(); @@ -27,14 +28,13 @@ namespace Kyoo.Controllers if (System.IO.File.Exists(thumb)) return new PhysicalFileResult(thumb, "image/jpg"); - else - return NotFound(); + return NotFound(); } [HttpGet("logo/{showSlug}")] public IActionResult GetShowLogo(string showSlug) { - string path = libraryManager.GetShowBySlug(showSlug)?.Path; + string path = _libraryManager.GetShowBySlug(showSlug)?.Path; if (path == null) return NotFound(); @@ -42,14 +42,13 @@ namespace Kyoo.Controllers if (System.IO.File.Exists(thumb)) return new PhysicalFileResult(thumb, "image/jpg"); - else - return NotFound(); + return NotFound(); } [HttpGet("backdrop/{showSlug}")] public IActionResult GetShowBackdrop(string showSlug) { - string path = libraryManager.GetShowBySlug(showSlug)?.Path; + string path = _libraryManager.GetShowBySlug(showSlug)?.Path; if (path == null) return NotFound(); @@ -57,14 +56,13 @@ namespace Kyoo.Controllers if (System.IO.File.Exists(thumb)) return new PhysicalFileResult(thumb, "image/jpg"); - else - return NotFound(); + return NotFound(); } [HttpGet("peopleimg/{peopleSlug}")] public IActionResult GetPeopleIcon(string peopleSlug) { - string thumbPath = Path.Combine(peoplePath, peopleSlug + ".jpg"); + string thumbPath = Path.Combine(_peoplePath, peopleSlug + ".jpg"); if (!System.IO.File.Exists(thumbPath)) return NotFound(); @@ -74,7 +72,7 @@ namespace Kyoo.Controllers [HttpGet("thumb/{showSlug}-s{seasonNumber}e{episodeNumber}")] public IActionResult GetEpisodeThumb(string showSlug, long seasonNumber, long episodeNumber) { - string path = libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber)?.Path; + string path = _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber)?.Path; if (path == null) return NotFound(); diff --git a/Kyoo/HtmlAPI/VideoAPI.cs b/Kyoo/HtmlAPI/VideoAPI.cs index b58da90f..8b7049ca 100644 --- a/Kyoo/HtmlAPI/VideoAPI.cs +++ b/Kyoo/HtmlAPI/VideoAPI.cs @@ -5,55 +5,50 @@ using Microsoft.Extensions.Configuration; using System.IO; using System.Threading.Tasks; -namespace Kyoo.Controllers +namespace Kyoo.Api { [Route("[controller]")] [ApiController] public class VideoController : ControllerBase { - private readonly ILibraryManager libraryManager; - private readonly ITranscoder transcoder; - private readonly string transmuxPath; + private readonly ILibraryManager _libraryManager; + private readonly ITranscoder _transcoder; + private readonly string _transmuxPath; public VideoController(ILibraryManager libraryManager, ITranscoder transcoder, IConfiguration config) { - this.libraryManager = libraryManager; - this.transcoder = transcoder; - transmuxPath = config.GetValue("transmuxTempPath"); + _libraryManager = libraryManager; + _transcoder = transcoder; + _transmuxPath = config.GetValue("transmuxTempPath"); } [HttpGet("{showSlug}-s{seasonNumber}e{episodeNumber}")] public IActionResult Index(string showSlug, long seasonNumber, long episodeNumber) { - WatchItem episode = libraryManager.GetWatchItem(showSlug, seasonNumber, episodeNumber); + WatchItem episode = _libraryManager.GetWatchItem(showSlug, seasonNumber, episodeNumber); if (episode != null && System.IO.File.Exists(episode.Path)) return PhysicalFile(episode.Path, "video/x-matroska", true); - else - return NotFound(); + return NotFound(); } [HttpGet("transmux/{showSlug}-s{seasonNumber}e{episodeNumber}")] public async Task Transmux(string showSlug, long seasonNumber, long episodeNumber) { - WatchItem episode = libraryManager.GetWatchItem(showSlug, seasonNumber, episodeNumber); + WatchItem episode = _libraryManager.GetWatchItem(showSlug, seasonNumber, episodeNumber); - if (episode != null && System.IO.File.Exists(episode.Path)) - { - string path = await transcoder.Transmux(episode); - if (path != null) - return PhysicalFile(path, "application/x-mpegURL ", true); - else - return StatusCode(500); - } - else - return NotFound(); + if (episode == null || !System.IO.File.Exists(episode.Path)) + return NotFound(); + string path = await _transcoder.Transmux(episode); + if (path != null) + return PhysicalFile(path, "application/x-mpegURL ", true); + return StatusCode(500); } [HttpGet("transmux/{episodeLink}/segment/{chunk}")] public IActionResult GetTransmuxedChunk(string episodeLink, string chunk) { - string path = Path.Combine(transmuxPath, episodeLink); + string path = Path.Combine(_transmuxPath, episodeLink); path = Path.Combine(path, "segments" + Path.DirectorySeparatorChar + chunk); return PhysicalFile(path, "video/MP2T"); @@ -62,18 +57,14 @@ namespace Kyoo.Controllers [HttpGet("transcode/{showSlug}-s{seasonNumber}e{episodeNumber}")] public async Task Transcode(string showSlug, long seasonNumber, long episodeNumber) { - WatchItem episode = libraryManager.GetWatchItem(showSlug, seasonNumber, episodeNumber); + WatchItem episode = _libraryManager.GetWatchItem(showSlug, seasonNumber, episodeNumber); - if (episode != null && System.IO.File.Exists(episode.Path)) - { - string path = await transcoder.Transcode(episode); - if (path != null) - return PhysicalFile(path, "application/x-mpegURL ", true); - else - return StatusCode(500); - } - else - return NotFound(); + if (episode == null || !System.IO.File.Exists(episode.Path)) + return NotFound(); + string path = await _transcoder.Transcode(episode); + if (path != null) + return PhysicalFile(path, "application/x-mpegURL ", true); + return StatusCode(500); } } } \ No newline at end of file diff --git a/Kyoo/HtmlAPI/WatchAPI.cs b/Kyoo/HtmlAPI/WatchAPI.cs index a1eadf95..cc493e66 100644 --- a/Kyoo/HtmlAPI/WatchAPI.cs +++ b/Kyoo/HtmlAPI/WatchAPI.cs @@ -1,27 +1,24 @@ using Kyoo.Controllers; using Kyoo.Models; using Microsoft.AspNetCore.Mvc; -using System.Diagnostics; -// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 - -namespace Kyoo.Controllers +namespace Kyoo.Api { [Route("api/[controller]")] [ApiController] public class WatchController : ControllerBase { - private readonly ILibraryManager libraryManager; + private readonly ILibraryManager _libraryManager; public WatchController(ILibraryManager libraryManager) { - this.libraryManager = libraryManager; + _libraryManager = libraryManager; } [HttpGet("{showSlug}-s{seasonNumber}e{episodeNumber}")] public ActionResult Index(string showSlug, long seasonNumber, long episodeNumber) { - WatchItem item = libraryManager.GetWatchItem(showSlug, seasonNumber, episodeNumber); + WatchItem item = _libraryManager.GetWatchItem(showSlug, seasonNumber, episodeNumber); if(item == null) return NotFound(); diff --git a/Kyoo/Kyoo.csproj b/Kyoo/Kyoo.csproj index 12d127eb..3fedc768 100644 --- a/Kyoo/Kyoo.csproj +++ b/Kyoo/Kyoo.csproj @@ -19,7 +19,6 @@ -