The Free Software Media System - Server Backend & API
Add OriginalLanguage as option to PreferredAudioLanguage (#12579)
Erik We1e18e8da015
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.mdindex e5478a7ba6..09a7198afe 100644--- a/CONTRIBUTORS.md+++ b/CONTRIBUTORS.md@@ -230,6 +230,7 @@- [LiHRaM](https://github.com/LiHRaM)- [MSalman5230](https://github.com/MSalman5230)- [dwandw](https://github.com/dwandw)+ - [Lampan-git](https://github.com/Lampan-git)# Emby Contributorsdiff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.csindex 94e2468719..321c7da1c4 100644--- a/Emby.Server.Implementations/Dto/DtoService.cs+++ b/Emby.Server.Implementations/Dto/DtoService.cs@@ -1067,6 +1067,8 @@ namespace Emby.Server.Implementations.Dtodto.OriginalTitle = item.OriginalTitle;}+ dto.OriginalLanguage = item.OriginalLanguage;+if (options.ContainsField(ItemFields.ParentId)){dto.ParentId = item.DisplayParentId;diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.csindex c667fb0600..fdb4c7328b 100644--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs@@ -23,6 +23,7 @@ using MediaBrowser.Common.Configuration;using MediaBrowser.Common.Extensions;using MediaBrowser.Controller;using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Entities.TV;using MediaBrowser.Controller.Library;using MediaBrowser.Controller.LiveTv;using MediaBrowser.Controller.MediaEncoding;@@ -423,7 +424,7 @@ namespace Emby.Server.Implementations.LibraryMediaStreamSelector.SetSubtitleStreamScores(source.MediaStreams, preferredSubs, user.SubtitleMode, audioLanguage);}- private void SetDefaultAudioStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection)+ private void SetDefaultAudioStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection, string originalLanguage){if (userData is not null && userData.AudioStreamIndex.HasValue && user.RememberAudioSelections && allowRememberingSelection){@@ -437,7 +438,42 @@ namespace Emby.Server.Implementations.Library}}- var preferredAudio = NormalizeLanguage(user.AudioLanguagePreference);+ if (string.Equals(user.AudioLanguagePreference, "OriginalLanguage", StringComparison.OrdinalIgnoreCase))+ {+ originalLanguage = !string.IsNullOrWhiteSpace(originalLanguage)+ ? originalLanguage.Split(',').FirstOrDefault()+ : null;++ if (user.PlayDefaultAudioTrack)+ {+ source.DefaultAudioStreamIndex = MediaStreamSelector.GetDefaultAudioStreamIndex(+ source.MediaStreams,+ NormalizeLanguage(originalLanguage),+ user.PlayDefaultAudioTrack);+ return;+ }++ var originalIndex = source.MediaStreams.FindIndex(i => i.Type == MediaStreamType.Audio && i.IsOriginal);++ if (!string.IsNullOrWhiteSpace(originalLanguage) && originalIndex != -1)+ {+ var mediaLanguageOriginal = source.MediaStreams[originalIndex].Language;+ if (NormalizeLanguage(mediaLanguageOriginal).Contains(NormalizeLanguage(originalLanguage).FirstOrDefault()))+ {+ source.DefaultAudioStreamIndex = originalIndex;+ return;+ }+ }+ else if (originalIndex != -1)+ {+ source.DefaultAudioStreamIndex = originalIndex;+ return;+ }+ }++ var preferredAudio = string.Equals(user.AudioLanguagePreference, "OriginalLanguage", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(originalLanguage)+ ? NormalizeLanguage(originalLanguage)+ : NormalizeLanguage(user.AudioLanguagePreference);source.DefaultAudioStreamIndex = MediaStreamSelector.GetDefaultAudioStreamIndex(source.MediaStreams, preferredAudio, user.PlayDefaultAudioTrack);if (user.PlayDefaultAudioTrack)@@ -462,7 +498,19 @@ namespace Emby.Server.Implementations.Libraryvar allowRememberingSelection = item is null || item.EnableRememberingTrackSelections;- SetDefaultAudioStreamIndex(source, userData, user, allowRememberingSelection);+ var originalLanguage = item?.OriginalLanguage ?? item switch+ {+ Episode episode => episode.Series.OriginalLanguage,+ Video video => video.GetOwner() switch+ {+ Episode ownerEpisode => ownerEpisode.OriginalLanguage ?? ownerEpisode.Series.OriginalLanguage,+ BaseItem owner => owner.OriginalLanguage,+ null => null+ },+ _ => null+ };++ SetDefaultAudioStreamIndex(source, userData, user, allowRememberingSelection, originalLanguage);SetDefaultSubtitleStreamIndex(source, userData, user, allowRememberingSelection);}else if (mediaType == MediaType.Audio)diff --git a/Emby.Server.Implementations/Localization/Core/en-US.json b/Emby.Server.Implementations/Localization/Core/en-US.jsonindex 45b1cbb6a0..9b5049c8c7 100644--- a/Emby.Server.Implementations/Localization/Core/en-US.json+++ b/Emby.Server.Implementations/Localization/Core/en-US.json@@ -64,6 +64,7 @@"NotificationOptionUserLockedOut": "User locked out","NotificationOptionVideoPlayback": "Video playback started","NotificationOptionVideoPlaybackStopped": "Video playback stopped",+ "Original": "Original","Photos": "Photos","Playlists": "Playlists","Plugin": "Plugin",diff --git a/Jellyfin.Api/Controllers/ItemUpdateController.cs b/Jellyfin.Api/Controllers/ItemUpdateController.csindex 4faec060d8..4d697ab854 100644--- a/Jellyfin.Api/Controllers/ItemUpdateController.cs+++ b/Jellyfin.Api/Controllers/ItemUpdateController.cs@@ -242,6 +242,7 @@ public class ItemUpdateController : BaseJellyfinApiControlleritem.ForcedSortName = request.ForcedSortName;item.OriginalTitle = string.IsNullOrWhiteSpace(request.OriginalTitle) ? null : request.OriginalTitle;+ item.OriginalLanguage = string.IsNullOrWhiteSpace(request.OriginalLanguage) ? null : request.OriginalLanguage;item.CriticRating = request.CriticRating;diff --git a/Jellyfin.Server.Implementations/Item/BaseItemMapper.cs b/Jellyfin.Server.Implementations/Item/BaseItemMapper.csindex 67a233c41d..736388e9eb 100644--- a/Jellyfin.Server.Implementations/Item/BaseItemMapper.cs+++ b/Jellyfin.Server.Implementations/Item/BaseItemMapper.cs@@ -68,6 +68,7 @@ internal static class BaseItemMapperdto.CriticRating = entity.CriticRating;dto.PresentationUniqueKey = entity.PresentationUniqueKey;dto.OriginalTitle = entity.OriginalTitle;+ dto.OriginalLanguage = entity.OriginalLanguage;dto.Album = entity.Album;dto.LUFS = entity.LUFS;dto.NormalizationGain = entity.NormalizationGain;@@ -243,6 +244,7 @@ internal static class BaseItemMapperentity.CriticRating = dto.CriticRating;entity.PresentationUniqueKey = dto.PresentationUniqueKey;entity.OriginalTitle = dto.OriginalTitle;+ entity.OriginalLanguage = dto.OriginalLanguage;entity.Album = dto.Album;entity.LUFS = dto.LUFS;entity.NormalizationGain = dto.NormalizationGain;diff --git a/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs b/Jellyfin.Server.Implementations/Item/MediaStreamRepository.csindex 64874ccad7..dd0446f49a 100644--- a/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs+++ b/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs@@ -123,6 +123,7 @@ public class MediaStreamRepository : IMediaStreamRepositorydto.IsDefault = entity.IsDefault;dto.IsForced = entity.IsForced;dto.IsExternal = entity.IsExternal;+ dto.IsOriginal = entity.IsOriginal;dto.Height = entity.Height;dto.Width = entity.Width;dto.AverageFrameRate = entity.AverageFrameRate;@@ -164,6 +165,11 @@ public class MediaStreamRepository : IMediaStreamRepositorydto.LocalizedLanguage = culture?.DisplayName;}+ if (dto.Type is MediaStreamType.Audio)+ {+ dto.LocalizedOriginal = _localization.GetLocalizedString("Original");+ }+if (dto.Type is MediaStreamType.Subtitle){dto.LocalizedUndefined = _localization.GetLocalizedString("Undefined");@@ -198,6 +204,7 @@ public class MediaStreamRepository : IMediaStreamRepositoryIsDefault = dto.IsDefault,IsForced = dto.IsForced,IsExternal = dto.IsExternal,+ IsOriginal = dto.IsOriginal,Height = dto.Height,Width = dto.Width,AverageFrameRate = dto.AverageFrameRate,diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex 822b21c062..4cdcaabbb1 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -216,6 +216,9 @@ namespace MediaBrowser.Controller.Entities[JsonIgnore]public string OriginalTitle { get; set; }+ [JsonIgnore]+ public string OriginalLanguage { get; set; }+/// <summary>/// Gets or sets the id./// </summary>diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.csindex a4d17e4f9d..791a7f9053 100644--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs@@ -729,6 +729,7 @@ namespace MediaBrowser.MediaEncoding.Probingstream.Type = MediaStreamType.Audio;stream.LocalizedDefault = _localization.GetLocalizedString("Default");stream.LocalizedExternal = _localization.GetLocalizedString("External");+ stream.LocalizedOriginal = _localization.GetLocalizedString("Original");stream.LocalizedLanguage = string.IsNullOrEmpty(stream.Language)? null: _localization.FindLanguageInfo(stream.Language)?.DisplayName;@@ -1031,6 +1032,11 @@ namespace MediaBrowser.MediaEncoding.Probing{stream.IsHearingImpaired = true;}++ if (disposition.GetValueOrDefault("original") == 1)+ {+ stream.IsOriginal = true;+ }}NormalizeStreamTitle(stream);diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.csindex e96bba0464..062034327e 100644--- a/MediaBrowser.Model/Dto/BaseItemDto.cs+++ b/MediaBrowser.Model/Dto/BaseItemDto.cs@@ -800,5 +800,7 @@ namespace MediaBrowser.Model.Dto/// </summary>/// <value>The current program.</value>public BaseItemDto CurrentProgram { get; set; }++ public string OriginalLanguage { get; set; }}}diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.csindex 4491fb5ace..dad4a6e149 100644--- a/MediaBrowser.Model/Entities/MediaStream.cs+++ b/MediaBrowser.Model/Entities/MediaStream.cs@@ -260,6 +260,8 @@ namespace MediaBrowser.Model.Entitiespublic string LocalizedLanguage { get; set; }+ public string LocalizedOriginal { get; set; }+public string DisplayTitle{get@@ -267,162 +269,167 @@ namespace MediaBrowser.Model.Entitiesswitch (Type){case MediaStreamType.Audio:- {- var attributes = new List<string>();-- // Do not display the language code in display titles if unset or set to a special code. Show it in all other cases (possibly expanded).- if (!string.IsNullOrEmpty(Language) && !_specialCodes.Contains(Language, StringComparison.OrdinalIgnoreCase)){- // Use pre-resolved localized language name, falling back to raw language code.- attributes.Add(StringHelper.FirstToUpper(LocalizedLanguage ?? Language));- }+ var attributes = new List<string>();- if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))- {- attributes.Add(Profile);- }- else if (!string.IsNullOrEmpty(Codec))- {- attributes.Add(AudioCodec.GetFriendlyName(Codec));- }+ // Do not display the language code in display titles if unset or set to a special code. Show it in all other cases (possibly expanded).+ if (!string.IsNullOrEmpty(Language) && !_specialCodes.Contains(Language, StringComparison.OrdinalIgnoreCase))+ {+ // Use pre-resolved localized language name, falling back to raw language code.+ attributes.Add(StringHelper.FirstToUpper(LocalizedLanguage ?? Language));+ }- if (!string.IsNullOrEmpty(ChannelLayout))- {- attributes.Add(StringHelper.FirstToUpper(ChannelLayout));- }- else if (Channels.HasValue)- {- attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch");- }+ if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))+ {+ attributes.Add(Profile);+ }+ else if (!string.IsNullOrEmpty(Codec))+ {+ attributes.Add(AudioCodec.GetFriendlyName(Codec));+ }- if (IsDefault)- {- attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);- }+ if (!string.IsNullOrEmpty(ChannelLayout))+ {+ attributes.Add(StringHelper.FirstToUpper(ChannelLayout));+ }+ else if (Channels.HasValue)+ {+ attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch");+ }- if (IsExternal)- {- attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal);- }+ if (IsDefault)+ {+ attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);+ }- if (!string.IsNullOrEmpty(Title))- {- var result = new StringBuilder(Title);- foreach (var tag in attributes)+ if (IsExternal)+ {+ attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal);+ }++ if (IsOriginal)+ {+ attributes.Add(string.IsNullOrEmpty(LocalizedOriginal) ? "Original" : LocalizedOriginal);+ }++ if (!string.IsNullOrEmpty(Title)){- // Keep Tags that are not already in Title.- if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))+ var result = new StringBuilder(Title);+ foreach (var tag in attributes){- result.Append(" - ").Append(tag);+ // Keep Tags that are not already in Title.+ if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))+ {+ result.Append(" - ").Append(tag);+ }}++ return result.ToString();}- return result.ToString();+ return string.Join(" - ", attributes);}- return string.Join(" - ", attributes);- }-case MediaStreamType.Video:- {- var attributes = new List<string>();+ {+ var attributes = new List<string>();- var resolutionText = GetResolutionText();+ var resolutionText = GetResolutionText();- if (!string.IsNullOrEmpty(resolutionText))- {- attributes.Add(resolutionText);- }+ if (!string.IsNullOrEmpty(resolutionText))+ {+ attributes.Add(resolutionText);+ }- if (!string.IsNullOrEmpty(Codec))- {- attributes.Add(Codec.ToUpperInvariant());- }+ if (!string.IsNullOrEmpty(Codec))+ {+ attributes.Add(Codec.ToUpperInvariant());+ }- if (VideoDoViTitle is not null)- {- attributes.Add(VideoDoViTitle);- }- else if (VideoRange != VideoRange.Unknown)- {- attributes.Add(VideoRange.ToString());- }+ if (VideoDoViTitle is not null)+ {+ attributes.Add(VideoDoViTitle);+ }+ else if (VideoRange != VideoRange.Unknown)+ {+ attributes.Add(VideoRange.ToString());+ }- if (!string.IsNullOrEmpty(Title))- {- var result = new StringBuilder(Title);- foreach (var tag in attributes)+ if (!string.IsNullOrEmpty(Title)){- // Keep Tags that are not already in Title.- if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))+ var result = new StringBuilder(Title);+ foreach (var tag in attributes){- result.Append(" - ").Append(tag);+ // Keep Tags that are not already in Title.+ if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))+ {+ result.Append(" - ").Append(tag);+ }}++ return result.ToString();}- return result.ToString();+ return string.Join(' ', attributes);}- return string.Join(' ', attributes);- }-case MediaStreamType.Subtitle:- {- var attributes = new List<string>();-- if (!string.IsNullOrEmpty(Language))- {- // Use pre-resolved localized language name, falling back to raw language code.- attributes.Add(StringHelper.FirstToUpper(LocalizedLanguage ?? Language));- }- else{- attributes.Add(string.IsNullOrEmpty(LocalizedUndefined) ? "Und" : LocalizedUndefined);- }+ var attributes = new List<string>();- if (IsHearingImpaired == true)- {- attributes.Add(string.IsNullOrEmpty(LocalizedHearingImpaired) ? "Hearing Impaired" : LocalizedHearingImpaired);- }+ if (!string.IsNullOrEmpty(Language))+ {+ // Use pre-resolved localized language name, falling back to raw language code.+ attributes.Add(StringHelper.FirstToUpper(LocalizedLanguage ?? Language));+ }+ else+ {+ attributes.Add(string.IsNullOrEmpty(LocalizedUndefined) ? "Und" : LocalizedUndefined);+ }- if (IsDefault)- {- attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);- }+ if (IsHearingImpaired == true)+ {+ attributes.Add(string.IsNullOrEmpty(LocalizedHearingImpaired) ? "Hearing Impaired" : LocalizedHearingImpaired);+ }- if (IsForced)- {- attributes.Add(string.IsNullOrEmpty(LocalizedForced) ? "Forced" : LocalizedForced);- }+ if (IsDefault)+ {+ attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);+ }- if (!string.IsNullOrEmpty(Codec))- {- attributes.Add(Codec.ToUpperInvariant());- }+ if (IsForced)+ {+ attributes.Add(string.IsNullOrEmpty(LocalizedForced) ? "Forced" : LocalizedForced);+ }- if (IsExternal)- {- attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal);- }+ if (!string.IsNullOrEmpty(Codec))+ {+ attributes.Add(Codec.ToUpperInvariant());+ }- if (!string.IsNullOrEmpty(Title))- {- var result = new StringBuilder(Title);- foreach (var tag in attributes)+ if (IsExternal)+ {+ attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal);+ }++ if (!string.IsNullOrEmpty(Title)){- // Keep Tags that are not already in Title.- if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))+ var result = new StringBuilder(Title);+ foreach (var tag in attributes){- result.Append(" - ").Append(tag);+ // Keep Tags that are not already in Title.+ if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))+ {+ result.Append(" - ").Append(tag);+ }}++ return result.ToString();}- return result.ToString();+ return string.Join(" - ", attributes);}- return string.Join(" - ", attributes);- }-default:return null;}@@ -499,6 +506,12 @@ namespace MediaBrowser.Model.Entities/// <value><c>true</c> if this instance is for the hearing impaired; otherwise, <c>false</c>.</value>public bool IsHearingImpaired { get; set; }+ /// <summary>+ /// Gets or sets a value indicating whether this instance is original.+ /// </summary>+ /// <value><c>true</c> if this instance is original; otherwise, <c>false</c>.</value>+ public bool IsOriginal { get; set; }+/// <summary>/// Gets or sets the height./// </summary>diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.csindex abdfb1e3b7..c2e523cfaf 100644--- a/MediaBrowser.Providers/Manager/MetadataService.cs+++ b/MediaBrowser.Providers/Manager/MetadataService.cs@@ -1023,6 +1023,11 @@ namespace MediaBrowser.Providers.Managertarget.OriginalTitle = source.OriginalTitle;}+ if (replaceData || string.IsNullOrEmpty(target.OriginalLanguage))+ {+ target.OriginalLanguage = source.OriginalLanguage;+ }+if (replaceData || !target.CommunityRating.HasValue){target.CommunityRating = source.CommunityRating;diff --git a/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.csindex 82c6e3011a..4882822766 100644--- a/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs+++ b/MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs@@ -413,6 +413,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb}item.Overview = result.Plot;+ item.OriginalLanguage = result.Language;if (!Plugin.Instance.Configuration.CastAndCrew){diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.csindex ff584ba1de..8811a1787a 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs@@ -379,6 +379,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Moviesmovie.RemoteTrailers = trailers;}+ if (!string.IsNullOrEmpty(movieResult.OriginalLanguage))+ {+ movie.OriginalLanguage = movieResult.OriginalLanguage;+ }+return metadataResult;}diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.csindex 7e36c1e204..1eb411f0f6 100644--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.cs+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.cs@@ -329,6 +329,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV}}+ if (!string.IsNullOrEmpty(seriesResult.OriginalLanguage))+ {+ series.OriginalLanguage = seriesResult.OriginalLanguage;+ }+return series;}diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.csindex 4ca3aa9ef5..ed32e6c76a 100644--- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs+++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs@@ -67,6 +67,7 @@ namespace MediaBrowser.XbmcMetadata.Savers"id","credits","originaltitle",+ "originallanguage","watched","playcount","lastplayed",@@ -376,6 +377,11 @@ namespace MediaBrowser.XbmcMetadata.Saverswriter.WriteElementString("default", stream.IsDefault.ToString(CultureInfo.InvariantCulture));writer.WriteElementString("forced", stream.IsForced.ToString(CultureInfo.InvariantCulture));+ if (stream.IsOriginal)+ {+ writer.WriteElementString("original", stream.IsOriginal.ToString(CultureInfo.InvariantCulture));+ }+if (stream.Type == MediaStreamType.Video){var runtimeTicks = item.RunTimeTicks;@@ -484,6 +490,11 @@ namespace MediaBrowser.XbmcMetadata.Saverswriter.WriteElementString("originaltitle", item.OriginalTitle);}+ if (!string.IsNullOrWhiteSpace(item.OriginalLanguage))+ {+ writer.WriteElementString("originallanguage", item.OriginalLanguage);+ }+var people = libraryManager.GetPeople(item);var directors = peoplediff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemEntity.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemEntity.csindex 76c847e5f0..6a6c8e1a6a 100644--- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemEntity.cs+++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemEntity.cs@@ -96,6 +96,8 @@ public class BaseItemEntitypublic string? OriginalTitle { get; set; }+ public string? OriginalLanguage { get; set; }+public Guid? PrimaryVersionId { get; set; }public DateTime? DateLastMediaAdded { get; set; }diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/ItemMetadata.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/ItemMetadata.csindex e5cbab7e45..3e2e0bb7ae 100644--- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/ItemMetadata.cs+++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/ItemMetadata.cs@@ -62,6 +62,16 @@ namespace Jellyfin.Database.Implementations.Entities.Libraries[StringLength(1024)]public string? OriginalTitle { get; set; }+ /// <summary>+ /// Gets or sets the original language.+ /// </summary>+ /// <remarks>+ /// Max length = 1024.+ /// </remarks>+ [MaxLength(1024)]+ [StringLength(1024)]+ public string? OriginalLanguage { get; set; }+/// <summary>/// Gets or sets the sort title./// </summary>diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/MediaStreamInfo.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/MediaStreamInfo.csindex b80b764ba3..6953f9c859 100644--- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/MediaStreamInfo.cs+++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/MediaStreamInfo.cs@@ -40,6 +40,8 @@ public class MediaStreamInfopublic bool IsExternal { get; set; }+ public bool IsOriginal { get; set; }+public int? Height { get; set; }public int? Width { get; set; }diff --git a/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20260504180809_AddOriginalLanguage.Designer.cs b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20260504180809_AddOriginalLanguage.Designer.csnew file mode 100644index 0000000000..e0f5125da1--- /dev/null+++ b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20260504180809_AddOriginalLanguage.Designer.cs@@ -0,0 +1,1802 @@+// <auto-generated />+using System;+using Jellyfin.Database.Implementations;+using Microsoft.EntityFrameworkCore;+using Microsoft.EntityFrameworkCore.Infrastructure;+using Microsoft.EntityFrameworkCore.Migrations;+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;++#nullable disable++namespace Jellyfin.Database.Providers.Sqlite.Migrations+{+ [DbContext(typeof(JellyfinDbContext))]+ [Migration("20260504180809_AddOriginalLanguage")]+ partial class AddOriginalLanguage+ {+ /// <inheritdoc />+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "10.0.7");++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AccessSchedule", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("DayOfWeek")+ .HasColumnType("INTEGER");++ b.Property<double>("EndHour")+ .HasColumnType("REAL");++ b.Property<double>("StartHour")+ .HasColumnType("REAL");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId");++ b.ToTable("AccessSchedules");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ActivityLog", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<string>("ItemId")+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<int>("LogSeverity")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<string>("Overview")+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<string>("ShortOverview")+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<string>("Type")+ .IsRequired()+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("DateCreated");++ b.ToTable("ActivityLogs");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AncestorId", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<Guid>("ParentItemId")+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "ParentItemId");++ b.HasIndex("ParentItemId");++ b.ToTable("AncestorIds");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AttachmentStreamInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("Index")+ .HasColumnType("INTEGER");++ b.Property<string>("Codec")+ .HasColumnType("TEXT");++ b.Property<string>("CodecTag")+ .HasColumnType("TEXT");++ b.Property<string>("Comment")+ .HasColumnType("TEXT");++ b.Property<string>("Filename")+ .HasColumnType("TEXT");++ b.Property<string>("MimeType")+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "Index");++ b.ToTable("AttachmentStreamInfos");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemEntity", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("Album")+ .HasColumnType("TEXT");++ b.Property<string>("AlbumArtists")+ .HasColumnType("TEXT");++ b.Property<string>("Artists")+ .HasColumnType("TEXT");++ b.Property<int?>("Audio")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("ChannelId")+ .HasColumnType("TEXT");++ b.Property<string>("CleanName")+ .HasColumnType("TEXT");++ b.Property<float?>("CommunityRating")+ .HasColumnType("REAL");++ b.Property<float?>("CriticRating")+ .HasColumnType("REAL");++ b.Property<string>("CustomRating")+ .HasColumnType("TEXT");++ b.Property<string>("Data")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastMediaAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastRefreshed")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastSaved")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateModified")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("EndDate")+ .HasColumnType("TEXT");++ b.Property<string>("EpisodeTitle")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalId")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalSeriesId")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalServiceId")+ .HasColumnType("TEXT");++ b.Property<int?>("ExtraType")+ .HasColumnType("INTEGER");++ b.Property<string>("ForcedSortName")+ .HasColumnType("TEXT");++ b.Property<string>("Genres")+ .HasColumnType("TEXT");++ b.Property<int?>("Height")+ .HasColumnType("INTEGER");++ b.Property<int?>("IndexNumber")+ .HasColumnType("INTEGER");++ b.Property<int?>("InheritedParentalRatingSubValue")+ .HasColumnType("INTEGER");++ b.Property<int?>("InheritedParentalRatingValue")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsFolder")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsInMixedFolder")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsLocked")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsMovie")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsRepeat")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsSeries")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsVirtualItem")+ .HasColumnType("INTEGER");++ b.Property<float?>("LUFS")+ .HasColumnType("REAL");++ b.Property<string>("MediaType")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<float?>("NormalizationGain")+ .HasColumnType("REAL");++ b.Property<string>("OfficialRating")+ .HasColumnType("TEXT");++ b.Property<string>("OriginalLanguage")+ .HasColumnType("TEXT");++ b.Property<string>("OriginalTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Overview")+ .HasColumnType("TEXT");++ b.Property<Guid?>("OwnerId")+ .HasColumnType("TEXT");++ b.Property<Guid?>("ParentId")+ .HasColumnType("TEXT");++ b.Property<int?>("ParentIndexNumber")+ .HasColumnType("INTEGER");++ b.Property<string>("Path")+ .HasColumnType("TEXT");++ b.Property<string>("PreferredMetadataCountryCode")+ .HasColumnType("TEXT");++ b.Property<string>("PreferredMetadataLanguage")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("PremiereDate")+ .HasColumnType("TEXT");++ b.Property<string>("PresentationUniqueKey")+ .HasColumnType("TEXT");++ b.Property<Guid?>("PrimaryVersionId")+ .HasColumnType("TEXT");++ b.Property<string>("ProductionLocations")+ .HasColumnType("TEXT");++ b.Property<int?>("ProductionYear")+ .HasColumnType("INTEGER");++ b.Property<long?>("RunTimeTicks")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("SeasonId")+ .HasColumnType("TEXT");++ b.Property<string>("SeasonName")+ .HasColumnType("TEXT");++ b.Property<Guid?>("SeriesId")+ .HasColumnType("TEXT");++ b.Property<string>("SeriesName")+ .HasColumnType("TEXT");++ b.Property<string>("SeriesPresentationUniqueKey")+ .HasColumnType("TEXT");++ b.Property<string>("ShowId")+ .HasColumnType("TEXT");++ b.Property<long?>("Size")+ .HasColumnType("INTEGER");++ b.Property<string>("SortName")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("StartDate")+ .HasColumnType("TEXT");++ b.Property<string>("Studios")+ .HasColumnType("TEXT");++ b.Property<string>("Tagline")+ .HasColumnType("TEXT");++ b.Property<string>("Tags")+ .HasColumnType("TEXT");++ b.Property<Guid?>("TopParentId")+ .HasColumnType("TEXT");++ b.Property<int?>("TotalBitrate")+ .HasColumnType("INTEGER");++ b.Property<string>("Type")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("UnratedType")+ .HasColumnType("TEXT");++ b.Property<int?>("Width")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("Name");++ b.HasIndex("OwnerId");++ b.HasIndex("ParentId");++ b.HasIndex("Path");++ b.HasIndex("PresentationUniqueKey");++ b.HasIndex("SeasonId");++ b.HasIndex("SeriesId");++ b.HasIndex("SeriesName");++ b.HasIndex("ExtraType", "OwnerId");++ b.HasIndex("TopParentId", "Id");++ b.HasIndex("Type", "CleanName");++ b.HasIndex("TopParentId", "Type", "IsVirtualItem")+ .HasFilter("\"PrimaryVersionId\" IS NULL AND (\"OwnerId\" IS NULL OR \"ExtraType\" IS NOT NULL)");++ b.HasIndex("Type", "TopParentId", "Id");++ b.HasIndex("Type", "TopParentId", "PresentationUniqueKey");++ b.HasIndex("Type", "TopParentId", "SortName");++ b.HasIndex("Type", "TopParentId", "StartDate");++ b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey");++ b.HasIndex("TopParentId", "IsFolder", "IsVirtualItem", "DateCreated");++ b.HasIndex("TopParentId", "MediaType", "IsVirtualItem", "DateCreated");++ b.HasIndex("TopParentId", "Type", "IsVirtualItem", "DateCreated");++ b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem");++ b.HasIndex("Type", "SeriesPresentationUniqueKey", "ParentIndexNumber", "IndexNumber");++ b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName");++ b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated");++ b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated");++ b.ToTable("BaseItems");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);++ b.HasData(+ new+ {+ Id = new Guid("00000000-0000-0000-0000-000000000001"),+ IsFolder = false,+ IsInMixedFolder = false,+ IsLocked = false,+ IsMovie = false,+ IsRepeat = false,+ IsSeries = false,+ IsVirtualItem = false,+ Name = "This is a placeholder item for UserData that has been detached from its original item",+ Type = "PLACEHOLDER"+ });+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemImageInfo", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<byte[]>("Blurhash")+ .HasColumnType("BLOB");++ b.Property<DateTime?>("DateModified")+ .HasColumnType("TEXT");++ b.Property<int>("Height")+ .HasColumnType("INTEGER");++ b.Property<int>("ImageType")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<int>("Width")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("ItemId", "ImageType");++ b.ToTable("BaseItemImageInfos");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemMetadataField", b =>+ {+ b.Property<int>("Id")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.HasKey("Id", "ItemId");++ b.HasIndex("ItemId");++ b.ToTable("BaseItemMetadataFields");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemProvider", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("ProviderId")+ .HasColumnType("TEXT");++ b.Property<string>("ProviderValue")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "ProviderId");++ b.HasIndex("ProviderId", "ItemId", "ProviderValue");++ b.ToTable("BaseItemProviders");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemTrailerType", b =>+ {+ b.Property<int>("Id")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.HasKey("Id", "ItemId");++ b.HasIndex("ItemId");++ b.ToTable("BaseItemTrailerTypes");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Chapter", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("ChapterIndex")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("ImageDateModified")+ .HasColumnType("TEXT");++ b.Property<string>("ImagePath")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<long>("StartPositionTicks")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "ChapterIndex");++ b.ToTable("Chapters");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.CustomItemDisplayPreferences", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("Client")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("Key")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.Property<string>("Value")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId", "ItemId", "Client", "Key")+ .IsUnique();++ b.ToTable("CustomItemDisplayPreferences");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.DisplayPreferences", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("ChromecastVersion")+ .HasColumnType("INTEGER");++ b.Property<string>("Client")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<string>("DashboardTheme")+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<bool>("EnableNextVideoInfoOverlay")+ .HasColumnType("INTEGER");++ b.Property<int?>("IndexBy")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("ScrollDirection")+ .HasColumnType("INTEGER");++ b.Property<bool>("ShowBackdrop")+ .HasColumnType("INTEGER");++ b.Property<bool>("ShowSidebar")+ .HasColumnType("INTEGER");++ b.Property<int>("SkipBackwardLength")+ .HasColumnType("INTEGER");++ b.Property<int>("SkipForwardLength")+ .HasColumnType("INTEGER");++ b.Property<string>("TvHome")+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId", "ItemId", "Client")+ .IsUnique();++ b.ToTable("DisplayPreferences");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.HomeSection", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("DisplayPreferencesId")+ .HasColumnType("INTEGER");++ b.Property<int>("Order")+ .HasColumnType("INTEGER");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("DisplayPreferencesId");++ b.ToTable("HomeSection");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ImageInfo", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .IsRequired()+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<Guid?>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId")+ .IsUnique();++ b.ToTable("ImageInfos");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemDisplayPreferences", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("Client")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<int?>("IndexBy")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<bool>("RememberIndexing")+ .HasColumnType("INTEGER");++ b.Property<bool>("RememberSorting")+ .HasColumnType("INTEGER");++ b.Property<string>("SortBy")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.Property<int>("SortOrder")+ .HasColumnType("INTEGER");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.Property<int>("ViewType")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("UserId");++ b.ToTable("ItemDisplayPreferences");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValue", b =>+ {+ b.Property<Guid>("ItemValueId")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("CleanValue")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.Property<string>("Value")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("ItemValueId");++ b.HasIndex("Type", "CleanValue");++ b.HasIndex("Type", "Value")+ .IsUnique();++ b.ToTable("ItemValues");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValueMap", b =>+ {+ b.Property<Guid>("ItemValueId")+ .HasColumnType("TEXT");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.HasKey("ItemValueId", "ItemId");++ b.HasIndex("ItemId");++ b.ToTable("ItemValuesMap");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.KeyframeData", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.PrimitiveCollection<string>("KeyframeTicks")+ .HasColumnType("TEXT");++ b.Property<long>("TotalDuration")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId");++ b.ToTable("KeyframeData");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.LinkedChildEntity", b =>+ {+ b.Property<Guid>("ParentId")+ .HasColumnType("TEXT");++ b.Property<Guid>("ChildId")+ .HasColumnType("TEXT");++ b.Property<int>("ChildType")+ .HasColumnType("INTEGER");++ b.Property<int?>("SortOrder")+ .HasColumnType("INTEGER");++ b.HasKey("ParentId", "ChildId");++ b.HasIndex("ChildId", "ChildType");++ b.HasIndex("ParentId", "ChildType");++ b.HasIndex("ParentId", "SortOrder");++ b.ToTable("LinkedChildren", (string)null);++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.MediaSegment", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<long>("EndTicks")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("SegmentProviderId")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long>("StartTicks")+ .HasColumnType("INTEGER");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.ToTable("MediaSegments");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.MediaStreamInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("StreamIndex")+ .HasColumnType("INTEGER");++ b.Property<string>("AspectRatio")+ .HasColumnType("TEXT");++ b.Property<float?>("AverageFrameRate")+ .HasColumnType("REAL");++ b.Property<int?>("BitDepth")+ .HasColumnType("INTEGER");++ b.Property<int?>("BitRate")+ .HasColumnType("INTEGER");++ b.Property<int?>("BlPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<string>("ChannelLayout")+ .HasColumnType("TEXT");++ b.Property<int?>("Channels")+ .HasColumnType("INTEGER");++ b.Property<string>("Codec")+ .HasColumnType("TEXT");++ b.Property<string>("CodecTag")+ .HasColumnType("TEXT");++ b.Property<string>("CodecTimeBase")+ .HasColumnType("TEXT");++ b.Property<string>("ColorPrimaries")+ .HasColumnType("TEXT");++ b.Property<string>("ColorSpace")+ .HasColumnType("TEXT");++ b.Property<string>("ColorTransfer")+ .HasColumnType("TEXT");++ b.Property<string>("Comment")+ .HasColumnType("TEXT");++ b.Property<int?>("DvBlSignalCompatibilityId")+ .HasColumnType("INTEGER");++ b.Property<int?>("DvLevel")+ .HasColumnType("INTEGER");++ b.Property<int?>("DvProfile")+ .HasColumnType("INTEGER");++ b.Property<int?>("DvVersionMajor")+ .HasColumnType("INTEGER");++ b.Property<int?>("DvVersionMinor")+ .HasColumnType("INTEGER");++ b.Property<int?>("ElPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<bool?>("Hdr10PlusPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<int?>("Height")+ .HasColumnType("INTEGER");++ b.Property<bool?>("IsAnamorphic")+ .HasColumnType("INTEGER");++ b.Property<bool?>("IsAvc")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsExternal")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsForced")+ .HasColumnType("INTEGER");++ b.Property<bool?>("IsHearingImpaired")+ .HasColumnType("INTEGER");++ b.Property<bool?>("IsInterlaced")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsOriginal")+ .HasColumnType("INTEGER");++ b.Property<string>("KeyFrames")+ .HasColumnType("TEXT");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<float?>("Level")+ .HasColumnType("REAL");++ b.Property<string>("NalLengthSize")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .HasColumnType("TEXT");++ b.Property<string>("PixelFormat")+ .HasColumnType("TEXT");++ b.Property<string>("Profile")+ .HasColumnType("TEXT");++ b.Property<float?>("RealFrameRate")+ .HasColumnType("REAL");++ b.Property<int?>("RefFrames")+ .HasColumnType("INTEGER");++ b.Property<int?>("Rotation")+ .HasColumnType("INTEGER");++ b.Property<int?>("RpuPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<int?>("SampleRate")+ .HasColumnType("INTEGER");++ b.Property<int>("StreamType")+ .HasColumnType("INTEGER");++ b.Property<string>("TimeBase")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.Property<int?>("Width")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "StreamIndex");++ b.ToTable("MediaStreamInfos");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.People", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("PersonType")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("Name");++ b.ToTable("Peoples");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.PeopleBaseItemMap", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<Guid>("PeopleId")+ .HasColumnType("TEXT");++ b.Property<string>("Role")+ .HasColumnType("TEXT");++ b.Property<int?>("ListOrder")+ .HasColumnType("INTEGER");++ b.Property<int?>("SortOrder")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "PeopleId", "Role");++ b.HasIndex("PeopleId");++ b.HasIndex("ItemId", "ListOrder");++ b.HasIndex("ItemId", "SortOrder");++ b.ToTable("PeopleBaseItemMap");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Permission", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("Kind")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("Permission_Permissions_Guid")+ .HasColumnType("TEXT");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<Guid?>("UserId")+ .HasColumnType("TEXT");++ b.Property<bool>("Value")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("UserId", "Kind")+ .IsUnique()+ .HasFilter("[UserId] IS NOT NULL");++ b.ToTable("Permissions");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Preference", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("Kind")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("Preference_Preferences_Guid")+ .HasColumnType("TEXT");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<Guid?>("UserId")+ .HasColumnType("TEXT");++ b.Property<string>("Value")+ .IsRequired()+ .HasMaxLength(65535)+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId", "Kind")+ .IsUnique()+ .HasFilter("[UserId] IS NOT NULL");++ b.ToTable("Preferences");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.ApiKey", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("AccessToken")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateLastActivity")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("AccessToken")+ .IsUnique();++ b.ToTable("ApiKeys");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.Device", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("AccessToken")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("AppName")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.Property<string>("AppVersion")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateLastActivity")+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateModified")+ .HasColumnType("TEXT");++ b.Property<string>("DeviceId")+ .IsRequired()+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<string>("DeviceName")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.Property<bool>("IsActive")+ .HasColumnType("INTEGER");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("AccessToken", "DateLastActivity");++ b.HasIndex("DeviceId", "DateLastActivity");++ b.HasIndex("UserId", "DeviceId");++ b.ToTable("Devices");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.DeviceOptions", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("CustomName")+ .HasColumnType("TEXT");++ b.Property<string>("DeviceId")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("DeviceId")+ .IsUnique();++ b.ToTable("DeviceOptions");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.TrickplayInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("Width")+ .HasColumnType("INTEGER");++ b.Property<int>("Bandwidth")+ .HasColumnType("INTEGER");++ b.Property<int>("Height")+ .HasColumnType("INTEGER");++ b.Property<int>("Interval")+ .HasColumnType("INTEGER");++ b.Property<int>("ThumbnailCount")+ .HasColumnType("INTEGER");++ b.Property<int>("TileHeight")+ .HasColumnType("INTEGER");++ b.Property<int>("TileWidth")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "Width");++ b.ToTable("TrickplayInfos");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.User", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("AudioLanguagePreference")+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<string>("AuthenticationProviderId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<string>("CastReceiverId")+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<bool>("DisplayCollectionsView")+ .HasColumnType("INTEGER");++ b.Property<bool>("DisplayMissingEpisodes")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableAutoLogin")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableLocalPassword")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableNextEpisodeAutoPlay")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableUserPreferenceAccess")+ .HasColumnType("INTEGER");++ b.Property<bool>("HidePlayedInLatest")+ .HasColumnType("INTEGER");++ b.Property<long>("InternalId")+ .HasColumnType("INTEGER");++ b.Property<int>("InvalidLoginAttemptCount")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("LastActivityDate")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("LastLoginDate")+ .HasColumnType("TEXT");++ b.Property<int?>("LoginAttemptsBeforeLockout")+ .HasColumnType("INTEGER");++ b.Property<int>("MaxActiveSessions")+ .HasColumnType("INTEGER");++ b.Property<int?>("MaxParentalRatingScore")+ .HasColumnType("INTEGER");++ b.Property<int?>("MaxParentalRatingSubScore")+ .HasColumnType("INTEGER");++ b.Property<bool>("MustUpdatePassword")+ .HasColumnType("INTEGER");++ b.Property<string>("Password")+ .HasMaxLength(65535)+ .HasColumnType("TEXT");++ b.Property<string>("PasswordResetProviderId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<bool>("PlayDefaultAudioTrack")+ .HasColumnType("INTEGER");++ b.Property<bool>("RememberAudioSelections")+ .HasColumnType("INTEGER");++ b.Property<bool>("RememberSubtitleSelections")+ .HasColumnType("INTEGER");++ b.Property<int?>("RemoteClientBitrateLimit")+ .HasColumnType("INTEGER");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<string>("SubtitleLanguagePreference")+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<int>("SubtitleMode")+ .HasColumnType("INTEGER");++ b.Property<int>("SyncPlayAccess")+ .HasColumnType("INTEGER");++ b.Property<string>("Username")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("Username")+ .IsUnique();++ b.ToTable("Users");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.UserData", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.Property<string>("CustomDataKey")+ .HasColumnType("TEXT");++ b.Property<int?>("AudioStreamIndex")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsFavorite")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("LastPlayedDate")+ .HasColumnType("TEXT");++ b.Property<bool?>("Likes")+ .HasColumnType("INTEGER");++ b.Property<int>("PlayCount")+ .HasColumnType("INTEGER");++ b.Property<long>("PlaybackPositionTicks")+ .HasColumnType("INTEGER");++ b.Property<bool>("Played")+ .HasColumnType("INTEGER");++ b.Property<double?>("Rating")+ .HasColumnType("REAL");++ b.Property<DateTime?>("RetentionDate")+ .HasColumnType("TEXT");++ b.Property<int?>("SubtitleStreamIndex")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "UserId", "CustomDataKey");++ b.HasIndex("ItemId", "UserId", "IsFavorite");++ b.HasIndex("ItemId", "UserId", "LastPlayedDate");++ b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks");++ b.HasIndex("ItemId", "UserId", "Played");++ b.HasIndex("UserId", "IsFavorite", "ItemId");++ b.HasIndex("UserId", "ItemId", "LastPlayedDate");++ b.HasIndex("UserId", "Played", "ItemId");++ b.ToTable("UserData");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AccessSchedule", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithMany("AccessSchedules")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AncestorId", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("Parents")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "ParentItem")+ .WithMany("Children")+ .HasForeignKey("ParentItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");++ b.Navigation("ParentItem");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AttachmentStreamInfo", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany()+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemEntity", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Owner")+ .WithMany("Extras")+ .HasForeignKey("OwnerId")+ .OnDelete(DeleteBehavior.NoAction);++ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "DirectParent")+ .WithMany("DirectChildren")+ .HasForeignKey("ParentId")+ .OnDelete(DeleteBehavior.Cascade);++ b.Navigation("DirectParent");++ b.Navigation("Owner");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemImageInfo", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("Images")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemMetadataField", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("LockedFields")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemProvider", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("Provider")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemTrailerType", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("TrailerTypes")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Chapter", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("Chapters")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.DisplayPreferences", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithMany("DisplayPreferences")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.HomeSection", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.DisplayPreferences", null)+ .WithMany("HomeSections")+ .HasForeignKey("DisplayPreferencesId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ImageInfo", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithOne("ProfileImage")+ .HasForeignKey("Jellyfin.Database.Implementations.Entities.ImageInfo", "UserId")+ .OnDelete(DeleteBehavior.Cascade);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemDisplayPreferences", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithMany("ItemDisplayPreferences")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValueMap", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("ItemValues")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("Jellyfin.Database.Implementations.Entities.ItemValue", "ItemValue")+ .WithMany("BaseItemsMap")+ .HasForeignKey("ItemValueId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");++ b.Navigation("ItemValue");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.KeyframeData", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany()+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.LinkedChildEntity", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Child")+ .WithMany("LinkedChildOfEntities")+ .HasForeignKey("ChildId")+ .OnDelete(DeleteBehavior.NoAction)+ .IsRequired();++ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Parent")+ .WithMany("LinkedChildEntities")+ .HasForeignKey("ParentId")+ .OnDelete(DeleteBehavior.NoAction)+ .IsRequired();++ b.Navigation("Child");++ b.Navigation("Parent");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.MediaStreamInfo", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("MediaStreams")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.PeopleBaseItemMap", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("Peoples")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("Jellyfin.Database.Implementations.Entities.People", "People")+ .WithMany("BaseItems")+ .HasForeignKey("PeopleId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");++ b.Navigation("People");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Permission", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithMany("Permissions")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Preference", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithMany("Preferences")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.Device", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.UserData", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("UserData")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("Jellyfin.Database.Implementations.Entities.User", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");++ b.Navigation("User");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemEntity", b =>+ {+ b.Navigation("Chapters");++ b.Navigation("Children");++ b.Navigation("DirectChildren");++ b.Navigation("Extras");++ b.Navigation("Images");++ b.Navigation("ItemValues");++ b.Navigation("LinkedChildEntities");++ b.Navigation("LinkedChildOfEntities");++ b.Navigation("LockedFields");++ b.Navigation("MediaStreams");++ b.Navigation("Parents");++ b.Navigation("Peoples");++ b.Navigation("Provider");++ b.Navigation("TrailerTypes");++ b.Navigation("UserData");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.DisplayPreferences", b =>+ {+ b.Navigation("HomeSections");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValue", b =>+ {+ b.Navigation("BaseItemsMap");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.People", b =>+ {+ b.Navigation("BaseItems");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.User", b =>+ {+ b.Navigation("AccessSchedules");++ b.Navigation("DisplayPreferences");++ b.Navigation("ItemDisplayPreferences");++ b.Navigation("Permissions");++ b.Navigation("Preferences");++ b.Navigation("ProfileImage");+ });+#pragma warning restore 612, 618+ }+ }+}diff --git a/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20260504180809_AddOriginalLanguage.cs b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20260504180809_AddOriginalLanguage.csnew file mode 100644index 0000000000..cda226309a--- /dev/null+++ b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20260504180809_AddOriginalLanguage.cs@@ -0,0 +1,47 @@+using System;+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace Jellyfin.Database.Providers.Sqlite.Migrations+{+ /// <inheritdoc />+ public partial class AddOriginalLanguage : Migration+ {+ /// <inheritdoc />+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.AddColumn<bool>(+ name: "IsOriginal",+ table: "MediaStreamInfos",+ type: "INTEGER",+ nullable: false,+ defaultValue: false);++ migrationBuilder.AddColumn<string>(+ name: "OriginalLanguage",+ table: "BaseItems",+ type: "TEXT",+ nullable: true);++ migrationBuilder.UpdateData(+ table: "BaseItems",+ keyColumn: "Id",+ keyValue: new Guid("00000000-0000-0000-0000-000000000001"),+ column: "OriginalLanguage",+ value: null);+ }++ /// <inheritdoc />+ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropColumn(+ name: "IsOriginal",+ table: "MediaStreamInfos");++ migrationBuilder.DropColumn(+ name: "OriginalLanguage",+ table: "BaseItems");+ }+ }+}diff --git a/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.cs b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.csindex 2c74d47edc..86b838d64e 100644--- a/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.cs+++ b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.cs@@ -264,6 +264,9 @@ namespace Jellyfin.Server.Implementations.Migrationsb.Property<string>("OfficialRating").HasColumnType("TEXT");+ b.Property<string>("OriginalLanguage")+ .HasColumnType("TEXT");+b.Property<string>("OriginalTitle").HasColumnType("TEXT");@@ -955,6 +958,9 @@ namespace Jellyfin.Server.Implementations.Migrationsb.Property<bool?>("IsInterlaced").HasColumnType("INTEGER");+ b.Property<bool>("IsOriginal")+ .HasColumnType("INTEGER");+b.Property<string>("KeyFrames").HasColumnType("TEXT");diff --git a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.csindex 3369af0e84..198cdaa4fc 100644--- a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs+++ b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs@@ -105,10 +105,12 @@ namespace Jellyfin.MediaEncoding.Tests.Probingvar audio1 = res.MediaStreams[1];Assert.Equal("eac3", audio1.Codec);+ Assert.True(audio1.IsOriginal);Assert.Equal(AudioSpatialFormat.DolbyAtmos, audio1.AudioSpatialFormat);var audio2 = res.MediaStreams[2];Assert.Equal("dts", audio2.Codec);+ Assert.False(audio2.IsOriginal);Assert.Equal(AudioSpatialFormat.DTSX, audio2.AudioSpatialFormat);Assert.Empty(res.Chapters);@@ -156,6 +158,7 @@ namespace Jellyfin.MediaEncoding.Tests.ProbingAssert.Equal("aac", res.MediaStreams[1].Codec);Assert.Equal(7, res.MediaStreams[1].Channels);Assert.True(res.MediaStreams[1].IsDefault);+ Assert.False(res.MediaStreams[1].IsOriginal);Assert.Equal("eng", res.MediaStreams[1].Language);Assert.Equal("Surround 6.1", res.MediaStreams[1].Title);diff --git a/tests/Jellyfin.Server.Implementations.Tests/Library/MediaSourceManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Library/MediaSourceManagerTests.csindex 8ed3d8b944..facdb2bc2e 100644--- a/tests/Jellyfin.Server.Implementations.Tests/Library/MediaSourceManagerTests.cs+++ b/tests/Jellyfin.Server.Implementations.Tests/Library/MediaSourceManagerTests.cs@@ -1,9 +1,18 @@+using System;using AutoFixture;using AutoFixture.AutoMoq;+using Castle.Components.DictionaryAdapter;using Emby.Server.Implementations.IO;using Emby.Server.Implementations.Library;+using Jellyfin.Database.Implementations.Entities;+using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Library;+using MediaBrowser.Model.Dto;+using MediaBrowser.Model.Entities;+using MediaBrowser.Model.Globalization;using MediaBrowser.Model.IO;using MediaBrowser.Model.MediaInfo;+using Moq;using Xunit;namespace Jellyfin.Server.Implementations.Tests.Library@@ -11,12 +20,28 @@ namespace Jellyfin.Server.Implementations.Tests.Librarypublic class MediaSourceManagerTests{private readonly MediaSourceManager _mediaSourceManager;+ private readonly Mock<IUserDataManager> _mockUserDataManager;+ private readonly Mock<ILocalizationManager> _mockLocalizationManager;+ private Video _item;+ private User _user;public MediaSourceManagerTests(){IFixture fixture = new Fixture().Customize(new AutoMoqCustomization { ConfigureMembers = true });fixture.Inject<IFileSystem>(fixture.Create<ManagedFileSystem>());++ _mockUserDataManager = fixture.Freeze<Mock<IUserDataManager>>();+ _mockUserDataManager.Setup(m => m.GetUserData(It.IsAny<User>(), It.IsAny<BaseItem>())).Returns(new UserItemData() { Key = "key" });++ _mockLocalizationManager = fixture.Create<Mock<ILocalizationManager>>();+ _mockLocalizationManager.Setup(m => m.FindLanguageInfo(It.IsAny<string>())).Returns((string s) => string.IsNullOrEmpty(s) ? null : new CultureDto(s, s, s, new EditableList<string> { s }));+ fixture.Inject(_mockLocalizationManager.Object);+_mediaSourceManager = fixture.Create<MediaSourceManager>();++ _item = new Video { Id = Guid.NewGuid(), OwnerId = Guid.Empty, ParentId = Guid.Empty };++ _user = fixture.Create<User>();}[Theory]@@ -28,5 +53,96 @@ namespace Jellyfin.Server.Implementations.Tests.Library[InlineData("rtsp://media.example.com:554/twister/audiotrack", MediaProtocol.Rtsp)]public void GetPathProtocol_ValidArg_Correct(string path, MediaProtocol expected)=> Assert.Equal(expected, _mediaSourceManager.GetPathProtocol(path));++ [Theory]+ [InlineData(5, "eng", "eng", false, true)]+ [InlineData(5, "eng", "eng", true, true)]+ [InlineData(2, "ger", "eng", false, true)]+ [InlineData(2, "ger", "eng", true, true)]+ [InlineData(1, "fre", "eng", false, true)]+ [InlineData(2, "fre", "eng", true, true)]+ [InlineData(5, "OriginalLanguage", "eng", false, false)]+ [InlineData(4, "OriginalLanguage", "eng", false, true)]+ [InlineData(5, "OriginalLanguage", "eng", true, false)]+ [InlineData(5, "OriginalLanguage", "eng", true, true)]+ [InlineData(2, "OriginalLanguage", "jpn", true, true)]+ [InlineData(2, "OriginalLanguage", "jpn", false, true)]+ [InlineData(2, "OriginalLanguage", "jpn,eng", false, true)]+ [InlineData(4, "OriginalLanguage", null, false, true)]+ [InlineData(2, "OriginalLanguage", null, true, true)]+ [InlineData(4, "OriginalLanguage", "", false, true)]+ [InlineData(2, "OriginalLanguage", "", false, false)]+ [InlineData(2, "OriginalLanguage", "ger", false, true)]+ [InlineData(2, "OriginalLanguage", "ger", false, false)]+ [InlineData(1, "OriginalLanguage", "fre", false, false)]+ [InlineData(2, "OriginalLanguage", "fre", true, true)]+ [InlineData(2, "OriginalLanguage", "fre", true, false)]+ public void SetDefaultAudioStreamIndex_Index_Correct(+ int expectedIndex,+ string prefferedLanguage,+ string? originalLanguage,+ bool playDefault,+ bool originalExist)+ {+ var streams = new MediaStream[]+ {+ new()+ {+ Index = 0,+ Type = MediaStreamType.Video,+ IsDefault = true+ },+ new()+ {+ Index = 1,+ Type = MediaStreamType.Audio,+ Language = "fre",+ IsDefault = false,+ IsOriginal = false+ },+ new()+ {+ Index = 2,+ Type = MediaStreamType.Audio,+ Language = "jpn",+ IsDefault = true,+ IsOriginal = false+ },+ new()+ {+ Index = 3,+ Type = MediaStreamType.Audio,+ Language = "eng",+ IsDefault = false,+ IsOriginal = false+ },+ new()+ {+ Index = 4,+ Type = MediaStreamType.Audio,+ Language = "eng",+ IsDefault = false,+ IsOriginal = originalExist,+ },+ new()+ {+ Index = 5,+ Type = MediaStreamType.Audio,+ Language = "eng",+ IsDefault = true,+ IsOriginal = false,+ }+ };+ var mediaInfo = new MediaSourceInfo+ {+ MediaStreams = streams+ };+ _user.AudioLanguagePreference = prefferedLanguage;+ _user.PlayDefaultAudioTrack = playDefault;+ _item.OriginalLanguage = originalLanguage;++ _mediaSourceManager.SetDefaultAudioAndSubtitleStreamIndices(_item, mediaInfo, _user);+ Assert.Equal(expectedIndex, mediaInfo.DefaultAudioStreamIndex);+ }}}