Explorar o código

fix live tv folders being created in a loop

Luke Pulverenti %!s(int64=8) %!d(string=hai) anos
pai
achega
0b5d4ce3f8

+ 18 - 0
Emby.Common.Implementations/IO/ManagedFileSystem.cs

@@ -499,6 +499,24 @@ namespace Emby.Common.Implementations.IO
             CopyFile(temp1, file2, true);
         }
 
+        public bool AreEqual(string path1, string path2)
+        {
+            if (path1 == null && path2 == null)
+            {
+                return true;
+            }
+
+            if (path1 == null || path2 == null)
+            {
+                return false;
+            }
+
+            path1 = path1.TrimEnd(DirectorySeparatorChar);
+            path2 = path2.TrimEnd(DirectorySeparatorChar);
+
+            return string.Equals(path1, path2, StringComparison.OrdinalIgnoreCase);
+        }
+
         public bool ContainsSubPath(string parentPath, string path)
         {
             if (string.IsNullOrEmpty(parentPath))

+ 1 - 1
Emby.Server.Core/IO/LibraryMonitor.cs

@@ -87,7 +87,7 @@ namespace Emby.Server.Core.IO
         public bool IsPathLocked(string path)
         {
             var lockedPaths = _tempIgnoredPaths.Keys.ToList();
-            return lockedPaths.Any(i => string.Equals(i, path, StringComparison.OrdinalIgnoreCase) || _fileSystem.ContainsSubPath(i, path));
+            return lockedPaths.Any(i => _fileSystem.AreEqual(i, path) || _fileSystem.ContainsSubPath(i, path));
         }
 
         public async void ReportFileSystemChangeComplete(string path, bool refreshPath)

+ 5 - 1
Emby.Server.Implementations/Connect/ConnectManager.cs

@@ -925,7 +925,11 @@ namespace Emby.Server.Implementations.Connect
             }
 
             _data.PendingAuthorizations = newPendingList;
-            CacheData();
+
+            if (!newPendingList.Select(i => i.Id).SequenceEqual(currentPendingList.Select(i => i.Id), StringComparer.Ordinal))
+            {
+                CacheData();
+            }
 
             await RefreshGuestNames(list, refreshImages).ConfigureAwait(false);
         }

+ 1 - 4
Emby.Server.Implementations/Dto/DtoService.cs

@@ -361,10 +361,7 @@ namespace Emby.Server.Implementations.Dto
             if (collectionFolder != null)
             {
                 dto.OriginalCollectionType = collectionFolder.CollectionType;
-
-                dto.CollectionType = user == null ?
-                    collectionFolder.CollectionType :
-                    collectionFolder.GetViewType(user);
+                dto.CollectionType = collectionFolder.CollectionType;
             }
 
             if (fields.Contains(ItemFields.CanDelete))

+ 2 - 2
Emby.Server.Implementations/Library/LibraryManager.cs

@@ -2010,7 +2010,7 @@ namespace Emby.Server.Implementations.Library
 
         private string GetContentTypeOverride(string path, bool inherit)
         {
-            var nameValuePair = ConfigurationManager.Configuration.ContentTypes.FirstOrDefault(i => string.Equals(i.Name, path, StringComparison.OrdinalIgnoreCase) || (inherit && !string.IsNullOrWhiteSpace(i.Name) && _fileSystem.ContainsSubPath(i.Name, path)));
+            var nameValuePair = ConfigurationManager.Configuration.ContentTypes.FirstOrDefault(i => _fileSystem.AreEqual(i.Name, path) || (inherit && !string.IsNullOrWhiteSpace(i.Name) && _fileSystem.ContainsSubPath(i.Name, path)));
             if (nameValuePair != null)
             {
                 return nameValuePair.Value;
@@ -3066,7 +3066,7 @@ namespace Emby.Server.Implementations.Library
                 {
                     removeList.Add(contentType);
                 }
-                else if (string.Equals(path, contentType.Name, StringComparison.OrdinalIgnoreCase)
+                else if (_fileSystem.AreEqual(path, contentType.Name)
                     || _fileSystem.ContainsSubPath(path, contentType.Name))
                 {
                     removeList.Add(contentType);

+ 0 - 8
Emby.Server.Implementations/Library/UserViewManager.cs

@@ -55,8 +55,6 @@ namespace Emby.Server.Implementations.Library
                 }).ToList();
             }
 
-            var plainFolderIds = user.Configuration.PlainFolderViews.Select(i => new Guid(i)).ToList();
-
             var groupedFolders = new List<ICollectionFolder>();
 
             var list = new List<Folder>();
@@ -72,12 +70,6 @@ namespace Emby.Server.Implementations.Library
                     continue;
                 }
 
