diff --git a/Kyoo/ClientApp/src/app/browse/browse.component.ts b/Kyoo/ClientApp/src/app/browse/browse.component.ts index 06390f16..b1527060 100644 --- a/Kyoo/ClientApp/src/app/browse/browse.component.ts +++ b/Kyoo/ClientApp/src/app/browse/browse.component.ts @@ -25,7 +25,7 @@ export class BrowseComponent implements OnInit ngAfterViewInit() { - $('[data-toggle="tooltip"]').tooltip(); + $('[data-toggle="tooltip"]').tooltip({ trigger: "hover" }); } getThumb(slug: string) diff --git a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html index 0b449f7f..63648da9 100644 --- a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html +++ b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html @@ -1,13 +1,13 @@
- +
diff --git a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.scss b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.scss index 8793767a..e78cae2b 100644 --- a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.scss +++ b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.scss @@ -57,6 +57,8 @@ flex-shrink: 0; width: 55%; cursor: pointer; + color: inherit; + text-decoration: inherit; @include media-breakpoint-up(sm) { diff --git a/Kyoo/ClientApp/src/app/player/player.component.html b/Kyoo/ClientApp/src/app/player/player.component.html index b469d3b0..37f04fe6 100644 --- a/Kyoo/ClientApp/src/app/player/player.component.html +++ b/Kyoo/ClientApp/src/app/player/player.component.html @@ -6,6 +6,10 @@
+
+
+
+
-
-
diff --git a/Kyoo/ClientApp/src/app/player/player.component.scss b/Kyoo/ClientApp/src/app/player/player.component.scss index 881ad788..fa3555f5 100644 --- a/Kyoo/ClientApp/src/app/player/player.component.scss +++ b/Kyoo/ClientApp/src/app/player/player.component.scss @@ -291,3 +291,28 @@ } } } + +.mat-menu-item +{ + outline: none !important; +} + +.selected +{ + background: #595959 !important; + color: var(--accentColor); + font-weight: 900; +} + +#loadIndicator +{ + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + pointer-events: none; + background: rgba(0, 0, 0, 0.3); + display: flex; + justify-content: center; +} diff --git a/Kyoo/ClientApp/src/app/player/player.component.ts b/Kyoo/ClientApp/src/app/player/player.component.ts index c588dfa3..fc2ccc1a 100644 --- a/Kyoo/ClientApp/src/app/player/player.component.ts +++ b/Kyoo/ClientApp/src/app/player/player.component.ts @@ -98,6 +98,17 @@ export class PlayerComponent implements OnInit this.setDuration(this.player.duration); }; + let loadIndicator: HTMLElement = document.getElementById("loadIndicator") as HTMLElement; + this.player.onwaiting = () => + { + loadIndicator.classList.remove("d-none"); + } + + this.player.oncanplay = () => + { + loadIndicator.classList.add("d-none"); + } + let progressBar: HTMLElement = document.getElementById("progress-bar") as HTMLElement; $(progressBar).click((event) => { @@ -212,6 +223,8 @@ export class PlayerComponent implements OnInit { document.getElementById("nav").classList.remove("d-none"); this.title.setTitle("Kyoo"); + + $(document).unbind(); } back() @@ -296,7 +309,7 @@ export class PlayerComponent implements OnInit getSubtitleLink(subtitle: Track): string { - let link: string = "/api/subtitle/" + this.item.link + "-" + subtitle.language; + let link: string = "/api/subtitle/" + this.item.link + "." + subtitle.language; if (subtitle.isForced) link += "-forced"; diff --git a/Kyoo/ClientApp/src/models/watch-item.ts b/Kyoo/ClientApp/src/models/watch-item.ts index 03ab046c..e8b15b3d 100644 --- a/Kyoo/ClientApp/src/models/watch-item.ts +++ b/Kyoo/ClientApp/src/models/watch-item.ts @@ -21,6 +21,7 @@ export interface WatchItem export interface Track { + displayName: string; title: string; language: string; isDefault: boolean; diff --git a/Kyoo/Controllers/SubtitleController.cs b/Kyoo/Controllers/SubtitleController.cs index 9f0b04cc..9ce91ec9 100644 --- a/Kyoo/Controllers/SubtitleController.cs +++ b/Kyoo/Controllers/SubtitleController.cs @@ -2,11 +2,12 @@ using Kyoo.Models; using Kyoo.Models.Watch; using Microsoft.AspNetCore.Mvc; +using System.Diagnostics; namespace Kyoo.Controllers { [Route("api/[controller]")] - [ApiController] + //[ApiController] public class SubtitleController : ControllerBase { private readonly ILibraryManager libraryManager; @@ -18,29 +19,25 @@ namespace Kyoo.Controllers this.transcoder = transcoder; } - [HttpGet("{showSlug}-s{seasonNumber}e{episodeNumber}-{languageTag}.{codec?}")] - public IActionResult GetSubtitle(string showSlug, long seasonNumber, long episodeNumber, string languageTag, string codec) + [HttpGet("{showSlug}-s{seasonNumber:int}e{episodeNumber:int}.{identifier}.{codec?}")] + public IActionResult GetSubtitle(string showSlug, int seasonNumber, int episodeNumber, string identifier, string codec) { - Track subtitle = libraryManager.GetSubtitle(showSlug, seasonNumber, episodeNumber, languageTag, false); + string languageTag = identifier.Substring(0, 3); + bool forced = identifier.Length > 3 && identifier.Substring(4) == "forced"; + + Track subtitle = libraryManager.GetSubtitle(showSlug, seasonNumber, episodeNumber, languageTag, forced); if (subtitle == null) return NotFound(); - //Should use appropriate mime type here - return PhysicalFile(subtitle.Path, "text/x-ssa"); - } - - //This one is never called. - [HttpGet("{showSlug}-s{seasonNumber}e{episodeNumber}-{languageTag}-{disposition}.{codec?}")] //Disposition can't be tagged as optional because there is a parametter after him. - public IActionResult GetForcedSubtitle(string showSlug, long seasonNumber, long episodeNumber, string languageTag, string disposition, string codec) - { - Track subtitle = libraryManager.GetSubtitle(showSlug, seasonNumber, episodeNumber, languageTag, disposition == "forced"); - - if (subtitle == null) - return NotFound(); + string mime = "text/vtt"; + if (subtitle.Codec == "ass") + mime = "text/x-ssa"; + else if (subtitle.Codec == "subrip") + mime = "application/x-subrip"; //Should use appropriate mime type here - return PhysicalFile(subtitle.Path, "text/x-ssa"); + return PhysicalFile(subtitle.Path, mime); } [HttpGet("extract/{showSlug}-s{seasonNumber}e{episodeNumber}")] diff --git a/Kyoo/Models/Track.cs b/Kyoo/Models/Track.cs index a5ccbe40..9b1633d6 100644 --- a/Kyoo/Models/Track.cs +++ b/Kyoo/Models/Track.cs @@ -1,6 +1,8 @@ using Kyoo.Models.Watch; using Newtonsoft.Json; using System; +using System.Globalization; +using System.Linq; using System.Runtime.InteropServices; namespace Kyoo.Models @@ -26,6 +28,7 @@ namespace Kyoo.Models public class Track : Stream { + public string DisplayName; [JsonIgnore] public readonly long id; [JsonIgnore] public long episodeID; [JsonIgnore] public StreamType type; @@ -41,6 +44,14 @@ namespace Kyoo.Models Codec = codec; IsExternal = isExternal; Path = path; + + //Converting mkv track language to c# system language tag. + if (language == "fre") + language = "fra"; + + DisplayName = CultureInfo.GetCultures(CultureTypes.NeutralCultures).Where(x => x.ThreeLetterISOLanguageName == language).FirstOrDefault()?.DisplayName ?? language; + if (Title != null && Title.Length > 1) + DisplayName += " - " + Title; } public static Track FromReader(System.Data.SQLite.SQLiteDataReader reader)