mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-31 04:05:50 -04:00
Merge remote-tracking branch 'jellyfinorigin/master' into feature/pgsql_provider
This commit is contained in:
commit
dfdef511a5
@ -9,14 +9,14 @@
|
|||||||
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.1" />
|
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.1" />
|
||||||
<PackageVersion Include="AutoFixture" Version="4.18.1" />
|
<PackageVersion Include="AutoFixture" Version="4.18.1" />
|
||||||
<PackageVersion Include="BDInfo" Version="0.8.0" />
|
<PackageVersion Include="BDInfo" Version="0.8.0" />
|
||||||
<PackageVersion Include="BlurHashSharp.SkiaSharp" Version="1.3.3" />
|
<PackageVersion Include="BlurHashSharp.SkiaSharp" Version="1.3.4" />
|
||||||
<PackageVersion Include="BlurHashSharp" Version="1.3.3" />
|
<PackageVersion Include="BlurHashSharp" Version="1.3.4" />
|
||||||
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
|
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
|
||||||
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
|
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
|
||||||
<PackageVersion Include="Diacritics" Version="3.3.29" />
|
<PackageVersion Include="Diacritics" Version="3.3.29" />
|
||||||
<PackageVersion Include="DiscUtils.Udf" Version="0.16.13" />
|
<PackageVersion Include="DiscUtils.Udf" Version="0.16.13" />
|
||||||
<PackageVersion Include="DotNet.Glob" Version="3.1.3" />
|
<PackageVersion Include="DotNet.Glob" Version="3.1.3" />
|
||||||
<PackageVersion Include="FsCheck.Xunit" Version="3.0.1" />
|
<PackageVersion Include="FsCheck.Xunit" Version="3.1.0" />
|
||||||
<PackageVersion Include="HarfBuzzSharp.NativeAssets.Linux" Version="7.3.0.3" />
|
<PackageVersion Include="HarfBuzzSharp.NativeAssets.Linux" Version="7.3.0.3" />
|
||||||
<PackageVersion Include="ICU4N.Transliterator" Version="60.1.0-alpha.356" />
|
<PackageVersion Include="ICU4N.Transliterator" Version="60.1.0-alpha.356" />
|
||||||
<PackageVersion Include="IDisposableAnalyzers" Version="4.0.8" />
|
<PackageVersion Include="IDisposableAnalyzers" Version="4.0.8" />
|
||||||
@ -51,7 +51,7 @@
|
|||||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||||
<PackageVersion Include="MimeTypes" Version="2.5.2" />
|
<PackageVersion Include="MimeTypes" Version="2.5.2" />
|
||||||
<PackageVersion Include="Moq" Version="4.18.4" />
|
<PackageVersion Include="Moq" Version="4.18.4" />
|
||||||
<PackageVersion Include="NEbml" Version="0.11.0" />
|
<PackageVersion Include="NEbml" Version="0.12.0" />
|
||||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageVersion Include="PlaylistsNET" Version="1.4.1" />
|
<PackageVersion Include="PlaylistsNET" Version="1.4.1" />
|
||||||
<PackageVersion Include="prometheus-net.AspNetCore" Version="8.2.1" />
|
<PackageVersion Include="prometheus-net.AspNetCore" Version="8.2.1" />
|
||||||
@ -80,7 +80,7 @@
|
|||||||
<PackageVersion Include="System.Text.Json" Version="9.0.1" />
|
<PackageVersion Include="System.Text.Json" Version="9.0.1" />
|
||||||
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="9.0.1" />
|
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="9.0.1" />
|
||||||
<PackageVersion Include="TagLibSharp" Version="2.3.0" />
|
<PackageVersion Include="TagLibSharp" Version="2.3.0" />
|
||||||
<PackageVersion Include="z440.atl.core" Version="6.14.0" />
|
<PackageVersion Include="z440.atl.core" Version="6.15.0" />
|
||||||
<PackageVersion Include="TMDbLib" Version="2.2.0" />
|
<PackageVersion Include="TMDbLib" Version="2.2.0" />
|
||||||
<PackageVersion Include="UTF.Unknown" Version="2.5.1" />
|
<PackageVersion Include="UTF.Unknown" Version="2.5.1" />
|
||||||
<PackageVersion Include="Xunit.Priority" Version="1.1.6" />
|
<PackageVersion Include="Xunit.Priority" Version="1.1.6" />
|
||||||
|
@ -276,6 +276,13 @@ namespace Emby.Server.Implementations.IO
|
|||||||
{
|
{
|
||||||
_logger.LogError(ex, "Reading the file at {Path} failed due to a permissions exception.", fileInfo.FullName);
|
_logger.LogError(ex, "Reading the file at {Path} failed due to a permissions exception.", fileInfo.FullName);
|
||||||
}
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
// IOException generally means the file is not accessible due to filesystem issues
|
||||||
|
// Catch this exception and mark the file as not exist to ignore it
|
||||||
|
_logger.LogError(ex, "Reading the file at {Path} failed due to an IO Exception. Marking the file as not existing", fileInfo.FullName);
|
||||||
|
result.Exists = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,6 +597,9 @@ namespace Emby.Server.Implementations.IO
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool recursive = false)
|
public virtual IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool recursive = false)
|
||||||
{
|
{
|
||||||
|
// Note: any of unhandled exceptions thrown by this method may cause the caller to believe the whole path is not accessible.
|
||||||
|
// But what causing the exception may be a single file under that path. This could lead to unexpected behavior.
|
||||||
|
// For example, the scanner will remove everything in that path due to unhandled errors.
|
||||||
var directoryInfo = new DirectoryInfo(path);
|
var directoryInfo = new DirectoryInfo(path);
|
||||||
var enumerationOptions = GetEnumerationOptions(recursive);
|
var enumerationOptions = GetEnumerationOptions(recursive);
|
||||||
|
|
||||||
|
1
Emby.Server.Implementations/Localization/Core/ht.json
Normal file
1
Emby.Server.Implementations/Localization/Core/ht.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
@ -1,8 +1,14 @@
|
|||||||
Livre,0
|
Livre,0
|
||||||
L,0
|
L,0
|
||||||
ER,9
|
AL,0
|
||||||
|
ER,10
|
||||||
10,10
|
10,10
|
||||||
|
A10,10
|
||||||
12,12
|
12,12
|
||||||
|
A12,12
|
||||||
14,14
|
14,14
|
||||||
|
A14,14
|
||||||
16,16
|
16,16
|
||||||
|
A16,16
|
||||||
18,18
|
18,18
|
||||||
|
A18,18
|
||||||
|
|
@ -6,8 +6,6 @@ TV-Y7,7
|
|||||||
TV-Y7-FV,7
|
TV-Y7-FV,7
|
||||||
PG,9
|
PG,9
|
||||||
TV-PG,9
|
TV-PG,9
|
||||||
PG-13,13
|
|
||||||
13+,13
|
|
||||||
TV-14,14
|
TV-14,14
|
||||||
14A,14
|
14A,14
|
||||||
16+,16
|
16+,16
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
A,0
|
A,0
|
||||||
A/fig,0
|
A/fig,0
|
||||||
A/i,0
|
A/i,0
|
||||||
A/fig/i,0
|
A/i/fig,0
|
||||||
APTA,0
|
APTA,0
|
||||||
ERI,0
|
ERI,0
|
||||||
TP,0
|
TP,0
|
||||||
|
|
@ -6,10 +6,11 @@ U,0
|
|||||||
6+,6
|
6+,6
|
||||||
7+,7
|
7+,7
|
||||||
PG,8
|
PG,8
|
||||||
9+,9
|
9,9
|
||||||
12,12
|
12,12
|
||||||
12+,12
|
12+,12
|
||||||
12A,12
|
12A,12
|
||||||
|
12PG,12
|
||||||
Teen,13
|
Teen,13
|
||||||
13+,13
|
13+,13
|
||||||
14+,14
|
14+,14
|
||||||
|
|
@ -4,6 +4,7 @@ PG,12
|
|||||||
12A,12
|
12A,12
|
||||||
12PG,12
|
12PG,12
|
||||||
15,15
|
15,15
|
||||||
|
15PG,15
|
||||||
15A,15
|
15A,15
|
||||||
16,16
|
16,16
|
||||||
18,18
|
18,18
|
||||||
|
|
@ -6,4 +6,5 @@ A,0
|
|||||||
12,12
|
12,12
|
||||||
15,15
|
15,15
|
||||||
18,18
|
18,18
|
||||||
|
C,18
|
||||||
Not approved,1001
|
Not approved,1001
|
||||||
|
|
@ -10,6 +10,7 @@ R16,16
|
|||||||
RP16,16
|
RP16,16
|
||||||
GA,18
|
GA,18
|
||||||
R18,18
|
R18,18
|
||||||
|
RP18,18
|
||||||
MA,1000
|
MA,1000
|
||||||
R,1001
|
R,1001
|
||||||
Objectionable,1001
|
Objectionable,1001
|
||||||
|
|
@ -48,3 +48,5 @@ TV-MA-LS,17
|
|||||||
TV-MA-LV,17
|
TV-MA-LV,17
|
||||||
TV-MA-SV,17
|
TV-MA-SV,17
|
||||||
TV-MA-LSV,17
|
TV-MA-LSV,17
|
||||||
|
TV-X,18
|
||||||
|
TV-AO,18
|
||||||
|
|
@ -51,20 +51,21 @@ namespace Jellyfin.Api.Auth
|
|||||||
}
|
}
|
||||||
|
|
||||||
var role = UserRoles.User;
|
var role = UserRoles.User;
|
||||||
if (authorizationInfo.IsApiKey || authorizationInfo.User.HasPermission(PermissionKind.IsAdministrator))
|
if (authorizationInfo.IsApiKey
|
||||||
|
|| (authorizationInfo.User?.HasPermission(PermissionKind.IsAdministrator) ?? false))
|
||||||
{
|
{
|
||||||
role = UserRoles.Administrator;
|
role = UserRoles.Administrator;
|
||||||
}
|
}
|
||||||
|
|
||||||
var claims = new[]
|
var claims = new[]
|
||||||
{
|
{
|
||||||
new Claim(ClaimTypes.Name, authorizationInfo.User.Username),
|
new Claim(ClaimTypes.Name, authorizationInfo.User?.Username ?? string.Empty),
|
||||||
new Claim(ClaimTypes.Role, role),
|
new Claim(ClaimTypes.Role, role),
|
||||||
new Claim(InternalClaimTypes.UserId, authorizationInfo.UserId.ToString("N", CultureInfo.InvariantCulture)),
|
new Claim(InternalClaimTypes.UserId, authorizationInfo.UserId.ToString("N", CultureInfo.InvariantCulture)),
|
||||||
new Claim(InternalClaimTypes.DeviceId, authorizationInfo.DeviceId),
|
new Claim(InternalClaimTypes.DeviceId, authorizationInfo.DeviceId ?? string.Empty),
|
||||||
new Claim(InternalClaimTypes.Device, authorizationInfo.Device),
|
new Claim(InternalClaimTypes.Device, authorizationInfo.Device ?? string.Empty),
|
||||||
new Claim(InternalClaimTypes.Client, authorizationInfo.Client),
|
new Claim(InternalClaimTypes.Client, authorizationInfo.Client ?? string.Empty),
|
||||||
new Claim(InternalClaimTypes.Version, authorizationInfo.Version),
|
new Claim(InternalClaimTypes.Version, authorizationInfo.Version ?? string.Empty),
|
||||||
new Claim(InternalClaimTypes.Token, authorizationInfo.Token),
|
new Claim(InternalClaimTypes.Token, authorizationInfo.Token),
|
||||||
new Claim(InternalClaimTypes.IsApiKey, authorizationInfo.IsApiKey.ToString(CultureInfo.InvariantCulture))
|
new Claim(InternalClaimTypes.IsApiKey, authorizationInfo.IsApiKey.ToString(CultureInfo.InvariantCulture))
|
||||||
};
|
};
|
||||||
|
@ -235,6 +235,11 @@ public static class StreamingHelpers
|
|||||||
state.VideoRequest.MaxHeight = resolution.MaxHeight;
|
state.VideoRequest.MaxHeight = resolution.MaxHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state.AudioStream is not null && !EncodingHelper.IsCopyCodec(state.OutputAudioCodec) && string.Equals(state.AudioStream.Codec, state.OutputAudioCodec, StringComparison.OrdinalIgnoreCase) && state.OutputAudioBitrate.HasValue)
|
||||||
|
{
|
||||||
|
state.OutputAudioCodec = state.SupportedAudioCodecs.Where(c => !EncodingHelper.LosslessAudioCodecs.Contains(c)).FirstOrDefault(mediaEncoder.CanEncodeToAudioCodec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var ext = string.IsNullOrWhiteSpace(state.OutputContainer)
|
var ext = string.IsNullOrWhiteSpace(state.OutputContainer)
|
||||||
|
@ -71,7 +71,8 @@ public class ActivityLogWebSocketListener : BasePeriodicWebSocketListener<Activi
|
|||||||
/// <param name="message">The message.</param>
|
/// <param name="message">The message.</param>
|
||||||
protected override void Start(WebSocketMessageInfo message)
|
protected override void Start(WebSocketMessageInfo message)
|
||||||
{
|
{
|
||||||
if (!message.Connection.AuthorizationInfo.User.HasPermission(PermissionKind.IsAdministrator))
|
if (message.Connection.AuthorizationInfo.User is null
|
||||||
|
|| !message.Connection.AuthorizationInfo.User.HasPermission(PermissionKind.IsAdministrator))
|
||||||
{
|
{
|
||||||
throw new AuthenticationException("Only admin users can retrieve the activity log.");
|
throw new AuthenticationException("Only admin users can retrieve the activity log.");
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,8 @@ public class SessionInfoWebSocketListener : BasePeriodicWebSocketListener<IEnume
|
|||||||
/// <param name="message">The message.</param>
|
/// <param name="message">The message.</param>
|
||||||
protected override void Start(WebSocketMessageInfo message)
|
protected override void Start(WebSocketMessageInfo message)
|
||||||
{
|
{
|
||||||
if (!message.Connection.AuthorizationInfo.User.HasPermission(PermissionKind.IsAdministrator))
|
if (message.Connection.AuthorizationInfo.User is null
|
||||||
|
|| !message.Connection.AuthorizationInfo.User.HasPermission(PermissionKind.IsAdministrator))
|
||||||
{
|
{
|
||||||
throw new AuthenticationException("Only admin users can subscribe to session information.");
|
throw new AuthenticationException("Only admin users can subscribe to session information.");
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,9 @@ public class BaseItemEntity
|
|||||||
|
|
||||||
public string? Path { get; set; }
|
public string? Path { get; set; }
|
||||||
|
|
||||||
public DateTime StartDate { get; set; }
|
public DateTime? StartDate { get; set; }
|
||||||
|
|
||||||
public DateTime EndDate { get; set; }
|
public DateTime? EndDate { get; set; }
|
||||||
|
|
||||||
public string? ChannelId { get; set; }
|
public string? ChannelId { get; set; }
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Jellyfin.Database.Providers.PgSql.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class MakeStartEndDateNullable : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "StartDate",
|
||||||
|
table: "BaseItems",
|
||||||
|
type: "timestamp with time zone",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "timestamp with time zone");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "EndDate",
|
||||||
|
table: "BaseItems",
|
||||||
|
type: "timestamp with time zone",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "timestamp with time zone");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "StartDate",
|
||||||
|
table: "BaseItems",
|
||||||
|
type: "timestamp with time zone",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "timestamp with time zone",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "EndDate",
|
||||||
|
table: "BaseItems",
|
||||||
|
type: "timestamp with time zone",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "timestamp with time zone",
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -194,7 +194,7 @@ namespace Jellyfin.Database.Providers.PgSql.Migrations
|
|||||||
b.Property<DateTime?>("DateModified")
|
b.Property<DateTime?>("DateModified")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<DateTime>("EndDate")
|
b.Property<DateTime?>("EndDate")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("EpisodeTitle")
|
b.Property<string>("EpisodeTitle")
|
||||||
@ -332,7 +332,7 @@ namespace Jellyfin.Database.Providers.PgSql.Migrations
|
|||||||
b.Property<string>("SortName")
|
b.Property<string>("SortName")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTime>("StartDate")
|
b.Property<DateTime?>("StartDate")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("Studios")
|
b.Property<string>("Studios")
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class MakeStartEndDateNullable : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "StartDate",
|
||||||
|
table: "BaseItems",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "TEXT");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "EndDate",
|
||||||
|
table: "BaseItems",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "TEXT");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "StartDate",
|
||||||
|
table: "BaseItems",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "EndDate",
|
||||||
|
table: "BaseItems",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -185,7 +185,7 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
b.Property<DateTime?>("DateModified")
|
b.Property<DateTime?>("DateModified")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("EndDate")
|
b.Property<DateTime?>("EndDate")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("EpisodeTitle")
|
b.Property<string>("EpisodeTitle")
|
||||||
@ -323,7 +323,7 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
b.Property<string>("SortName")
|
b.Property<string>("SortName")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("StartDate")
|
b.Property<DateTime?>("StartDate")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Studios")
|
b.Property<string>("Studios")
|
||||||
|
@ -645,7 +645,7 @@ public sealed class BaseItemRepository
|
|||||||
// dto.MediaType = Enum.TryParse<MediaType>(entity.MediaType);
|
// dto.MediaType = Enum.TryParse<MediaType>(entity.MediaType);
|
||||||
if (dto is IHasStartDate hasStartDate)
|
if (dto is IHasStartDate hasStartDate)
|
||||||
{
|
{
|
||||||
hasStartDate.StartDate = entity.StartDate;
|
hasStartDate.StartDate = entity.StartDate.GetValueOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fields that are present in the DB but are never actually used
|
// Fields that are present in the DB but are never actually used
|
||||||
@ -683,7 +683,7 @@ public sealed class BaseItemRepository
|
|||||||
|
|
||||||
entity.ParentId = !dto.ParentId.IsEmpty() ? dto.ParentId : null;
|
entity.ParentId = !dto.ParentId.IsEmpty() ? dto.ParentId : null;
|
||||||
entity.Path = GetPathToSave(dto.Path);
|
entity.Path = GetPathToSave(dto.Path);
|
||||||
entity.EndDate = dto.EndDate.GetValueOrDefault();
|
entity.EndDate = dto.EndDate;
|
||||||
entity.CommunityRating = dto.CommunityRating;
|
entity.CommunityRating = dto.CommunityRating;
|
||||||
entity.CustomRating = dto.CustomRating;
|
entity.CustomRating = dto.CustomRating;
|
||||||
entity.IndexNumber = dto.IndexNumber;
|
entity.IndexNumber = dto.IndexNumber;
|
||||||
|
@ -116,17 +116,15 @@ namespace Jellyfin.Server.Implementations.Security
|
|||||||
DeviceId = deviceId,
|
DeviceId = deviceId,
|
||||||
Version = version,
|
Version = version,
|
||||||
Token = token,
|
Token = token,
|
||||||
IsAuthenticated = false,
|
IsAuthenticated = false
|
||||||
HasToken = false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(token))
|
if (!authInfo.HasToken)
|
||||||
{
|
{
|
||||||
// Request doesn't contain a token.
|
// Request doesn't contain a token.
|
||||||
return authInfo;
|
return authInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
authInfo.HasToken = true;
|
|
||||||
var dbContext = await _jellyfinDbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
var dbContext = await _jellyfinDbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
||||||
await using (dbContext.ConfigureAwait(false))
|
await using (dbContext.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
@ -194,6 +194,14 @@ public class TrickplayManager : ITrickplayManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We support video backdrops, but we should not generate trickplay images for them
|
||||||
|
var parentDirectory = Directory.GetParent(mediaPath);
|
||||||
|
if (parentDirectory is not null && string.Equals(parentDirectory.Name, "backdrops", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
_logger.LogDebug("Ignoring backdrop media found at {Path} for item {ItemID}", mediaPath, video.Id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// The width has to be even, otherwise a lot of filters will not be able to sample it
|
// The width has to be even, otherwise a lot of filters will not be able to sample it
|
||||||
var actualWidth = 2 * (width / 2);
|
var actualWidth = 2 * (width / 2);
|
||||||
|
|
||||||
|
@ -310,7 +310,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
private bool IsSwTonemapAvailable(EncodingJobInfo state, EncodingOptions options)
|
private bool IsSwTonemapAvailable(EncodingJobInfo state, EncodingOptions options)
|
||||||
{
|
{
|
||||||
if (state.VideoStream is null
|
if (state.VideoStream is null
|
||||||
|| !options.EnableTonemapping
|
|
||||||
|| GetVideoColorBitDepth(state) < 10
|
|| GetVideoColorBitDepth(state) < 10
|
||||||
|| !_mediaEncoder.SupportsFilter("tonemapx"))
|
|| !_mediaEncoder.SupportsFilter("tonemapx"))
|
||||||
{
|
{
|
||||||
@ -2062,7 +2061,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
// libx265 only accept level option in -x265-params.
|
// libx265 only accept level option in -x265-params.
|
||||||
// level option may cause libx265 to fail.
|
// level option may cause libx265 to fail.
|
||||||
// libx265 cannot adjust the given level, just throw an error.
|
// libx265 cannot adjust the given level, just throw an error.
|
||||||
param += " -x265-params:0 subme=3:merange=25:rc-lookahead=10:me=star:ctu=32:max-tu-size=32:min-cu-size=16:rskip=2:rskip-edge-threshold=2:no-sao=1:no-strong-intra-smoothing=1:no-scenecut=1:no-open-gop=1:no-info=1";
|
param += " -x265-params:0 no-scenecut=1:no-open-gop=1:no-info=1";
|
||||||
|
|
||||||
|
if (encodingOptions.EncoderPreset < EncoderPreset.ultrafast)
|
||||||
|
{
|
||||||
|
// The following params are slower than the ultrafast preset, don't use when ultrafast is selected.
|
||||||
|
param += ":subme=3:merange=25:rc-lookahead=10:me=star:ctu=32:max-tu-size=32:min-cu-size=16:rskip=2:rskip-edge-threshold=2:no-sao=1:no-strong-intra-smoothing=1";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(videoEncoder, "libsvtav1", StringComparison.OrdinalIgnoreCase)
|
if (string.Equals(videoEncoder, "libsvtav1", StringComparison.OrdinalIgnoreCase)
|
||||||
@ -5691,7 +5696,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
if (!string.IsNullOrEmpty(doScaling)
|
if (!string.IsNullOrEmpty(doScaling)
|
||||||
&& !IsScaleRatioSupported(inW, inH, reqW, reqH, reqMaxW, reqMaxH, 8.0f))
|
&& !IsScaleRatioSupported(inW, inH, reqW, reqH, reqMaxW, reqMaxH, 8.0f))
|
||||||
{
|
{
|
||||||
var hwScaleFilterFirstPass = $"scale_rkrga=w=iw/7.9:h=ih/7.9:format={outFormat}:afbc=1";
|
// Vendor provided BSP kernel has an RGA driver bug that causes the output to be corrupted for P010 format.
|
||||||
|
// Use NV15 instead of P010 to avoid the issue.
|
||||||
|
// SDR inputs are using BGRA formats already which is not affected.
|
||||||
|
var intermediateFormat = string.Equals(outFormat, "p010", StringComparison.OrdinalIgnoreCase) ? "nv15" : outFormat;
|
||||||
|
var hwScaleFilterFirstPass = $"scale_rkrga=w=iw/7.9:h=ih/7.9:format={intermediateFormat}:force_divisible_by=4:afbc=1";
|
||||||
mainFilters.Add(hwScaleFilterFirstPass);
|
mainFilters.Add(hwScaleFilterFirstPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7065,7 +7074,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
{
|
{
|
||||||
// DTS and TrueHD are not supported by HLS
|
// DTS and TrueHD are not supported by HLS
|
||||||
// Keep them in the supported codecs list, but shift them to the end of the list so that if transcoding happens, another codec is used
|
// Keep them in the supported codecs list, but shift them to the end of the list so that if transcoding happens, another codec is used
|
||||||
shiftAudioCodecs.Add("dca");
|
shiftAudioCodecs.Add("dts");
|
||||||
shiftAudioCodecs.Add("truehd");
|
shiftAudioCodecs.Add("truehd");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Net
|
namespace MediaBrowser.Controller.Net
|
||||||
@ -20,31 +19,31 @@ namespace MediaBrowser.Controller.Net
|
|||||||
/// Gets or sets the device identifier.
|
/// Gets or sets the device identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The device identifier.</value>
|
/// <value>The device identifier.</value>
|
||||||
public string DeviceId { get; set; }
|
public string? DeviceId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the device.
|
/// Gets or sets the device.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The device.</value>
|
/// <value>The device.</value>
|
||||||
public string Device { get; set; }
|
public string? Device { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the client.
|
/// Gets or sets the client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The client.</value>
|
/// <value>The client.</value>
|
||||||
public string Client { get; set; }
|
public string? Client { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the version.
|
/// Gets or sets the version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The version.</value>
|
/// <value>The version.</value>
|
||||||
public string Version { get; set; }
|
public string? Version { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the token.
|
/// Gets or sets the token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The token.</value>
|
/// <value>The token.</value>
|
||||||
public string Token { get; set; }
|
public string? Token { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the authorization is from an api key.
|
/// Gets or sets a value indicating whether the authorization is from an api key.
|
||||||
@ -54,7 +53,7 @@ namespace MediaBrowser.Controller.Net
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user making the request.
|
/// Gets or sets the user making the request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public User User { get; set; }
|
public User? User { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the token is authenticated.
|
/// Gets or sets a value indicating whether the token is authenticated.
|
||||||
@ -62,8 +61,9 @@ namespace MediaBrowser.Controller.Net
|
|||||||
public bool IsAuthenticated { get; set; }
|
public bool IsAuthenticated { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the request has a token.
|
/// Gets a value indicating whether the request has a token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasToken { get; set; }
|
[MemberNotNullWhen(true, nameof(Token))]
|
||||||
|
public bool HasToken => !string.IsNullOrWhiteSpace(Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
public class SubtitleEditParser : ISubtitleParser
|
public class SubtitleEditParser : ISubtitleParser
|
||||||
{
|
{
|
||||||
private readonly ILogger<SubtitleEditParser> _logger;
|
private readonly ILogger<SubtitleEditParser> _logger;
|
||||||
private readonly Dictionary<string, SubtitleFormat[]> _subtitleFormats;
|
private readonly Dictionary<string, List<Type>> _subtitleFormatTypes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SubtitleEditParser"/> class.
|
/// Initializes a new instance of the <see cref="SubtitleEditParser"/> class.
|
||||||
@ -26,10 +26,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
public SubtitleEditParser(ILogger<SubtitleEditParser> logger)
|
public SubtitleEditParser(ILogger<SubtitleEditParser> logger)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_subtitleFormats = GetSubtitleFormats()
|
_subtitleFormatTypes = GetSubtitleFormatTypes();
|
||||||
.Where(subtitleFormat => !string.IsNullOrEmpty(subtitleFormat.Extension))
|
|
||||||
.GroupBy(subtitleFormat => subtitleFormat.Extension.TrimStart('.'), StringComparer.OrdinalIgnoreCase)
|
|
||||||
.ToDictionary(g => g.Key, g => g.ToArray(), StringComparer.OrdinalIgnoreCase);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -38,13 +35,14 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
var subtitle = new Subtitle();
|
var subtitle = new Subtitle();
|
||||||
var lines = stream.ReadAllLines().ToList();
|
var lines = stream.ReadAllLines().ToList();
|
||||||
|
|
||||||
if (!_subtitleFormats.TryGetValue(fileExtension, out var subtitleFormats))
|
if (!_subtitleFormatTypes.TryGetValue(fileExtension, out var subtitleFormatTypesForExtension))
|
||||||
{
|
{
|
||||||
throw new ArgumentException($"Unsupported file extension: {fileExtension}", nameof(fileExtension));
|
throw new ArgumentException($"Unsupported file extension: {fileExtension}", nameof(fileExtension));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var subtitleFormat in subtitleFormats)
|
foreach (var subtitleFormatType in subtitleFormatTypesForExtension)
|
||||||
{
|
{
|
||||||
|
var subtitleFormat = (SubtitleFormat)Activator.CreateInstance(subtitleFormatType, true)!;
|
||||||
_logger.LogDebug(
|
_logger.LogDebug(
|
||||||
"Trying to parse '{FileExtension}' subtitle using the {SubtitleFormatParser} format parser",
|
"Trying to parse '{FileExtension}' subtitle using the {SubtitleFormatParser} format parser",
|
||||||
fileExtension,
|
fileExtension,
|
||||||
@ -97,11 +95,11 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool SupportsFileExtension(string fileExtension)
|
public bool SupportsFileExtension(string fileExtension)
|
||||||
=> _subtitleFormats.ContainsKey(fileExtension);
|
=> _subtitleFormatTypes.ContainsKey(fileExtension);
|
||||||
|
|
||||||
private List<SubtitleFormat> GetSubtitleFormats()
|
private Dictionary<string, List<Type>> GetSubtitleFormatTypes()
|
||||||
{
|
{
|
||||||
var subtitleFormats = new List<SubtitleFormat>();
|
var subtitleFormatTypes = new Dictionary<string, List<Type>>(StringComparer.OrdinalIgnoreCase);
|
||||||
var assembly = typeof(SubtitleFormat).Assembly;
|
var assembly = typeof(SubtitleFormat).Assembly;
|
||||||
|
|
||||||
foreach (var type in assembly.GetTypes())
|
foreach (var type in assembly.GetTypes())
|
||||||
@ -113,9 +111,20 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// It shouldn't be null, but the exception is caught if it is
|
var tempInstance = (SubtitleFormat)Activator.CreateInstance(type, true)!;
|
||||||
var subtitleFormat = (SubtitleFormat)Activator.CreateInstance(type, true)!;
|
var extension = tempInstance.Extension.TrimStart('.');
|
||||||
subtitleFormats.Add(subtitleFormat);
|
if (!string.IsNullOrEmpty(extension))
|
||||||
|
{
|
||||||
|
// Store only the type, we will instantiate from it later
|
||||||
|
if (!subtitleFormatTypes.TryGetValue(extension, out var subtitleFormatTypesForExtension))
|
||||||
|
{
|
||||||
|
subtitleFormatTypes[extension] = [type];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
subtitleFormatTypesForExtension.Add(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -123,7 +132,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return subtitleFormats;
|
return subtitleFormatTypes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
private readonly ITranscoderSupport _transcoderSupport;
|
private readonly ITranscoderSupport _transcoderSupport;
|
||||||
private static readonly string[] _supportedHlsVideoCodecs = ["h264", "hevc", "vp9", "av1"];
|
private static readonly string[] _supportedHlsVideoCodecs = ["h264", "hevc", "vp9", "av1"];
|
||||||
private static readonly string[] _supportedHlsAudioCodecsTs = ["aac", "ac3", "eac3", "mp3"];
|
private static readonly string[] _supportedHlsAudioCodecsTs = ["aac", "ac3", "eac3", "mp3"];
|
||||||
private static readonly string[] _supportedHlsAudioCodecsMp4 = ["aac", "ac3", "eac3", "mp3", "alac", "flac", "opus", "dca", "truehd"];
|
private static readonly string[] _supportedHlsAudioCodecsMp4 = ["aac", "ac3", "eac3", "mp3", "alac", "flac", "opus", "dts", "truehd"];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="StreamBuilder"/> class.
|
/// Initializes a new instance of the <see cref="StreamBuilder"/> class.
|
||||||
@ -862,18 +862,37 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
|
|
||||||
if (options.AllowAudioStreamCopy)
|
if (options.AllowAudioStreamCopy)
|
||||||
{
|
{
|
||||||
if (ContainerHelper.ContainsContainer(transcodingProfile.AudioCodec, audioCodec))
|
// For Audio stream, we prefer the audio codec that can be directly copied, then the codec that can otherwise satisfies
|
||||||
|
// the transcoding conditions, then the one does not satisfy the transcoding conditions.
|
||||||
|
// For example: A client can support both aac and flac, but flac only supports 2 channels while aac supports 6.
|
||||||
|
// When the source audio is 6 channel flac, we should transcode to 6 channel aac, instead of down-mix to 2 channel flac.
|
||||||
|
var transcodingAudioCodecs = ContainerHelper.Split(transcodingProfile.AudioCodec);
|
||||||
|
|
||||||
|
foreach (var transcodingAudioCodec in transcodingAudioCodecs)
|
||||||
{
|
{
|
||||||
var appliedVideoConditions = options.Profile.CodecProfiles
|
var appliedVideoConditions = options.Profile.CodecProfiles
|
||||||
.Where(i => i.Type == CodecType.VideoAudio &&
|
.Where(i => i.Type == CodecType.VideoAudio &&
|
||||||
i.ContainsAnyCodec(audioCodec, container) &&
|
i.ContainsAnyCodec(transcodingAudioCodec, container) &&
|
||||||
i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, false)))
|
i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, false)))
|
||||||
.Select(i =>
|
.Select(i =>
|
||||||
i.Conditions.All(condition => ConditionProcessor.IsVideoAudioConditionSatisfied(condition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, false)));
|
i.Conditions.All(condition => ConditionProcessor.IsVideoAudioConditionSatisfied(condition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, false)));
|
||||||
|
|
||||||
// An empty appliedVideoConditions means that the codec has no conditions for the current audio stream
|
// An empty appliedVideoConditions means that the codec has no conditions for the current audio stream
|
||||||
var conditionsSatisfied = appliedVideoConditions.All(satisfied => satisfied);
|
var conditionsSatisfied = appliedVideoConditions.All(satisfied => satisfied);
|
||||||
rank.Audio = conditionsSatisfied ? 1 : 2;
|
|
||||||
|
var rankAudio = 3;
|
||||||
|
|
||||||
|
if (conditionsSatisfied)
|
||||||
|
{
|
||||||
|
rankAudio = string.Equals(transcodingAudioCodec, audioCodec, StringComparison.OrdinalIgnoreCase) ? 1 : 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
rank.Audio = Math.Min(rank.Audio, rankAudio);
|
||||||
|
|
||||||
|
if (rank.Audio == 1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -963,9 +982,28 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
|
|
||||||
var audioStreamWithSupportedCodec = candidateAudioStreams.Where(stream => ContainerHelper.ContainsContainer(audioCodecs, false, stream.Codec)).FirstOrDefault();
|
var audioStreamWithSupportedCodec = candidateAudioStreams.Where(stream => ContainerHelper.ContainsContainer(audioCodecs, false, stream.Codec)).FirstOrDefault();
|
||||||
|
|
||||||
var directAudioStream = audioStreamWithSupportedCodec?.Channels is not null && audioStreamWithSupportedCodec.Channels.Value <= (playlistItem.TranscodingMaxAudioChannels ?? int.MaxValue) ? audioStreamWithSupportedCodec : null;
|
var channelsExceedsLimit = audioStreamWithSupportedCodec is not null && audioStreamWithSupportedCodec.Channels > (playlistItem.TranscodingMaxAudioChannels ?? int.MaxValue);
|
||||||
|
|
||||||
var channelsExceedsLimit = audioStreamWithSupportedCodec is not null && directAudioStream is null;
|
var directAudioStreamSatisfied = audioStreamWithSupportedCodec is not null && !channelsExceedsLimit
|
||||||
|
&& options.Profile.CodecProfiles
|
||||||
|
.Where(i => i.Type == CodecType.VideoAudio
|
||||||
|
&& i.ContainsAnyCodec(audioStreamWithSupportedCodec.Codec, container)
|
||||||
|
&& i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioStreamWithSupportedCodec.Channels, audioStreamWithSupportedCodec.BitRate, audioStreamWithSupportedCodec.SampleRate, audioStreamWithSupportedCodec.BitDepth, audioStreamWithSupportedCodec.Profile, false)))
|
||||||
|
.Select(i => i.Conditions.All(condition =>
|
||||||
|
{
|
||||||
|
var satisfied = ConditionProcessor.IsVideoAudioConditionSatisfied(condition, audioStreamWithSupportedCodec.Channels, audioStreamWithSupportedCodec.BitRate, audioStreamWithSupportedCodec.SampleRate, audioStreamWithSupportedCodec.BitDepth, audioStreamWithSupportedCodec.Profile, false);
|
||||||
|
if (!satisfied)
|
||||||
|
{
|
||||||
|
playlistItem.TranscodeReasons |= GetTranscodeReasonForFailedCondition(condition);
|
||||||
|
}
|
||||||
|
|
||||||
|
return satisfied;
|
||||||
|
}))
|
||||||
|
.All(satisfied => satisfied);
|
||||||
|
|
||||||
|
directAudioStreamSatisfied = directAudioStreamSatisfied && !playlistItem.TranscodeReasons.HasFlag(TranscodeReason.ContainerBitrateExceedsLimit);
|
||||||
|
|
||||||
|
var directAudioStream = directAudioStreamSatisfied ? audioStreamWithSupportedCodec : null;
|
||||||
|
|
||||||
if (channelsExceedsLimit && playlistItem.TargetAudioStream is not null)
|
if (channelsExceedsLimit && playlistItem.TargetAudioStream is not null)
|
||||||
{
|
{
|
||||||
@ -2213,7 +2251,7 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsAudioDirectPlaySupported(DirectPlayProfile profile, MediaSourceInfo item, MediaStream audioStream)
|
private static bool IsAudioContainerSupported(DirectPlayProfile profile, MediaSourceInfo item)
|
||||||
{
|
{
|
||||||
// Check container type
|
// Check container type
|
||||||
if (!profile.SupportsContainer(item.Container))
|
if (!profile.SupportsContainer(item.Container))
|
||||||
@ -2221,6 +2259,20 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Never direct play audio in matroska when the device only declare support for webm.
|
||||||
|
// The first check is not enough because mkv is assumed can be webm.
|
||||||
|
// See https://github.com/jellyfin/jellyfin/issues/13344
|
||||||
|
return !ContainerHelper.ContainsContainer("mkv", item.Container)
|
||||||
|
|| profile.SupportsContainer("mkv");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsAudioDirectPlaySupported(DirectPlayProfile profile, MediaSourceInfo item, MediaStream audioStream)
|
||||||
|
{
|
||||||
|
if (!IsAudioContainerSupported(profile, item))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check audio codec
|
// Check audio codec
|
||||||
string? audioCodec = audioStream?.Codec;
|
string? audioCodec = audioStream?.Codec;
|
||||||
if (!profile.SupportsAudioCodec(audioCodec))
|
if (!profile.SupportsAudioCodec(audioCodec))
|
||||||
@ -2235,19 +2287,16 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
{
|
{
|
||||||
// Check container type, this should NOT be supported
|
// Check container type, this should NOT be supported
|
||||||
// If the container is supported, the file should be directly played
|
// If the container is supported, the file should be directly played
|
||||||
if (!profile.SupportsContainer(item.Container))
|
if (IsAudioContainerSupported(profile, item))
|
||||||
{
|
{
|
||||||
// Check audio codec, we cannot use the SupportsAudioCodec here
|
return false;
|
||||||
// Because that one assumes empty container supports all codec, which is just useless
|
|
||||||
string? audioCodec = audioStream?.Codec;
|
|
||||||
if (string.Equals(profile.AudioCodec, audioCodec, StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
string.Equals(profile.Container, audioCodec, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
// Check audio codec, we cannot use the SupportsAudioCodec here
|
||||||
|
// Because that one assumes empty container supports all codec, which is just useless
|
||||||
|
string? audioCodec = audioStream?.Codec;
|
||||||
|
return string.Equals(profile.AudioCodec, audioCodec, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| string.Equals(profile.Container, audioCodec, StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetRank(ref TranscodeReason a, TranscodeReason[] rankings)
|
private int GetRank(ref TranscodeReason a, TranscodeReason[] rankings)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using Jellyfin.Data.Enums;
|
using Jellyfin.Data.Enums;
|
||||||
@ -6,6 +7,7 @@ namespace MediaBrowser.Model.Dlna;
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A class for transcoding profile information.
|
/// A class for transcoding profile information.
|
||||||
|
/// Note for client developers: Conditions defined in <see cref="CodecProfile"/> has higher priority and can override values defined here.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TranscodingProfile
|
public class TranscodingProfile
|
||||||
{
|
{
|
||||||
@ -17,6 +19,33 @@ public class TranscodingProfile
|
|||||||
Conditions = [];
|
Conditions = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TranscodingProfile" /> class copying the values from another instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">Another instance of <see cref="TranscodingProfile" /> to be copied.</param>
|
||||||
|
public TranscodingProfile(TranscodingProfile other)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(other);
|
||||||
|
|
||||||
|
Container = other.Container;
|
||||||
|
Type = other.Type;
|
||||||
|
VideoCodec = other.VideoCodec;
|
||||||
|
AudioCodec = other.AudioCodec;
|
||||||
|
Protocol = other.Protocol;
|
||||||
|
EstimateContentLength = other.EstimateContentLength;
|
||||||
|
EnableMpegtsM2TsMode = other.EnableMpegtsM2TsMode;
|
||||||
|
TranscodeSeekInfo = other.TranscodeSeekInfo;
|
||||||
|
CopyTimestamps = other.CopyTimestamps;
|
||||||
|
Context = other.Context;
|
||||||
|
EnableSubtitlesInManifest = other.EnableSubtitlesInManifest;
|
||||||
|
MaxAudioChannels = other.MaxAudioChannels;
|
||||||
|
MinSegments = other.MinSegments;
|
||||||
|
SegmentLength = other.SegmentLength;
|
||||||
|
BreakOnNonKeyFrames = other.BreakOnNonKeyFrames;
|
||||||
|
Conditions = other.Conditions;
|
||||||
|
EnableAudioVbrEncoding = other.EnableAudioVbrEncoding;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the container.
|
/// Gets or sets the container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -291,6 +291,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
|
|
||||||
var fileStreamOptions = AsyncFile.WriteOptions;
|
var fileStreamOptions = AsyncFile.WriteOptions;
|
||||||
fileStreamOptions.Mode = FileMode.Create;
|
fileStreamOptions.Mode = FileMode.Create;
|
||||||
|
fileStreamOptions.Options = FileOptions.WriteThrough;
|
||||||
if (source.CanSeek)
|
if (source.CanSeek)
|
||||||
{
|
{
|
||||||
fileStreamOptions.PreallocationSize = source.Length;
|
fileStreamOptions.PreallocationSize = source.Length;
|
||||||
|
@ -183,7 +183,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
if (audio.SupportsPeople && !audio.LockedFields.Contains(MetadataField.Cast))
|
if (audio.SupportsPeople && !audio.LockedFields.Contains(MetadataField.Cast))
|
||||||
{
|
{
|
||||||
var people = new List<PersonInfo>();
|
var people = new List<PersonInfo>();
|
||||||
var albumArtists = string.IsNullOrEmpty(track.AlbumArtist) ? mediaInfo.AlbumArtists : track.AlbumArtist.Split(InternalValueSeparator);
|
var albumArtists = string.IsNullOrEmpty(track.AlbumArtist) ? [] : track.AlbumArtist.Split(InternalValueSeparator);
|
||||||
|
|
||||||
if (libraryOptions.UseCustomTagDelimiters)
|
if (libraryOptions.UseCustomTagDelimiters)
|
||||||
{
|
{
|
||||||
@ -214,7 +214,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
|
|
||||||
if (performers is null || performers.Length == 0)
|
if (performers is null || performers.Length == 0)
|
||||||
{
|
{
|
||||||
performers = string.IsNullOrEmpty(track.Artist) ? mediaInfo.Artists : track.Artist.Split(InternalValueSeparator);
|
performers = string.IsNullOrEmpty(track.Artist) ? [] : track.Artist.Split(InternalValueSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libraryOptions.UseCustomTagDelimiters)
|
if (libraryOptions.UseCustomTagDelimiters)
|
||||||
@ -318,7 +318,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
|
|
||||||
if (!audio.LockedFields.Contains(MetadataField.Genres))
|
if (!audio.LockedFields.Contains(MetadataField.Genres))
|
||||||
{
|
{
|
||||||
var genres = string.IsNullOrEmpty(track.Genre) ? mediaInfo.Genres : track.Genre.Split(InternalValueSeparator).Distinct(StringComparer.OrdinalIgnoreCase).ToArray();
|
var genres = string.IsNullOrEmpty(track.Genre) ? [] : track.Genre.Split(InternalValueSeparator).Distinct(StringComparer.OrdinalIgnoreCase).ToArray();
|
||||||
|
|
||||||
if (libraryOptions.UseCustomTagDelimiters)
|
if (libraryOptions.UseCustomTagDelimiters)
|
||||||
{
|
{
|
||||||
|
@ -140,38 +140,39 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
private void RemoveObsoleteEpisodes(Series series)
|
private void RemoveObsoleteEpisodes(Series series)
|
||||||
{
|
{
|
||||||
var episodes = series.GetEpisodes(null, new DtoOptions(), true).OfType<Episode>().ToList();
|
var episodesBySeason = series.GetEpisodes(null, new DtoOptions(), true)
|
||||||
var numberOfEpisodes = episodes.Count;
|
.OfType<Episode>()
|
||||||
// TODO: O(n^2), but can it be done faster without overcomplicating it?
|
.GroupBy(e => e.ParentIndexNumber)
|
||||||
for (var i = 0; i < numberOfEpisodes; i++)
|
.ToList();
|
||||||
|
|
||||||
|
foreach (var seasonEpisodes in episodesBySeason)
|
||||||
{
|
{
|
||||||
var currentEpisode = episodes[i];
|
List<Episode> nonPhysicalEpisodes = [];
|
||||||
// The outer loop only examines virtual episodes
|
List<Episode> physicalEpisodes = [];
|
||||||
if (!currentEpisode.IsVirtualItem)
|
foreach (var episode in seasonEpisodes)
|
||||||
{
|
{
|
||||||
continue;
|
if (episode.IsVirtualItem || episode.IsMissingEpisode)
|
||||||
|
{
|
||||||
|
nonPhysicalEpisodes.Add(episode);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
physicalEpisodes.Add(episode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Virtual episodes without an episode number are practically orphaned and should be deleted
|
// Only consider non-physical episodes
|
||||||
if (!currentEpisode.IndexNumber.HasValue)
|
foreach (var episode in nonPhysicalEpisodes)
|
||||||
{
|
{
|
||||||
DeleteEpisode(currentEpisode);
|
// Episodes without an episode number are practically orphaned and should be deleted
|
||||||
continue;
|
// Episodes with a physical equivalent should be deleted (they are no longer missing)
|
||||||
}
|
var shouldKeep = episode.IndexNumber.HasValue && !physicalEpisodes.Any(e => e.ContainsEpisodeNumber(episode.IndexNumber.Value));
|
||||||
|
|
||||||
for (var j = i + 1; j < numberOfEpisodes; j++)
|
if (shouldKeep)
|
||||||
{
|
|
||||||
var comparisonEpisode = episodes[j];
|
|
||||||
// The inner loop is only for "physical" episodes
|
|
||||||
if (comparisonEpisode.IsVirtualItem
|
|
||||||
|| currentEpisode.ParentIndexNumber != comparisonEpisode.ParentIndexNumber
|
|
||||||
|| !comparisonEpisode.ContainsEpisodeNumber(currentEpisode.IndexNumber.Value))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteEpisode(currentEpisode);
|
DeleteEpisode(episode);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,23 +50,20 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
case "id":
|
case "id":
|
||||||
{
|
{
|
||||||
// get ids from attributes
|
// Get ids from attributes
|
||||||
|
item.TrySetProviderId(MetadataProvider.Tmdb, reader.GetAttribute("TMDB"));
|
||||||
|
item.TrySetProviderId(MetadataProvider.Tvdb, reader.GetAttribute("TVDB"));
|
||||||
string? imdbId = reader.GetAttribute("IMDB");
|
string? imdbId = reader.GetAttribute("IMDB");
|
||||||
string? tmdbId = reader.GetAttribute("TMDB");
|
|
||||||
|
|
||||||
// read id from content
|
// Read id from content
|
||||||
|
// Content can be arbitrary according to Kodi wiki, so only parse if we are sure it matches a provider-specific schema
|
||||||
var contentId = reader.ReadElementContentAsString();
|
var contentId = reader.ReadElementContentAsString();
|
||||||
if (contentId.Contains("tt", StringComparison.Ordinal) && string.IsNullOrEmpty(imdbId))
|
if (string.IsNullOrEmpty(imdbId) && contentId.StartsWith("tt", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
imdbId = contentId;
|
imdbId = contentId;
|
||||||
}
|
}
|
||||||
else if (string.IsNullOrEmpty(tmdbId))
|
|
||||||
{
|
|
||||||
tmdbId = contentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
item.TrySetProviderId(MetadataProvider.Imdb, imdbId);
|
item.TrySetProviderId(MetadataProvider.Imdb, imdbId);
|
||||||
item.TrySetProviderId(MetadataProvider.Tmdb, tmdbId);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -82,21 +79,13 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(val) && movie is not null)
|
if (!string.IsNullOrWhiteSpace(val) && movie is not null)
|
||||||
{
|
{
|
||||||
// TODO Handle this better later
|
try
|
||||||
if (!val.Contains('<', StringComparison.Ordinal))
|
|
||||||
{
|
{
|
||||||
movie.CollectionName = val;
|
ParseSetXml(val, movie);
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
try
|
Logger.LogError(ex, "Error parsing set node");
|
||||||
{
|
|
||||||
ParseSetXml(val, movie);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.LogError(ex, "Error parsing set node");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +128,12 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
// Loop through each element
|
// Loop through each element
|
||||||
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
|
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
|
||||||
{
|
{
|
||||||
if (reader.NodeType == XmlNodeType.Element)
|
if (reader.NodeType == XmlNodeType.Text && reader.Depth == 1)
|
||||||
|
{
|
||||||
|
movie.CollectionName = reader.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (reader.NodeType == XmlNodeType.Element)
|
||||||
{
|
{
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Emby.Naming.TV;
|
using Emby.Naming.TV;
|
||||||
@ -48,16 +49,20 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
case "id":
|
case "id":
|
||||||
{
|
{
|
||||||
item.TrySetProviderId(MetadataProvider.Imdb, reader.GetAttribute("IMDB"));
|
// Get ids from attributes
|
||||||
item.TrySetProviderId(MetadataProvider.Tmdb, reader.GetAttribute("TMDB"));
|
item.TrySetProviderId(MetadataProvider.Tmdb, reader.GetAttribute("TMDB"));
|
||||||
|
item.TrySetProviderId(MetadataProvider.Tvdb, reader.GetAttribute("TVDB"));
|
||||||
|
string? imdbId = reader.GetAttribute("IMDB");
|
||||||
|
|
||||||
string? tvdbId = reader.GetAttribute("TVDB");
|
// Read id from content
|
||||||
if (string.IsNullOrWhiteSpace(tvdbId))
|
// Content can be arbitrary according to Kodi wiki, so only parse if we are sure it matches a provider-specific schema
|
||||||
|
var contentId = reader.ReadElementContentAsString();
|
||||||
|
if (string.IsNullOrEmpty(imdbId) && contentId.StartsWith("tt", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
tvdbId = reader.ReadElementContentAsString();
|
imdbId = contentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.TrySetProviderId(MetadataProvider.Tvdb, tvdbId);
|
item.TrySetProviderId(MetadataProvider.Imdb, imdbId);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(movie.CollectionName))
|
if (!string.IsNullOrEmpty(movie.CollectionName))
|
||||||
{
|
{
|
||||||
writer.WriteElementString("set", movie.CollectionName);
|
writer.WriteStartElement("set");
|
||||||
|
writer.WriteElementString("name", movie.CollectionName);
|
||||||
|
writer.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,8 +195,10 @@ public class SkiaEncoder : IImageEncoder
|
|||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use FileStream with FileShare.Read instead of having Skia open the file to allow concurrent read access
|
||||||
|
using var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||||
// Any larger than 128x128 is too slow and there's no visually discernible difference
|
// Any larger than 128x128 is too slow and there's no visually discernible difference
|
||||||
return BlurHashEncoder.Encode(xComp, yComp, path, 128, 128);
|
return BlurHashEncoder.Encode(xComp, yComp, fileStream, 128, 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool RequiresSpecialCharacterHack(string path)
|
private bool RequiresSpecialCharacterHack(string path)
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Jellyfin.Data.Entities.Libraries;
|
||||||
using Jellyfin.Data.Enums;
|
using Jellyfin.Data.Enums;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using Jellyfin.LiveTv.Configuration;
|
using Jellyfin.LiveTv.Configuration;
|
||||||
@ -39,6 +40,11 @@ public class GuideManager : IGuideManager
|
|||||||
private readonly IRecordingsManager _recordingsManager;
|
private readonly IRecordingsManager _recordingsManager;
|
||||||
private readonly LiveTvDtoService _tvDtoService;
|
private readonly LiveTvDtoService _tvDtoService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Amount of days images are pre-cached from external sources.
|
||||||
|
/// </summary>
|
||||||
|
public const int MaxCacheDays = 2;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="GuideManager"/> class.
|
/// Initializes a new instance of the <see cref="GuideManager"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -204,14 +210,14 @@ public class GuideManager : IGuideManager
|
|||||||
progress.Report(15);
|
progress.Report(15);
|
||||||
|
|
||||||
numComplete = 0;
|
numComplete = 0;
|
||||||
var programs = new List<Guid>();
|
var programs = new List<LiveTvProgram>();
|
||||||
var channels = new List<Guid>();
|
var channels = new List<Guid>();
|
||||||
|
|
||||||
var guideDays = GetGuideDays();
|
var guideDays = GetGuideDays();
|
||||||
|
|
||||||
_logger.LogInformation("Refreshing guide with {0} days of guide data", guideDays);
|
_logger.LogInformation("Refreshing guide with {Days} days of guide data", guideDays);
|
||||||
|
|
||||||
var maxCacheDate = DateTime.UtcNow.AddDays(2);
|
var maxCacheDate = DateTime.UtcNow.AddDays(MaxCacheDays);
|
||||||
foreach (var currentChannel in list)
|
foreach (var currentChannel in list)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
@ -237,22 +243,23 @@ public class GuideManager : IGuideManager
|
|||||||
DtoOptions = new DtoOptions(true)
|
DtoOptions = new DtoOptions(true)
|
||||||
}).Cast<LiveTvProgram>().ToDictionary(i => i.Id);
|
}).Cast<LiveTvProgram>().ToDictionary(i => i.Id);
|
||||||
|
|
||||||
var newPrograms = new List<LiveTvProgram>();
|
var newPrograms = new List<Guid>();
|
||||||
var updatedPrograms = new List<BaseItem>();
|
var updatedPrograms = new List<Guid>();
|
||||||
|
|
||||||
foreach (var program in channelPrograms)
|
foreach (var program in channelPrograms)
|
||||||
{
|
{
|
||||||
var (programItem, isNew, isUpdated) = GetProgram(program, existingPrograms, currentChannel);
|
var (programItem, isNew, isUpdated) = GetProgram(program, existingPrograms, currentChannel);
|
||||||
|
var id = programItem.Id;
|
||||||
if (isNew)
|
if (isNew)
|
||||||
{
|
{
|
||||||
newPrograms.Add(programItem);
|
newPrograms.Add(id);
|
||||||
}
|
}
|
||||||
else if (isUpdated)
|
else if (isUpdated)
|
||||||
{
|
{
|
||||||
updatedPrograms.Add(programItem);
|
updatedPrograms.Add(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
programs.Add(programItem.Id);
|
programs.Add(programItem);
|
||||||
|
|
||||||
isMovie |= program.IsMovie;
|
isMovie |= program.IsMovie;
|
||||||
isSeries |= program.IsSeries;
|
isSeries |= program.IsSeries;
|
||||||
@ -261,24 +268,30 @@ public class GuideManager : IGuideManager
|
|||||||
isKids |= program.IsKids;
|
isKids |= program.IsKids;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogDebug("Channel {0} has {1} new programs and {2} updated programs", currentChannel.Name, newPrograms.Count, updatedPrograms.Count);
|
_logger.LogDebug(
|
||||||
|
"Channel {Name} has {NewCount} new programs and {UpdatedCount} updated programs",
|
||||||
|
currentChannel.Name,
|
||||||
|
newPrograms.Count,
|
||||||
|
updatedPrograms.Count);
|
||||||
|
|
||||||
if (newPrograms.Count > 0)
|
if (newPrograms.Count > 0)
|
||||||
{
|
{
|
||||||
_libraryManager.CreateOrUpdateItems(newPrograms, null, cancellationToken);
|
var newProgramDtos = programs.Where(b => newPrograms.Contains(b.Id)).ToList();
|
||||||
await PrecacheImages(newPrograms, maxCacheDate).ConfigureAwait(false);
|
_libraryManager.CreateOrUpdateItems(newProgramDtos, null, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updatedPrograms.Count > 0)
|
if (updatedPrograms.Count > 0)
|
||||||
{
|
{
|
||||||
|
var updatedProgramDtos = programs.Where(b => updatedPrograms.Contains(b.Id)).ToList();
|
||||||
await _libraryManager.UpdateItemsAsync(
|
await _libraryManager.UpdateItemsAsync(
|
||||||
updatedPrograms,
|
updatedProgramDtos,
|
||||||
currentChannel,
|
currentChannel,
|
||||||
ItemUpdateType.MetadataImport,
|
ItemUpdateType.MetadataImport,
|
||||||
cancellationToken).ConfigureAwait(false);
|
cancellationToken).ConfigureAwait(false);
|
||||||
await PrecacheImages(updatedPrograms, maxCacheDate).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await PreCacheImages(programs, maxCacheDate).ConfigureAwait(false);
|
||||||
|
|
||||||
currentChannel.IsMovie = isMovie;
|
currentChannel.IsMovie = isMovie;
|
||||||
currentChannel.IsNews = isNews;
|
currentChannel.IsNews = isNews;
|
||||||
currentChannel.IsSports = isSports;
|
currentChannel.IsSports = isSports;
|
||||||
@ -313,7 +326,8 @@ public class GuideManager : IGuideManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
progress.Report(100);
|
progress.Report(100);
|
||||||
return new Tuple<List<Guid>, List<Guid>>(channels, programs);
|
var programIds = programs.Select(p => p.Id).ToList();
|
||||||
|
return new Tuple<List<Guid>, List<Guid>>(channels, programIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CleanDatabase(Guid[] currentIdList, BaseItemKind[] validTypes, IProgress<double> progress, CancellationToken cancellationToken)
|
private void CleanDatabase(Guid[] currentIdList, BaseItemKind[] validTypes, IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
@ -618,77 +632,17 @@ public class GuideManager : IGuideManager
|
|||||||
item.IndexNumber = info.EpisodeNumber;
|
item.IndexNumber = info.EpisodeNumber;
|
||||||
item.ParentIndexNumber = info.SeasonNumber;
|
item.ParentIndexNumber = info.SeasonNumber;
|
||||||
|
|
||||||
if (!item.HasImage(ImageType.Primary))
|
forceUpdate = forceUpdate || UpdateImages(item, info);
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(info.ImagePath))
|
|
||||||
{
|
|
||||||
item.SetImage(
|
|
||||||
new ItemImageInfo
|
|
||||||
{
|
|
||||||
Path = info.ImagePath,
|
|
||||||
Type = ImageType.Primary
|
|
||||||
},
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
else if (!string.IsNullOrWhiteSpace(info.ImageUrl))
|
|
||||||
{
|
|
||||||
item.SetImage(
|
|
||||||
new ItemImageInfo
|
|
||||||
{
|
|
||||||
Path = info.ImageUrl,
|
|
||||||
Type = ImageType.Primary
|
|
||||||
},
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!item.HasImage(ImageType.Thumb))
|
if (isNew)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(info.ThumbImageUrl))
|
item.OnMetadataChanged();
|
||||||
{
|
|
||||||
item.SetImage(
|
|
||||||
new ItemImageInfo
|
|
||||||
{
|
|
||||||
Path = info.ThumbImageUrl,
|
|
||||||
Type = ImageType.Thumb
|
|
||||||
},
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!item.HasImage(ImageType.Logo))
|
return (item, isNew, false);
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(info.LogoImageUrl))
|
|
||||||
{
|
|
||||||
item.SetImage(
|
|
||||||
new ItemImageInfo
|
|
||||||
{
|
|
||||||
Path = info.LogoImageUrl,
|
|
||||||
Type = ImageType.Logo
|
|
||||||
},
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!item.HasImage(ImageType.Backdrop))
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(info.BackdropImageUrl))
|
|
||||||
{
|
|
||||||
item.SetImage(
|
|
||||||
new ItemImageInfo
|
|
||||||
{
|
|
||||||
Path = info.BackdropImageUrl,
|
|
||||||
Type = ImageType.Backdrop
|
|
||||||
},
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var isUpdated = false;
|
var isUpdated = false;
|
||||||
if (isNew)
|
if (forceUpdate || string.IsNullOrWhiteSpace(info.Etag))
|
||||||
{
|
|
||||||
}
|
|
||||||
else if (forceUpdate || string.IsNullOrWhiteSpace(info.Etag))
|
|
||||||
{
|
{
|
||||||
isUpdated = true;
|
isUpdated = true;
|
||||||
}
|
}
|
||||||
@ -703,7 +657,7 @@ public class GuideManager : IGuideManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNew || isUpdated)
|
if (isUpdated)
|
||||||
{
|
{
|
||||||
item.OnMetadataChanged();
|
item.OnMetadataChanged();
|
||||||
}
|
}
|
||||||
@ -711,7 +665,80 @@ public class GuideManager : IGuideManager
|
|||||||
return (item, isNew, isUpdated);
|
return (item, isNew, isUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task PrecacheImages(IReadOnlyList<BaseItem> programs, DateTime maxCacheDate)
|
private static bool UpdateImages(BaseItem item, ProgramInfo info)
|
||||||
|
{
|
||||||
|
var updated = false;
|
||||||
|
|
||||||
|
// Primary
|
||||||
|
updated |= UpdateImage(ImageType.Primary, item, info);
|
||||||
|
|
||||||
|
// Thumbnail
|
||||||
|
updated |= UpdateImage(ImageType.Thumb, item, info);
|
||||||
|
|
||||||
|
// Logo
|
||||||
|
updated |= UpdateImage(ImageType.Logo, item, info);
|
||||||
|
|
||||||
|
// Backdrop
|
||||||
|
return updated || UpdateImage(ImageType.Backdrop, item, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool UpdateImage(ImageType imageType, BaseItem item, ProgramInfo info)
|
||||||
|
{
|
||||||
|
var image = item.GetImages(imageType).FirstOrDefault();
|
||||||
|
var currentImagePath = image?.Path;
|
||||||
|
var newImagePath = imageType switch
|
||||||
|
{
|
||||||
|
ImageType.Primary => info.ImagePath,
|
||||||
|
_ => string.Empty
|
||||||
|
};
|
||||||
|
var newImageUrl = imageType switch
|
||||||
|
{
|
||||||
|
ImageType.Backdrop => info.BackdropImageUrl,
|
||||||
|
ImageType.Logo => info.LogoImageUrl,
|
||||||
|
ImageType.Primary => info.ImageUrl,
|
||||||
|
ImageType.Thumb => info.ThumbImageUrl,
|
||||||
|
_ => string.Empty
|
||||||
|
};
|
||||||
|
|
||||||
|
var differentImage = newImageUrl?.Equals(currentImagePath, StringComparison.OrdinalIgnoreCase) == false
|
||||||
|
|| newImagePath?.Equals(currentImagePath, StringComparison.OrdinalIgnoreCase) == false;
|
||||||
|
if (!differentImage)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newImagePath))
|
||||||
|
{
|
||||||
|
item.SetImage(
|
||||||
|
new ItemImageInfo
|
||||||
|
{
|
||||||
|
Path = newImagePath,
|
||||||
|
Type = imageType
|
||||||
|
},
|
||||||
|
0);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newImageUrl))
|
||||||
|
{
|
||||||
|
item.SetImage(
|
||||||
|
new ItemImageInfo
|
||||||
|
{
|
||||||
|
Path = newImageUrl,
|
||||||
|
Type = imageType
|
||||||
|
},
|
||||||
|
0);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
item.RemoveImage(image);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task PreCacheImages(IReadOnlyList<BaseItem> programs, DateTime maxCacheDate)
|
||||||
{
|
{
|
||||||
await Parallel.ForEachAsync(
|
await Parallel.ForEachAsync(
|
||||||
programs
|
programs
|
||||||
@ -741,7 +768,7 @@ public class GuideManager : IGuideManager
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogWarning(ex, "Unable to precache {Url}", imageInfo.Path);
|
_logger.LogWarning(ex, "Unable to pre-cache {Url}", imageInfo.Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ using System.Threading.Tasks;
|
|||||||
using AsyncKeyedLock;
|
using AsyncKeyedLock;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using Jellyfin.Extensions.Json;
|
using Jellyfin.Extensions.Json;
|
||||||
|
using Jellyfin.LiveTv.Guide;
|
||||||
using Jellyfin.LiveTv.Listings.SchedulesDirectDtos;
|
using Jellyfin.LiveTv.Listings.SchedulesDirectDtos;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Authentication;
|
using MediaBrowser.Controller.Authentication;
|
||||||
@ -38,7 +39,7 @@ namespace Jellyfin.LiveTv.Listings
|
|||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly AsyncNonKeyedLocker _tokenLock = new(1);
|
private readonly AsyncNonKeyedLocker _tokenLock = new(1);
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<string, NameValuePair> _tokens = new ConcurrentDictionary<string, NameValuePair>();
|
private readonly ConcurrentDictionary<string, NameValuePair> _tokens = new();
|
||||||
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
|
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
|
||||||
private DateTime _lastErrorResponse;
|
private DateTime _lastErrorResponse;
|
||||||
private bool _disposed = false;
|
private bool _disposed = false;
|
||||||
@ -86,7 +87,7 @@ namespace Jellyfin.LiveTv.Listings
|
|||||||
{
|
{
|
||||||
_logger.LogWarning("SchedulesDirect token is empty, returning empty program list");
|
_logger.LogWarning("SchedulesDirect token is empty, returning empty program list");
|
||||||
|
|
||||||
return Enumerable.Empty<ProgramInfo>();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var dates = GetScheduleRequestDates(startDateUtc, endDateUtc);
|
var dates = GetScheduleRequestDates(startDateUtc, endDateUtc);
|
||||||
@ -94,7 +95,7 @@ namespace Jellyfin.LiveTv.Listings
|
|||||||
_logger.LogInformation("Channel Station ID is: {ChannelID}", channelId);
|
_logger.LogInformation("Channel Station ID is: {ChannelID}", channelId);
|
||||||
var requestList = new List<RequestScheduleForChannelDto>()
|
var requestList = new List<RequestScheduleForChannelDto>()
|
||||||
{
|
{
|
||||||
new RequestScheduleForChannelDto()
|
new()
|
||||||
{
|
{
|
||||||
StationId = channelId,
|
StationId = channelId,
|
||||||
Date = dates
|
Date = dates
|
||||||
@ -109,7 +110,7 @@ namespace Jellyfin.LiveTv.Listings
|
|||||||
var dailySchedules = await Request<IReadOnlyList<DayDto>>(options, true, info, cancellationToken).ConfigureAwait(false);
|
var dailySchedules = await Request<IReadOnlyList<DayDto>>(options, true, info, cancellationToken).ConfigureAwait(false);
|
||||||
if (dailySchedules is null)
|
if (dailySchedules is null)
|
||||||
{
|
{
|
||||||
return Array.Empty<ProgramInfo>();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId);
|
_logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId);
|
||||||
@ -120,17 +121,17 @@ namespace Jellyfin.LiveTv.Listings
|
|||||||
var programIds = dailySchedules.SelectMany(d => d.Programs.Select(s => s.ProgramId)).Distinct();
|
var programIds = dailySchedules.SelectMany(d => d.Programs.Select(s => s.ProgramId)).Distinct();
|
||||||
programRequestOptions.Content = JsonContent.Create(programIds, options: _jsonOptions);
|
programRequestOptions.Content = JsonContent.Create(programIds, options: _jsonOptions);
|
||||||
|
|
||||||
var programDetails = await Request<IReadOnlyList<ProgramDetailsDto>>(programRequestOptions, true, info, cancellationToken)
|
var programDetails = await Request<IReadOnlyList<ProgramDetailsDto>>(programRequestOptions, true, info, cancellationToken).ConfigureAwait(false);
|
||||||
.ConfigureAwait(false);
|
|
||||||
if (programDetails is null)
|
if (programDetails is null)
|
||||||
{
|
{
|
||||||
return Array.Empty<ProgramInfo>();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var programDict = programDetails.ToDictionary(p => p.ProgramId, y => y);
|
var programDict = programDetails.ToDictionary(p => p.ProgramId, y => y);
|
||||||
|
|
||||||
var programIdsWithImages = programDetails
|
var programIdsWithImages = programDetails
|
||||||
.Where(p => p.HasImageArtwork).Select(p => p.ProgramId)
|
.Where(p => p.HasImageArtwork)
|
||||||
|
.Select(p => p.ProgramId)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false);
|
var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false);
|
||||||
@ -138,17 +139,15 @@ namespace Jellyfin.LiveTv.Listings
|
|||||||
var programsInfo = new List<ProgramInfo>();
|
var programsInfo = new List<ProgramInfo>();
|
||||||
foreach (ProgramDto schedule in dailySchedules.SelectMany(d => d.Programs))
|
foreach (ProgramDto schedule in dailySchedules.SelectMany(d => d.Programs))
|
||||||
{
|
{
|
||||||
// _logger.LogDebug("Processing Schedule for station ID " + stationID +
|
|
||||||
// " which corresponds to channel " + channelNumber + " and program id " +
|
|
||||||
// schedule.ProgramId + " which says it has images? " +
|
|
||||||
// programDict[schedule.ProgramId].hasImageArtwork);
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(schedule.ProgramId))
|
if (string.IsNullOrEmpty(schedule.ProgramId))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (images is not null)
|
// Only add images which will be pre-cached until we can implement dynamic token fetching
|
||||||
|
var endDate = schedule.AirDateTime?.AddSeconds(schedule.Duration);
|
||||||
|
var willBeCached = endDate.HasValue && endDate.Value < DateTime.UtcNow.AddDays(GuideManager.MaxCacheDays);
|
||||||
|
if (willBeCached && images is not null)
|
||||||
{
|
{
|
||||||
var imageIndex = images.FindIndex(i => i.ProgramId == schedule.ProgramId[..10]);
|
var imageIndex = images.FindIndex(i => i.ProgramId == schedule.ProgramId[..10]);
|
||||||
if (imageIndex > -1)
|
if (imageIndex > -1)
|
||||||
@ -456,7 +455,7 @@ namespace Jellyfin.LiveTv.Listings
|
|||||||
|
|
||||||
if (programIds.Count == 0)
|
if (programIds.Count == 0)
|
||||||
{
|
{
|
||||||
return Array.Empty<ShowImagesDto>();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder str = new StringBuilder("[", 1 + (programIds.Count * 13));
|
StringBuilder str = new StringBuilder("[", 1 + (programIds.Count * 13));
|
||||||
@ -483,7 +482,7 @@ namespace Jellyfin.LiveTv.Listings
|
|||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error getting image info from schedules direct");
|
_logger.LogError(ex, "Error getting image info from schedules direct");
|
||||||
|
|
||||||
return Array.Empty<ShowImagesDto>();
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,7 +702,7 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!_lanSubnets.Any(x => x.Contains(remoteIP)))
|
else if (!IsInLocalNetwork(remoteIP))
|
||||||
{
|
{
|
||||||
// Remote not enabled. So everyone should be LAN.
|
// Remote not enabled. So everyone should be LAN.
|
||||||
return false;
|
return false;
|
||||||
@ -997,7 +997,9 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
// Get interface matching override subnet
|
// Get interface matching override subnet
|
||||||
var intf = _interfaces.OrderBy(x => x.Index).FirstOrDefault(x => data.Data.Subnet.Contains(x.Address));
|
var intf = _interfaces.OrderBy(x => x.Index).FirstOrDefault(x => data.Data.Subnet.Contains(x.Address));
|
||||||
|
|
||||||
if (intf?.Address is not null)
|
if (intf?.Address is not null
|
||||||
|
|| (data.Data.AddressFamily == AddressFamily.InterNetwork && data.Data.Address.Equals(IPAddress.Any))
|
||||||
|
|| (data.Data.AddressFamily == AddressFamily.InterNetworkV6 && data.Data.Address.Equals(IPAddress.IPv6Any)))
|
||||||
{
|
{
|
||||||
// If matching interface is found, use override
|
// If matching interface is found, use override
|
||||||
bindPreference = data.OverrideUri;
|
bindPreference = data.OverrideUri;
|
||||||
@ -1025,6 +1027,7 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogDebug("{Source}: Matching bind address override found: {Address}", source, bindPreference);
|
_logger.LogDebug("{Source}: Matching bind address override found: {Address}", source, bindPreference);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1063,6 +1066,7 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
// If none exists, this will select the first external interface if there is one.
|
// If none exists, this will select the first external interface if there is one.
|
||||||
bindAddress = externalInterfaces
|
bindAddress = externalInterfaces
|
||||||
.OrderByDescending(x => x.Subnet.Contains(source))
|
.OrderByDescending(x => x.Subnet.Contains(source))
|
||||||
|
.ThenByDescending(x => x.Subnet.PrefixLength)
|
||||||
.ThenBy(x => x.Index)
|
.ThenBy(x => x.Index)
|
||||||
.Select(x => x.Address)
|
.Select(x => x.Address)
|
||||||
.First();
|
.First();
|
||||||
@ -1080,6 +1084,7 @@ public class NetworkManager : INetworkManager, IDisposable
|
|||||||
// If none exists, this will select the first internal interface if there is one.
|
// If none exists, this will select the first internal interface if there is one.
|
||||||
bindAddress = _interfaces.Where(x => IsInLocalNetwork(x.Address))
|
bindAddress = _interfaces.Where(x => IsInLocalNetwork(x.Address))
|
||||||
.OrderByDescending(x => x.Subnet.Contains(source))
|
.OrderByDescending(x => x.Subnet.Contains(source))
|
||||||
|
.ThenByDescending(x => x.Subnet.PrefixLength)
|
||||||
.ThenBy(x => x.Index)
|
.ThenBy(x => x.Index)
|
||||||
.Select(x => x.Address)
|
.Select(x => x.Address)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
@ -101,6 +101,7 @@ namespace Jellyfin.Api.Tests.Auth
|
|||||||
var authorizationInfo = SetupUser();
|
var authorizationInfo = SetupUser();
|
||||||
var authenticateResult = await _sut.AuthenticateAsync();
|
var authenticateResult = await _sut.AuthenticateAsync();
|
||||||
|
|
||||||
|
Assert.NotNull(authorizationInfo.User);
|
||||||
Assert.True(authenticateResult.Principal?.HasClaim(ClaimTypes.Name, authorizationInfo.User.Username));
|
Assert.True(authenticateResult.Principal?.HasClaim(ClaimTypes.Name, authorizationInfo.User.Username));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +113,7 @@ namespace Jellyfin.Api.Tests.Auth
|
|||||||
var authorizationInfo = SetupUser(isAdmin);
|
var authorizationInfo = SetupUser(isAdmin);
|
||||||
var authenticateResult = await _sut.AuthenticateAsync();
|
var authenticateResult = await _sut.AuthenticateAsync();
|
||||||
|
|
||||||
|
Assert.NotNull(authorizationInfo.User);
|
||||||
var expectedRole = authorizationInfo.User.HasPermission(PermissionKind.IsAdministrator) ? UserRoles.Administrator : UserRoles.User;
|
var expectedRole = authorizationInfo.User.HasPermission(PermissionKind.IsAdministrator) ? UserRoles.Administrator : UserRoles.User;
|
||||||
Assert.True(authenticateResult.Principal?.HasClaim(ClaimTypes.Role, expectedRole));
|
Assert.True(authenticateResult.Principal?.HasClaim(ClaimTypes.Role, expectedRole));
|
||||||
}
|
}
|
||||||
@ -133,7 +135,6 @@ namespace Jellyfin.Api.Tests.Auth
|
|||||||
authorizationInfo.User.AddDefaultPreferences();
|
authorizationInfo.User.AddDefaultPreferences();
|
||||||
authorizationInfo.User.SetPermission(PermissionKind.IsAdministrator, isAdmin);
|
authorizationInfo.User.SetPermission(PermissionKind.IsAdministrator, isAdmin);
|
||||||
authorizationInfo.IsApiKey = false;
|
authorizationInfo.IsApiKey = false;
|
||||||
authorizationInfo.HasToken = true;
|
|
||||||
authorizationInfo.Token = "fake-token";
|
authorizationInfo.Token = "fake-token";
|
||||||
|
|
||||||
_jellyfinAuthServiceMock.Setup(
|
_jellyfinAuthServiceMock.Setup(
|
||||||
|
@ -84,7 +84,7 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
|
|||||||
await localizationManager.LoadAll();
|
await localizationManager.LoadAll();
|
||||||
var ratings = localizationManager.GetParentalRatings().ToList();
|
var ratings = localizationManager.GetParentalRatings().ToList();
|
||||||
|
|
||||||
Assert.Equal(54, ratings.Count);
|
Assert.Equal(56, ratings.Count);
|
||||||
|
|
||||||
var tvma = ratings.FirstOrDefault(x => x.Name.Equals("TV-MA", StringComparison.Ordinal));
|
var tvma = ratings.FirstOrDefault(x => x.Name.Equals("TV-MA", StringComparison.Ordinal));
|
||||||
Assert.NotNull(tvma);
|
Assert.NotNull(tvma);
|
||||||
|
@ -257,5 +257,23 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
|
|||||||
|
|
||||||
Assert.Throws<ArgumentException>(() => _parser.Fetch(result, string.Empty, CancellationToken.None));
|
Assert.Throws<ArgumentException>(() => _parser.Fetch(result, string.Empty, CancellationToken.None));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Parsing_Fields_With_Escaped_Xml_Special_Characters_Success()
|
||||||
|
{
|
||||||
|
var result = new MetadataResult<Video>()
|
||||||
|
{
|
||||||
|
Item = new Movie()
|
||||||
|
};
|
||||||
|
|
||||||
|
_parser.Fetch(result, "Test Data/Lilo & Stitch.nfo", CancellationToken.None);
|
||||||
|
var item = (Movie)result.Item;
|
||||||
|
|
||||||
|
Assert.Equal("Lilo & Stitch", item.Name);
|
||||||
|
Assert.Equal("Lilo & Stitch", item.OriginalTitle);
|
||||||
|
Assert.Equal("Lilo & Stitch Collection", item.CollectionName);
|
||||||
|
Assert.StartsWith(">>", item.Overview, StringComparison.InvariantCulture);
|
||||||
|
Assert.EndsWith("<<", item.Overview, StringComparison.InvariantCulture);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||||
|
<movie>
|
||||||
|
<title>Lilo & Stitch</title>
|
||||||
|
<originaltitle>Lilo & Stitch</originaltitle>
|
||||||
|
<set>Lilo & Stitch Collection</set>
|
||||||
|
<plot>>>As Stitch, a runaway genetic experiment from a faraway planet, wreaks havoc on the Hawaiian Islands, he becomes the mischievous adopted alien "puppy" of an independent little girl named Lilo and learns about loyalty, friendship, and ʻohana, the Hawaiian tradition of family.<<</plot>
|
||||||
|
</movie>
|
Loading…
x
Reference in New Issue
Block a user