Kaynağa Gözat

Merge pull request #1746 from MediaBrowser/dev

Dev
Luke 9 yıl önce
ebeveyn
işleme
8023ae615b

+ 1 - 8
MediaBrowser.Controller/Entities/User.cs

@@ -305,14 +305,7 @@ namespace MediaBrowser.Controller.Entities
 
         public bool IsFolderGrouped(Guid id)
         {
-            var config = Configuration;
-
-            if (config.ExcludeFoldersFromGrouping != null)
-            {
-                return !config.ExcludeFoldersFromGrouping.Select(i => new Guid(i)).Contains(id);
-            }
-
-            return config.GroupedFolders.Select(i => new Guid(i)).Contains(id);
+            return Configuration.GroupedFolders.Select(i => new Guid(i)).Contains(id);
         }
 
         [IgnoreDataMember]

+ 11 - 7
MediaBrowser.Model/Entities/MediaStream.cs

@@ -1,8 +1,8 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
 using MediaBrowser.Model.Dlna;
 using MediaBrowser.Model.Extensions;
 using System.Diagnostics;
+using MediaBrowser.Model.MediaInfo;
 
 namespace MediaBrowser.Model.Entities
 {
@@ -53,18 +53,22 @@ namespace MediaBrowser.Model.Entities
 
                     if (!string.IsNullOrEmpty(Language))
                     {
-                        attributes.Add(Language);
+                        attributes.Add(StringHelper.FirstToUpper(Language));
                     }
                     if (!string.IsNullOrEmpty(Codec) && !StringHelper.EqualsIgnoreCase(Codec, "dca"))
                     {
-                        attributes.Add(Codec);
-                    }
-                    if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc"))
+                        attributes.Add(AudioCodec.GetFriendlyName(Codec));
+                    } 
+                    else if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc"))
                     {
                         attributes.Add(Profile);
                     }
 
-                    if (Channels.HasValue)
+                    if (!string.IsNullOrEmpty(ChannelLayout))
+                    {
+                        attributes.Add(ChannelLayout);
+                    }
+                    else if (Channels.HasValue)
                     {
                         attributes.Add(StringHelper.ToStringCultureInvariant(Channels.Value) + " ch");
                     }

+ 5 - 0
MediaBrowser.Model/Extensions/StringHelper.cs

@@ -125,5 +125,10 @@ namespace MediaBrowser.Model.Extensions
 
             return sb.ToString();
         }
+
+        public static string FirstToUpper(this string str)
+        {
+            return string.IsNullOrEmpty(str) ? "" : str.Substring(0, 1).ToUpper() + str.Substring(1);
+        }
     }
 }

+ 17 - 0
MediaBrowser.Model/MediaInfo/AudioCodec.cs

@@ -5,5 +5,22 @@
         public const string AAC = "aac";
         public const string MP3 = "mp3";
         public const string AC3 = "ac3";
+
+        public static string GetFriendlyName(string codec)
+        {
+            if (string.IsNullOrEmpty(codec)) return "";
+
+            switch (codec.ToLower())
+            {
+                case "ac3":
+                    return "Dolby Digital";
+                case "eac3":
+                    return "Dolby Digital+";
+                case "dca":
+                    return "DTS";
+                default:
+                    return codec.ToUpper();
+            }
+        }
     }
 }

+ 1 - 1
MediaBrowser.Server.Implementations/Library/LibraryManager.cs

@@ -1452,7 +1452,7 @@ namespace MediaBrowser.Server.Implementations.Library
                         .GetChildren(user, true)
                         .OfType<CollectionFolder>()
                         .Where(i => string.IsNullOrWhiteSpace(i.CollectionType) || string.Equals(i.CollectionType, view.ViewType, StringComparison.OrdinalIgnoreCase))
-                        .Where(i => user.Configuration.GroupedFolders.Contains(i.Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
+                        .Where(i => user.IsFolderGrouped(i.Id))
                         .SelectMany(i => GetTopParentsForQuery(i, user));
                 }
                 return new BaseItem[] { };