Răsfoiți Sursa

don't try to get non-cached children when offline

Luke Pulverenti 12 ani în urmă
părinte
comite
deeb85f296

+ 9 - 1
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -314,7 +314,15 @@ namespace MediaBrowser.Controller.Entities
                 isDirectory = true;
                 isDirectory = true;
             }
             }
 
 
-            pathInfo = pathInfo ?? (isDirectory ? new DirectoryInfo(path) : FileSystem.GetFileSystemInfo(path));
+            try
+            {
+                pathInfo = pathInfo ?? (isDirectory ? new DirectoryInfo(path) : FileSystem.GetFileSystemInfo(path));
+            }
+            catch (IOException)
+            {
+                IsOffline = true;
+                throw;
+            }
 
 
             if (pathInfo == null || !pathInfo.Exists)
             if (pathInfo == null || !pathInfo.Exists)
             {
             {

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

@@ -646,7 +646,7 @@ namespace MediaBrowser.Controller.Entities
             cancellationToken.ThrowIfCancellationRequested();
             cancellationToken.ThrowIfCancellationRequested();
 
 
             //get the current valid children from filesystem (or wherever)
             //get the current valid children from filesystem (or wherever)
-            var nonCachedChildren = GetNonCachedChildren();
+            var nonCachedChildren = IsOffline ? new BaseItem[] { } : GetNonCachedChildren();
 
 
             if (nonCachedChildren == null) return; //nothing to validate
             if (nonCachedChildren == null) return; //nothing to validate
 
 
@@ -722,6 +722,8 @@ namespace MediaBrowser.Controller.Entities
                     else
                     else
                     {
                     {
                         item.IsOffline = true;
                         item.IsOffline = true;
+
+                        validChildren.Add(new Tuple<BaseItem, bool>(item, false));
                     }
                     }
                 }
                 }