瀏覽代碼

continue jquery removal

Luke Pulverenti 9 年之前
父節點
當前提交
8c7f39913b

+ 13 - 20
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.Dto
 
         private 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);
         }
 

+ 5 - 1
MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs

@@ -1735,6 +1735,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
 
             var 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.Persistence
                         var item = GetItem(reader);
                         if (item != null)
                         {
-                            yield return item;
+                            list.Add(item);
                         }
                     }
                 }
             }
+
+            return list;
         }
 
         private void LogQueryTime(string methodName, IDbCommand cmd, DateTime startDate)

+ 0 - 90
MediaBrowser.ServerApplication/MainStartup.cs

@@ -259,9 +259,6 @@ namespace MediaBrowser.ServerApplication
                 task = 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