The Free Software Media System - Server Backend & API
continue jquery removal
Luke Pulverenti8c7f39913bac
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.csindex bb9fcc9241..6339fb7b15 100644--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs@@ -471,30 +471,16 @@ namespace MediaBrowser.Server.Implementations.Dto{var folder = (Folder)item;- if (fields.Contains(ItemFields.SyncInfo))- {- var userData = _userDataRepository.GetUserData(user, item);-- // Skip the user data manager because we've already looped through the recursive tree and don't want to do it twice- // TODO: Improve in future- dto.UserData = GetUserItemDataDto(userData);+ // Skip the user data manager because we've already looped through the recursive tree and don't want to do it twice+ // TODO: Improve in future+ dto.UserData = GetUserItemDataDto(_userDataRepository.GetUserData(user, item));- if (item.SourceType == SourceType.Library && folder.SupportsUserDataFromChildren)- {- SetSpecialCounts(folder, user, dto, fields, syncProgress);- }+ if (item.SourceType == SourceType.Library && folder.SupportsUserDataFromChildren)+ {+ SetSpecialCounts(folder, user, dto, fields, syncProgress);dto.UserData.Played = dto.UserData.PlayedPercentage.HasValue && dto.UserData.PlayedPercentage.Value >= 100;}- else if (item.SourceType == SourceType.Library)- {- dto.UserData = _userDataRepository.GetUserDataDto(item, user);- }- else- {- var userData = _userDataRepository.GetUserData(user, item);- dto.UserData = GetUserItemDataDto(userData);- }if (item.SourceType == SourceType.Library){@@ -549,6 +535,13 @@ namespace MediaBrowser.Server.Implementations.Dtoprivate int GetChildCount(Folder folder, User user){+ // Right now this is too slow to calculate for top level folders on a per-user basis+ // Just return something so that apps that are expecting a value won't think the folders are empty+ if (folder is ICollectionFolder || folder is UserView)+ {+ return new Random().Next(1, 10);+ }+return folder.GetChildCount(user);}diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.csindex 878fcbe0cd..e8b39a1fe3 100644--- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs+++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs@@ -1735,6 +1735,8 @@ namespace MediaBrowser.Server.Implementations.Persistencevar now = DateTime.UtcNow;+ var list = new List<BaseItem>();+using (var cmd = _connection.CreateCommand()){cmd.CommandText = "select " + string.Join(",", GetFinalColumnsToSelect(query, _retriveItemColumns, cmd)) + GetFromText();@@ -1778,11 +1780,13 @@ namespace MediaBrowser.Server.Implementations.Persistencevar item = GetItem(reader);if (item != null){- yield return item;+ list.Add(item);}}}}++ return list;}private void LogQueryTime(string methodName, IDbCommand cmd, DateTime startDate)diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.csindex 3a3b10188a..fb4fb86ffd 100644--- a/MediaBrowser.ServerApplication/MainStartup.cs+++ b/MediaBrowser.ServerApplication/MainStartup.cs@@ -259,9 +259,6 @@ namespace MediaBrowser.ServerApplicationtask = InstallVcredist2013IfNeeded(_appHost, _logger);Task.WaitAll(task);- task = InstallFrameworkV46IfNeeded(_logger);- Task.WaitAll(task);-SystemEvents.SessionEnding += SystemEvents_SessionEnding;SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;@@ -594,93 +591,6 @@ namespace MediaBrowser.ServerApplication}}- private static async Task InstallFrameworkV46IfNeeded(ILogger logger)- {- bool installFrameworkV46 = false;-- try- {- using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)- .OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\"))- {- if (ndpKey != null && ndpKey.GetValue("Release") != null)- {- if ((int)ndpKey.GetValue("Release") <= 393295)- {- //Found framework V4, but not yet V4.6- installFrameworkV46 = true;- }- }- else- {- //Nothing found in the registry for V4- installFrameworkV46 = true;- }- }- }- catch (Exception ex)- {- logger.ErrorException("Error getting .NET Framework version", ex);- }-- _logger.Info(".NET Framework 4.6 found: {0}", !installFrameworkV46);-- if (installFrameworkV46)- {- try- {- await InstallFrameworkV46().ConfigureAwait(false);- }- catch (Exception ex)- {- logger.ErrorException("Error installing .NET Framework version 4.6", ex);- }- }- }-- private static async Task InstallFrameworkV46()- {- var httpClient = _appHost.HttpClient;-- var tmp = await httpClient.GetTempFile(new HttpRequestOptions- {- Url = "https://github.com/MediaBrowser/Emby.Resources/raw/master/netframeworkV46/NDP46-KB3045560-Web.exe",- Progress = new Progress<double>()-- }).ConfigureAwait(false);-- var exePath = Path.ChangeExtension(tmp, ".exe");- File.Copy(tmp, exePath);-- var startInfo = new ProcessStartInfo- {- FileName = exePath,-- CreateNoWindow = true,- WindowStyle = ProcessWindowStyle.Hidden,- Verb = "runas",- ErrorDialog = false,- Arguments = "/q /norestart"- };--- _logger.Info("Running {0}", startInfo.FileName);-- using (var process = Process.Start(startInfo))- {- process.WaitForExit();- //process.ExitCode- /*- 0 --> Installation completed successfully.- 1602 --> The user canceled installation.- 1603 --> A fatal error occurred during installation.- 1641 --> A restart is required to complete the installation. This message indicates success.- 3010 --> A restart is required to complete the installation. This message indicates success.- 5100 --> The user's computer does not meet system requirements.- */- }- }-private static async Task InstallVcredist2013IfNeeded(ApplicationHost appHost, ILogger logger){try