diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index e98bb49d6..152781aff 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -156,8 +156,6 @@ namespace MediaBrowser.Server.Implementations.Persistence "create index if not exists idx_AncestorIds2 on AncestorIds(AncestorIdText)", "create table if not exists UserDataKeys (ItemId GUID, UserDataKey TEXT Priority INT, PRIMARY KEY (ItemId, UserDataKey))", - //"create index if not exists idx_UserDataKeys1 on UserDataKeys(ItemId)", - "create index if not exists idx_UserDataKeys2 on UserDataKeys(ItemId,Priority)", "create table if not exists ItemValues (ItemId GUID, Type INT, Value TEXT, CleanValue TEXT)", //"create index if not exists idx_ItemValues on ItemValues(ItemId)", @@ -294,7 +292,10 @@ namespace MediaBrowser.Server.Implementations.Persistence "create index if not exists idx_TypeTopParentId7 on TypedBaseItems(TopParentId,MediaType,IsVirtualItem,PresentationUniqueKey)", // items by name - "create index if not exists idx_ItemValues3 on ItemValues(ItemId,Type,CleanValue)" + "create index if not exists idx_ItemValues3 on ItemValues(ItemId,Type,CleanValue)", + + //"create index if not exists idx_UserDataKeys1 on UserDataKeys(ItemId)", + "create index if not exists idx_UserDataKeys2 on UserDataKeys(ItemId,Priority)" }; _connection.RunQueries(postQueries, Logger); @@ -1712,7 +1713,7 @@ namespace MediaBrowser.Server.Implementations.Persistence return string.Empty; } - return " left join UserDataDb.UserData on (select UserDataKey from UserDataKeys where ItemId=Guid order by Priority LIMIT 1)=UserDataDb.UserData.Key"; + return " left join UserDataDb.UserData on (select UserDataKey from UserDataKeys where ItemId=Guid order by Priority LIMIT 1)=UserDataDb.UserData.Key And (UserId=@UserId)"; } private string GetGroupBy(InternalItemsQuery query) @@ -1961,11 +1962,11 @@ namespace MediaBrowser.Server.Implementations.Persistence { if (query.User != null) { - query.SortBy = new[] { "SimilarityScore", "IsPlayed", "Random" }; + query.SortBy = new[] { "SimilarityScore", ItemSortBy.IsPlayed, ItemSortBy.Random }; } else { - query.SortBy = new[] { "SimilarityScore", "Random" }; + query.SortBy = new[] { "SimilarityScore", ItemSortBy.Random }; } query.SortOrder = SortOrder.Descending; } @@ -2296,7 +2297,7 @@ namespace MediaBrowser.Server.Implementations.Persistence if (EnableJoinUserData(query)) { - whereClauses.Add("(UserId is null or UserId=@UserId)"); + //whereClauses.Add("(UserId is null or UserId=@UserId)"); } if (query.IsCurrentSchema.HasValue) { diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs index f40006b44..ced43a3e3 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteUserDataRepository.cs @@ -66,6 +66,7 @@ namespace MediaBrowser.Server.Implementations.Persistence "create index if not exists idx_userdata on userdata(key)", "create unique index if not exists userdataindex on userdata (key, userId)", + "create index if not exists userdataindex1 on userdata (key, userId)", //pragmas "pragma temp_store = memory", diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index 1130d3a11..e7e6a9dc3 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -647,7 +647,7 @@ namespace MediaBrowser.Server.Startup.Common /// Task. private async Task RegisterMediaEncoder(IProgress progress) { - var info = await new FFMpegLoader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.Environment, NativeApp.GetType().Assembly, NativeApp.GetFfmpegInstallInfo()) + var info = await new FFMpegLoader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.Environment, NativeApp.GetFfmpegInstallInfo()) .GetFFMpegInfo(NativeApp.Environment, _startupOptions, progress).ConfigureAwait(false); _hasExternalEncoder = string.Equals(info.Version, "custom", StringComparison.OrdinalIgnoreCase); diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegLoader.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegLoader.cs index fc74d1f25..2c393ff29 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegLoader.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegLoader.cs @@ -24,7 +24,6 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg private readonly IZipClient _zipClient; private readonly IFileSystem _fileSystem; private readonly NativeEnvironment _environment; - private readonly Assembly _ownerAssembly; private readonly FFMpegInstallInfo _ffmpegInstallInfo; private readonly string[] _fontUrls = @@ -32,7 +31,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/ARIALUNI.7z" }; - public FFMpegLoader(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IZipClient zipClient, IFileSystem fileSystem, NativeEnvironment environment, Assembly ownerAssembly, FFMpegInstallInfo ffmpegInstallInfo) + public FFMpegLoader(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IZipClient zipClient, IFileSystem fileSystem, NativeEnvironment environment, FFMpegInstallInfo ffmpegInstallInfo) { _logger = logger; _appPaths = appPaths; @@ -40,7 +39,6 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg _zipClient = zipClient; _fileSystem = fileSystem; _environment = environment; - _ownerAssembly = ownerAssembly; _ffmpegInstallInfo = ffmpegInstallInfo; } @@ -99,14 +97,8 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg } else { - // Older version found. - // Start with that. Download new version in the background. - var newPath = versionedDirectoryPath; - Task.Run(() => DownloadFFMpegInBackground(downloadInfo, newPath)); - info = existingVersion; versionedDirectoryPath = Path.GetDirectoryName(info.EncoderPath); - excludeFromDeletions.Add(versionedDirectoryPath); } } diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 8ea43dfb9..740f36ae0 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -134,6 +134,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest