|
@@ -170,7 +170,15 @@ namespace Emby.Server.Implementations.Data
|
|
|
"CodecTimeBase",
|
|
|
"ColorPrimaries",
|
|
|
"ColorSpace",
|
|
|
- "ColorTransfer"
|
|
|
+ "ColorTransfer",
|
|
|
+ "DvVersionMajor",
|
|
|
+ "DvVersionMinor",
|
|
|
+ "DvProfile",
|
|
|
+ "DvLevel",
|
|
|
+ "RpuPresentFlag",
|
|
|
+ "ElPresentFlag",
|
|
|
+ "BlPresentFlag",
|
|
|
+ "DvBlSignalCompatibilityId"
|
|
|
};
|
|
|
|
|
|
private static readonly string _mediaStreamSaveColumnsInsertQuery =
|
|
@@ -341,7 +349,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
public void Initialize(SqliteUserDataRepository userDataRepo, IUserManager userManager)
|
|
|
{
|
|
|
const string CreateMediaStreamsTableCommand
|
|
|
- = "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, ColorPrimaries TEXT NULL, ColorSpace TEXT NULL, ColorTransfer TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
|
|
|
+ = "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, ColorPrimaries TEXT NULL, ColorSpace TEXT NULL, ColorTransfer TEXT NULL, DvVersionMajor INT NULL, DvVersionMinor INT NULL, DvProfile INT NULL, DvLevel INT NULL, RpuPresentFlag INT NULL, ElPresentFlag INT NULL, BlPresentFlag INT NULL, DvBlSignalCompatibilityId INT NULL, PRIMARY KEY (ItemId, StreamIndex))";
|
|
|
const string CreateMediaAttachmentsTableCommand
|
|
|
= "create table if not exists mediaattachments (ItemId GUID, AttachmentIndex INT, Codec TEXT, CodecTag TEXT NULL, Comment TEXT NULL, Filename TEXT NULL, MIMEType TEXT NULL, PRIMARY KEY (ItemId, AttachmentIndex))";
|
|
|
|
|
@@ -555,6 +563,15 @@ namespace Emby.Server.Implementations.Data
|
|
|
AddColumn(db, "MediaStreams", "ColorPrimaries", "TEXT", existingColumnNames);
|
|
|
AddColumn(db, "MediaStreams", "ColorSpace", "TEXT", existingColumnNames);
|
|
|
AddColumn(db, "MediaStreams", "ColorTransfer", "TEXT", existingColumnNames);
|
|
|
+
|
|
|
+ AddColumn(db, "MediaStreams", "DvVersionMajor", "INT", existingColumnNames);
|
|
|
+ AddColumn(db, "MediaStreams", "DvVersionMinor", "INT", existingColumnNames);
|
|
|
+ AddColumn(db, "MediaStreams", "DvProfile", "INT", existingColumnNames);
|
|
|
+ AddColumn(db, "MediaStreams", "DvLevel", "INT", existingColumnNames);
|
|
|
+ AddColumn(db, "MediaStreams", "RpuPresentFlag", "INT", existingColumnNames);
|
|
|
+ AddColumn(db, "MediaStreams", "ElPresentFlag", "INT", existingColumnNames);
|
|
|
+ AddColumn(db, "MediaStreams", "BlPresentFlag", "INT", existingColumnNames);
|
|
|
+ AddColumn(db, "MediaStreams", "DvBlSignalCompatibilityId", "INT", existingColumnNames);
|
|
|
},
|
|
|
TransactionMode);
|
|
|
|
|
@@ -2403,7 +2420,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
}
|
|
|
|
|
|
// genres, tags, studios, person, year?
|
|
|
- builder.Append("+ (Select count(1) * 10 from ItemValues where ItemId=Guid and CleanValue in (select CleanValue from itemvalues where ItemId=@SimilarItemId))");
|
|
|
+ builder.Append("+ (Select count(1) * 10 from ItemValues where ItemId=Guid and CleanValue in (select CleanValue from ItemValues where ItemId=@SimilarItemId))");
|
|
|
|
|
|
if (item is MusicArtist)
|
|
|
{
|
|
@@ -3058,12 +3075,12 @@ namespace Emby.Server.Implementations.Data
|
|
|
|
|
|
if (string.Equals(name, ItemSortBy.Artist, StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
|
- return "(select CleanValue from itemvalues where ItemId=Guid and Type=0 LIMIT 1)";
|
|
|
+ return "(select CleanValue from ItemValues where ItemId=Guid and Type=0 LIMIT 1)";
|
|
|
}
|
|
|
|
|
|
if (string.Equals(name, ItemSortBy.AlbumArtist, StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
|
- return "(select CleanValue from itemvalues where ItemId=Guid and Type=1 LIMIT 1)";
|
|
|
+ return "(select CleanValue from ItemValues where ItemId=Guid and Type=1 LIMIT 1)";
|
|
|
}
|
|
|
|
|
|
if (string.Equals(name, ItemSortBy.OfficialRating, StringComparison.OrdinalIgnoreCase))
|
|
@@ -3073,7 +3090,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
|
|
|
if (string.Equals(name, ItemSortBy.Studio, StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
|
- return "(select CleanValue from itemvalues where ItemId=Guid and Type=3 LIMIT 1)";
|
|
|
+ return "(select CleanValue from ItemValues where ItemId=Guid and Type=3 LIMIT 1)";
|
|
|
}
|
|
|
|
|
|
if (string.Equals(name, ItemSortBy.SeriesDatePlayed, StringComparison.OrdinalIgnoreCase))
|
|
@@ -3146,6 +3163,11 @@ namespace Emby.Server.Implementations.Data
|
|
|
return ItemSortBy.IndexNumber;
|
|
|
}
|
|
|
|
|
|
+ if (string.Equals(name, ItemSortBy.SimilarityScore, StringComparison.OrdinalIgnoreCase))
|
|
|
+ {
|
|
|
+ return ItemSortBy.SimilarityScore;
|
|
|
+ }
|
|
|
+
|
|
|
// Unknown SortBy, just sort by the SortName.
|
|
|
return ItemSortBy.SortName;
|
|
|
}
|
|
@@ -3846,7 +3868,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
{
|
|
|
var paramName = "@ArtistIds" + index;
|
|
|
|
|
|
- clauses.Add("(guid in (select itemid from itemvalues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type<=1))");
|
|
|
+ clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type<=1))");
|
|
|
if (statement != null)
|
|
|
{
|
|
|
statement.TryBind(paramName, artistId);
|
|
@@ -3867,7 +3889,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
{
|
|
|
var paramName = "@ArtistIds" + index;
|
|
|
|
|
|
- clauses.Add("(guid in (select itemid from itemvalues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=1))");
|
|
|
+ clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=1))");
|
|
|
if (statement != null)
|
|
|
{
|
|
|
statement.TryBind(paramName, artistId);
|
|
@@ -3888,7 +3910,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
{
|
|
|
var paramName = "@ArtistIds" + index;
|
|
|
|
|
|
- clauses.Add("((select CleanName from TypedBaseItems where guid=" + paramName + ") in (select CleanValue from itemvalues where ItemId=Guid and Type=0) AND (select CleanName from TypedBaseItems where guid=" + paramName + ") not in (select CleanValue from itemvalues where ItemId=Guid and Type=1))");
|
|
|
+ clauses.Add("((select CleanName from TypedBaseItems where guid=" + paramName + ") in (select CleanValue from ItemValues where ItemId=Guid and Type=0) AND (select CleanName from TypedBaseItems where guid=" + paramName + ") not in (select CleanValue from ItemValues where ItemId=Guid and Type=1))");
|
|
|
if (statement != null)
|
|
|
{
|
|
|
statement.TryBind(paramName, artistId);
|
|
@@ -3930,7 +3952,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
{
|
|
|
var paramName = "@ExcludeArtistId" + index;
|
|
|
|
|
|
- clauses.Add("(guid not in (select itemid from itemvalues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type<=1))");
|
|
|
+ clauses.Add("(guid not in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type<=1))");
|
|
|
if (statement != null)
|
|
|
{
|
|
|
statement.TryBind(paramName, artistId);
|
|
@@ -3951,7 +3973,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
{
|
|
|
var paramName = "@GenreId" + index;
|
|
|
|
|
|
- clauses.Add("(guid in (select itemid from itemvalues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=2))");
|
|
|
+ clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=2))");
|
|
|
if (statement != null)
|
|
|
{
|
|
|
statement.TryBind(paramName, genreId);
|
|
@@ -3970,7 +3992,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
var index = 0;
|
|
|
foreach (var item in query.Genres)
|
|
|
{
|
|
|
- clauses.Add("@Genre" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type=2)");
|
|
|
+ clauses.Add("@Genre" + index + " in (select CleanValue from ItemValues where ItemId=Guid and Type=2)");
|
|
|
if (statement != null)
|
|
|
{
|
|
|
statement.TryBind("@Genre" + index, GetCleanValue(item));
|
|
@@ -3989,7 +4011,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
var index = 0;
|
|
|
foreach (var item in tags)
|
|
|
{
|
|
|
- clauses.Add("@Tag" + index + " in (select CleanValue from itemvalues where ItemId=Guid and Type=4)");
|
|
|
+ clauses.Add("@Tag" + index + " in (select CleanValue from ItemValues where ItemId=Guid and Type=4)");
|
|
|
if (statement != null)
|
|
|
{
|
|
|
statement.TryBind("@Tag" + index, GetCleanValue(item));
|
|
@@ -4008,7 +4030,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
var index = 0;
|
|
|
foreach (var item in excludeTags)
|
|
|
{
|
|
|
- clauses.Add("@ExcludeTag" + index + " not in (select CleanValue from itemvalues where ItemId=Guid and Type=4)");
|
|
|
+ clauses.Add("@ExcludeTag" + index + " not in (select CleanValue from ItemValues where ItemId=Guid and Type=4)");
|
|
|
if (statement != null)
|
|
|
{
|
|
|
statement.TryBind("@ExcludeTag" + index, GetCleanValue(item));
|
|
@@ -4029,7 +4051,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
{
|
|
|
var paramName = "@StudioId" + index;
|
|
|
|
|
|
- clauses.Add("(guid in (select itemid from itemvalues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=3))");
|
|
|
+ clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=3))");
|
|
|
|
|
|
if (statement != null)
|
|
|
{
|
|
@@ -4508,7 +4530,7 @@ namespace Emby.Server.Implementations.Data
|
|
|
{
|
|
|
int index = 0;
|
|
|
string excludedTags = string.Join(',', query.ExcludeInheritedTags.Select(_ => paramName + index++));
|
|
|
- whereClauses.Add("((select CleanValue from itemvalues where ItemId=Guid and Type=6 and cleanvalue in (" + excludedTags + ")) is null)");
|
|
|
+ whereClauses.Add("((select CleanValue from ItemValues where ItemId=Guid and Type=6 and cleanvalue in (" + excludedTags + ")) is null)");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -4743,11 +4765,11 @@ namespace Emby.Server.Implementations.Data
|
|
|
';',
|
|
|
new string[]
|
|
|
{
|
|
|
- "delete from itemvalues where type = 6",
|
|
|
+ "delete from ItemValues where type = 6",
|
|
|
|
|
|
- "insert into itemvalues (ItemId, Type, Value, CleanValue) select ItemId, 6, Value, CleanValue from ItemValues where Type=4",
|
|
|
+ "insert into ItemValues (ItemId, Type, Value, CleanValue) select ItemId, 6, Value, CleanValue from ItemValues where Type=4",
|
|
|
|
|
|
- @"insert into itemvalues (ItemId, Type, Value, CleanValue) select AncestorIds.itemid, 6, ItemValues.Value, ItemValues.CleanValue
|
|
|
+ @"insert into ItemValues (ItemId, Type, Value, CleanValue) select AncestorIds.itemid, 6, ItemValues.Value, ItemValues.CleanValue
|
|
|
FROM AncestorIds
|
|
|
LEFT JOIN ItemValues ON (AncestorIds.AncestorId = ItemValues.ItemId)
|
|
|
where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type = 4 "
|
|
@@ -4912,6 +4934,7 @@ SELECT key FROM UserDatas WHERE isFavorite=@IsFavorite AND userId=@UserId)
|
|
|
AND Type = @InternalPersonType)");
|
|
|
statement?.TryBind("@IsFavorite", query.IsFavorite.Value);
|
|
|
statement?.TryBind("@InternalPersonType", typeof(Person).FullName);
|
|
|
+ statement?.TryBind("@UserId", query.User.InternalId);
|
|
|
}
|
|
|
|
|
|
if (!query.ItemId.Equals(default))
|
|
@@ -4966,11 +4989,6 @@ AND Type = @InternalPersonType)");
|
|
|
statement?.TryBind("@NameContains", "%" + query.NameContains + "%");
|
|
|
}
|
|
|
|
|
|
- if (query.User != null)
|
|
|
- {
|
|
|
- statement?.TryBind("@UserId", query.User.InternalId);
|
|
|
- }
|
|
|
-
|
|
|
return whereClauses;
|
|
|
}
|
|
|
|
|
@@ -5854,6 +5872,15 @@ AND Type = @InternalPersonType)");
|
|
|
statement.TryBind("@ColorPrimaries" + index, stream.ColorPrimaries);
|
|
|
statement.TryBind("@ColorSpace" + index, stream.ColorSpace);
|
|
|
statement.TryBind("@ColorTransfer" + index, stream.ColorTransfer);
|
|
|
+
|
|
|
+ statement.TryBind("@DvVersionMajor" + index, stream.DvVersionMajor);
|
|
|
+ statement.TryBind("@DvVersionMinor" + index, stream.DvVersionMinor);
|
|
|
+ statement.TryBind("@DvProfile" + index, stream.DvProfile);
|
|
|
+ statement.TryBind("@DvLevel" + index, stream.DvLevel);
|
|
|
+ statement.TryBind("@RpuPresentFlag" + index, stream.RpuPresentFlag);
|
|
|
+ statement.TryBind("@ElPresentFlag" + index, stream.ElPresentFlag);
|
|
|
+ statement.TryBind("@BlPresentFlag" + index, stream.BlPresentFlag);
|
|
|
+ statement.TryBind("@DvBlSignalCompatibilityId" + index, stream.DvBlSignalCompatibilityId);
|
|
|
}
|
|
|
|
|
|
statement.Reset();
|
|
@@ -6025,6 +6052,46 @@ AND Type = @InternalPersonType)");
|
|
|
item.ColorTransfer = colorTransfer;
|
|
|
}
|
|
|
|
|
|
+ if (reader.TryGetInt32(35, out var dvVersionMajor))
|
|
|
+ {
|
|
|
+ item.DvVersionMajor = dvVersionMajor;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (reader.TryGetInt32(36, out var dvVersionMinor))
|
|
|
+ {
|
|
|
+ item.DvVersionMinor = dvVersionMinor;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (reader.TryGetInt32(37, out var dvProfile))
|
|
|
+ {
|
|
|
+ item.DvProfile = dvProfile;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (reader.TryGetInt32(38, out var dvLevel))
|
|
|
+ {
|
|
|
+ item.DvLevel = dvLevel;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (reader.TryGetInt32(39, out var rpuPresentFlag))
|
|
|
+ {
|
|
|
+ item.RpuPresentFlag = rpuPresentFlag;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (reader.TryGetInt32(40, out var elPresentFlag))
|
|
|
+ {
|
|
|
+ item.ElPresentFlag = elPresentFlag;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (reader.TryGetInt32(41, out var blPresentFlag))
|
|
|
+ {
|
|
|
+ item.BlPresentFlag = blPresentFlag;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (reader.TryGetInt32(42, out var dvBlSignalCompatibilityId))
|
|
|
+ {
|
|
|
+ item.DvBlSignalCompatibilityId = dvBlSignalCompatibilityId;
|
|
|
+ }
|
|
|
+
|
|
|
if (item.Type == MediaStreamType.Subtitle)
|
|
|
{
|
|
|
item.LocalizedUndefined = _localization.GetLocalizedString("Undefined");
|