diff --git a/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj b/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj index e9226e30..9d8ddb0c 100644 --- a/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj +++ b/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj @@ -11,6 +11,7 @@ + diff --git a/back/src/Kyoo.Abstractions/Models/WatchItem.cs b/back/src/Kyoo.Abstractions/Models/WatchItem.cs index bd5d989a..ca87d1e7 100644 --- a/back/src/Kyoo.Abstractions/Models/WatchItem.cs +++ b/back/src/Kyoo.Abstractions/Models/WatchItem.cs @@ -21,10 +21,10 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Net.Http; -using System.Net.Http.Json; using System.Threading.Tasks; using Kyoo.Abstractions.Controllers; using Kyoo.Abstractions.Models.Attributes; +using Newtonsoft.Json; namespace Kyoo.Abstractions.Models { @@ -165,9 +165,10 @@ namespace Kyoo.Abstractions.Models private static async Task _GetInfo(Episode ep, HttpClient client) { - return await client.GetFromJsonAsync( - $"http://transcoder:7666/info/{(ep.Show.IsMovie ? "movie" : "episode")}/${ep.Slug}/info" - ); + HttpResponseMessage ret = await client.GetAsync($"http://transcoder:7666/{(ep.Show.IsMovie ? "movie" : "episode")}/{ep.Slug}/info"); + ret.EnsureSuccessStatusCode(); + string content = await ret.Content.ReadAsStringAsync(); + return JsonConvert.DeserializeObject(content); } /// diff --git a/back/src/Kyoo.Core/Controllers/ThumbnailsManager.cs b/back/src/Kyoo.Core/Controllers/ThumbnailsManager.cs index 9dbb7c40..15ba7def 100644 --- a/back/src/Kyoo.Core/Controllers/ThumbnailsManager.cs +++ b/back/src/Kyoo.Core/Controllers/ThumbnailsManager.cs @@ -127,8 +127,8 @@ namespace Kyoo.Core.Controllers string directory = item switch { - IResource res => Path.Combine("/metadata", typeof(T).Name.ToLowerInvariant(), res.Slug), - _ => Path.Combine("/metadata", typeof(T).Name.ToLowerInvariant()) + IResource res => Path.Combine("./metadata", typeof(T).Name.ToLowerInvariant(), res.Slug), + _ => Path.Combine("./metadata", typeof(T).Name.ToLowerInvariant()) }; Directory.CreateDirectory(directory); string imageName = imageId switch diff --git a/front/packages/ui/src/player/components/right-buttons.tsx b/front/packages/ui/src/player/components/right-buttons.tsx index 4cc8d5ac..b0b5ba8e 100644 --- a/front/packages/ui/src/player/components/right-buttons.tsx +++ b/front/packages/ui/src/player/components/right-buttons.tsx @@ -31,6 +31,17 @@ import MusicNote from "@material-symbols/svg-400/rounded/music_note-fill.svg"; import { Stylable, useYoshiki } from "yoshiki/native"; import { fullscreenAtom, subtitleAtom } from "../state"; import { AudiosMenu, QualitiesMenu } from "../video"; +import i18next from "i18next"; + +export const getDisplayName = (sub: Subtitle) => { + const languageNames = new Intl.DisplayNames([i18next.language], { type: "language" }); + const lng = sub.language ? languageNames.of(sub.language) : undefined; + + if (lng && sub.title) return `${lng} - ${sub.title}`; + if (lng) return lng; + if (sub.title) return sub.title; + return `Unknwon (${sub.index})`; +}; export const RightButtons = ({ subtitles, @@ -72,7 +83,7 @@ export const RightButtons = ({ {subtitles.map((x) => ( setSubtitle(x)} /> diff --git a/transcoder/src/identify.rs b/transcoder/src/identify.rs index ae4ff6a0..2ce4a6f6 100644 --- a/transcoder/src/identify.rs +++ b/transcoder/src/identify.rs @@ -13,6 +13,7 @@ use utoipa::ToSchema; use crate::transcode::Quality; #[derive(Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] pub struct MediaInfo { /// The sha1 of the video file. pub sha: String, @@ -30,6 +31,7 @@ pub struct MediaInfo { } #[derive(Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] pub struct Video { /// The codec of this stream (defined as the RFC 6381). pub codec: String, @@ -46,6 +48,7 @@ pub struct Video { } #[derive(Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] pub struct Audio { /// The index of this track on the media. pub index: u32, @@ -62,6 +65,7 @@ pub struct Audio { } #[derive(Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] pub struct Subtitle { /// The index of this track on the media. pub index: u32, @@ -80,6 +84,7 @@ pub struct Subtitle { } #[derive(Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] pub struct Chapter { /// The start time of the chapter (in second from the start of the episode). pub start_time: f32,