mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fix remaining issues with new track implementation
This commit is contained in:
parent
e6f263b6de
commit
f58597379b
@ -11,6 +11,7 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="System.ComponentModel.Composition" Version="7.0.0" />
|
<PackageReference Include="System.ComponentModel.Composition" Version="7.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -21,10 +21,10 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Json;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
using Kyoo.Abstractions.Models.Attributes;
|
using Kyoo.Abstractions.Models.Attributes;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models
|
namespace Kyoo.Abstractions.Models
|
||||||
{
|
{
|
||||||
@ -165,9 +165,10 @@ namespace Kyoo.Abstractions.Models
|
|||||||
|
|
||||||
private static async Task<object> _GetInfo(Episode ep, HttpClient client)
|
private static async Task<object> _GetInfo(Episode ep, HttpClient client)
|
||||||
{
|
{
|
||||||
return await client.GetFromJsonAsync<object>(
|
HttpResponseMessage ret = await client.GetAsync($"http://transcoder:7666/{(ep.Show.IsMovie ? "movie" : "episode")}/{ep.Slug}/info");
|
||||||
$"http://transcoder:7666/info/{(ep.Show.IsMovie ? "movie" : "episode")}/${ep.Slug}/info"
|
ret.EnsureSuccessStatusCode();
|
||||||
);
|
string content = await ret.Content.ReadAsStringAsync();
|
||||||
|
return JsonConvert.DeserializeObject<object>(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -127,8 +127,8 @@ namespace Kyoo.Core.Controllers
|
|||||||
|
|
||||||
string directory = item switch
|
string directory = item switch
|
||||||
{
|
{
|
||||||
IResource res => Path.Combine("/metadata", typeof(T).Name.ToLowerInvariant(), res.Slug),
|
IResource res => Path.Combine("./metadata", typeof(T).Name.ToLowerInvariant(), res.Slug),
|
||||||
_ => Path.Combine("/metadata", typeof(T).Name.ToLowerInvariant())
|
_ => Path.Combine("./metadata", typeof(T).Name.ToLowerInvariant())
|
||||||
};
|
};
|
||||||
Directory.CreateDirectory(directory);
|
Directory.CreateDirectory(directory);
|
||||||
string imageName = imageId switch
|
string imageName = imageId switch
|
||||||
|
@ -31,6 +31,17 @@ import MusicNote from "@material-symbols/svg-400/rounded/music_note-fill.svg";
|
|||||||
import { Stylable, useYoshiki } from "yoshiki/native";
|
import { Stylable, useYoshiki } from "yoshiki/native";
|
||||||
import { fullscreenAtom, subtitleAtom } from "../state";
|
import { fullscreenAtom, subtitleAtom } from "../state";
|
||||||
import { AudiosMenu, QualitiesMenu } from "../video";
|
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 = ({
|
export const RightButtons = ({
|
||||||
subtitles,
|
subtitles,
|
||||||
@ -72,7 +83,7 @@ export const RightButtons = ({
|
|||||||
{subtitles.map((x) => (
|
{subtitles.map((x) => (
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
key={x.index}
|
key={x.index}
|
||||||
label={x.displayName}
|
label={getDisplayName(x)}
|
||||||
selected={selectedSubtitle === x}
|
selected={selectedSubtitle === x}
|
||||||
onSelect={() => setSubtitle(x)}
|
onSelect={() => setSubtitle(x)}
|
||||||
/>
|
/>
|
||||||
|
@ -13,6 +13,7 @@ use utoipa::ToSchema;
|
|||||||
use crate::transcode::Quality;
|
use crate::transcode::Quality;
|
||||||
|
|
||||||
#[derive(Serialize, ToSchema)]
|
#[derive(Serialize, ToSchema)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct MediaInfo {
|
pub struct MediaInfo {
|
||||||
/// The sha1 of the video file.
|
/// The sha1 of the video file.
|
||||||
pub sha: String,
|
pub sha: String,
|
||||||
@ -30,6 +31,7 @@ pub struct MediaInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, ToSchema)]
|
#[derive(Serialize, ToSchema)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Video {
|
pub struct Video {
|
||||||
/// The codec of this stream (defined as the RFC 6381).
|
/// The codec of this stream (defined as the RFC 6381).
|
||||||
pub codec: String,
|
pub codec: String,
|
||||||
@ -46,6 +48,7 @@ pub struct Video {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, ToSchema)]
|
#[derive(Serialize, ToSchema)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Audio {
|
pub struct Audio {
|
||||||
/// The index of this track on the media.
|
/// The index of this track on the media.
|
||||||
pub index: u32,
|
pub index: u32,
|
||||||
@ -62,6 +65,7 @@ pub struct Audio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, ToSchema)]
|
#[derive(Serialize, ToSchema)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Subtitle {
|
pub struct Subtitle {
|
||||||
/// The index of this track on the media.
|
/// The index of this track on the media.
|
||||||
pub index: u32,
|
pub index: u32,
|
||||||
@ -80,6 +84,7 @@ pub struct Subtitle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, ToSchema)]
|
#[derive(Serialize, ToSchema)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Chapter {
|
pub struct Chapter {
|
||||||
/// The start time of the chapter (in second from the start of the episode).
|
/// The start time of the chapter (in second from the start of the episode).
|
||||||
pub start_time: f32,
|
pub start_time: f32,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user