-                if (plainFolderIds.Contains(folder.Id) && UserView.IsEligibleForEnhancedView(folderViewType))
-                {
-                    list.Add(folder);
-                    continue;
-                }
-
                 if (collectionFolder != null && UserView.IsEligibleForGrouping(folder) && user.IsFolderGrouped(folder.Id))
                 {
                     groupedFolders.Add(collectionFolder);

+ 1 - 1
Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs

@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             foreach (var recordingFolder in recordingFolders)
             {
                 var pathsToCreate = recordingFolder.Locations
-                    .Where(i => !allExistingPaths.Contains(i, StringComparer.OrdinalIgnoreCase))
+                    .Where(i => !allExistingPaths.Any(p => _fileSystem.AreEqual(p, i)))
                     .ToList();
 
                 if (pathsToCreate.Count == 0)

+ 3 - 1
Emby.Server.Implementations/UserViews/DynamicImageProvider.cs

@@ -151,7 +151,9 @@ namespace Emby.Server.Implementations.UserViews
             string[] collectionStripViewTypes =
             {
                 CollectionType.Movies,
-                CollectionType.TvShows
+                CollectionType.TvShows,
+                CollectionType.Playlists,
+                CollectionType.Photos
             };
 
             return collectionStripViewTypes.Contains(view.ViewType ?? string.Empty);

+ 1 - 1
MediaBrowser.Controller/Entities/Folder.cs

@@ -647,7 +647,7 @@ namespace MediaBrowser.Controller.Entities
 
         private static bool ContainsPath(string parent, string path)
         {
-            return string.Equals(parent, path, StringComparison.OrdinalIgnoreCase) || FileSystem.ContainsSubPath(parent, path);
+            return FileSystem.AreEqual(parent, path) || FileSystem.ContainsSubPath(parent, path);
         }
 
         /// <summary>

+ 0 - 13
MediaBrowser.Controller/Entities/ICollectionFolder.cs

@@ -20,17 +20,4 @@ namespace MediaBrowser.Controller.Entities
     {
         bool EnableUserSpecificView { get; }
     }
-
-    public static class CollectionFolderExtensions
-    {
-        public static string GetViewType(this ICollectionFolder folder, User user)
-        {
-            if (user.Configuration.PlainFolderViews.Contains(folder.Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
-            {
-                return null;
-            }
-
-            return folder.CollectionType;
-        }
-    }
 }

+ 0 - 3
MediaBrowser.Model/Configuration/UserConfiguration.cs

@@ -37,7 +37,6 @@ namespace MediaBrowser.Model.Configuration
         public string[] OrderedViews { get; set; }
 
         public string[] LatestItemsExcludes { get; set; }
-        public string[] PlainFolderViews { get; set; }
 
         public bool HidePlayedInLatest { get; set; }
 
@@ -61,8 +60,6 @@ namespace MediaBrowser.Model.Configuration
             LatestItemsExcludes = new string[] { };
             OrderedViews = new string[] { };
 
-            PlainFolderViews = new string[] { };
-
             GroupedFolders = new string[] { };
         }
     }

+ 2 - 0
MediaBrowser.Model/IO/IFileSystem.cs

@@ -120,6 +120,8 @@ namespace MediaBrowser.Model.IO
         /// <param name="file2">The file2.</param>
         void SwapFiles(string file1, string file2);
 
+        bool AreEqual(string path1, string path2);
+
         /// <summary>
         /// Determines whether [contains sub path] [the specified parent path].
         /// </summary>