mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 01:54:42 +01:00
update network share settings
This commit is contained in:
@@ -2829,6 +2829,16 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
throw new DirectoryNotFoundException("The path does not exist.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(pathInfo.NetworkPath) && !_fileSystem.DirectoryExists(pathInfo.NetworkPath))
|
||||
{
|
||||
throw new DirectoryNotFoundException("The network path does not exist.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(pathInfo.NetworkPath) && !_fileSystem.DirectoryExists(pathInfo.NetworkPath))
|
||||
{
|
||||
throw new DirectoryNotFoundException("The network path does not exist.");
|
||||
}
|
||||
|
||||
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||
var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);
|
||||
|
||||
@@ -2850,6 +2860,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
{
|
||||
var libraryOptions = CollectionFolder.GetLibraryOptions(virtualFolderPath);
|
||||
|
||||
SyncLibraryOptionsToLocations(virtualFolderPath, libraryOptions);
|
||||
|
||||
var list = libraryOptions.PathInfos.ToList();
|
||||
list.Add(pathInfo);
|
||||
libraryOptions.PathInfos = list.ToArray();
|
||||
@@ -2865,11 +2877,18 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(pathInfo.NetworkPath) && !_fileSystem.DirectoryExists(pathInfo.NetworkPath))
|
||||
{
|
||||
throw new DirectoryNotFoundException("The network path does not exist.");
|
||||
}
|
||||
|
||||
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||
var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);
|
||||
|
||||
var libraryOptions = CollectionFolder.GetLibraryOptions(virtualFolderPath);
|
||||
|
||||
SyncLibraryOptionsToLocations(virtualFolderPath, libraryOptions);
|
||||
|
||||
var list = libraryOptions.PathInfos.ToList();
|
||||
foreach (var originalPathInfo in list)
|
||||
{
|
||||
@@ -2879,11 +2898,36 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
libraryOptions.PathInfos = list.ToArray();
|
||||
|
||||
CollectionFolder.SaveLibraryOptions(virtualFolderPath, libraryOptions);
|
||||
}
|
||||
|
||||
private void SyncLibraryOptionsToLocations(string virtualFolderPath, LibraryOptions options)
|
||||
{
|
||||
var topLibraryFolders = GetUserRootFolder().Children.ToList();
|
||||
var info = GetVirtualFolderInfo(virtualFolderPath, topLibraryFolders);
|
||||
|
||||
if (info.Locations.Count > 0 && info.Locations.Count != options.PathInfos.Length)
|
||||
{
|
||||
var list = options.PathInfos.ToList();
|
||||
|
||||
foreach (var location in info.Locations)
|
||||
{
|
||||
if (!list.Any(i => string.Equals(i.Path, location, StringComparison.Ordinal)))
|
||||
{
|
||||
list.Add(new MediaPathInfo
|
||||
{
|
||||
Path = location
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
options.PathInfos = list.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveVirtualFolder(string name, bool refreshLibrary)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
|
||||
@@ -2855,20 +2855,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
}
|
||||
}
|
||||
|
||||
if (string.Equals(feature, "dvr", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var config = GetConfiguration();
|
||||
if (config.TunerHosts.Count(i => i.IsEnabled) > 0 &&
|
||||
config.ListingProviders.Count(i => (i.EnableAllTuners || i.EnabledTuners.Length > 0) && string.Equals(i.Type, SchedulesDirect.TypeName, StringComparison.OrdinalIgnoreCase)) > 0)
|
||||
{
|
||||
return Task.FromResult(new MBRegistrationRecord
|
||||
{
|
||||
IsRegistered = true,
|
||||
IsValid = true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return _security.GetRegistrationStatus(feature);
|
||||
}
|
||||
|
||||
|
||||
@@ -294,11 +294,9 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||
var key = GetSessionKey(session.Client, session.DeviceId);
|
||||
|
||||
SessionInfo removed;
|
||||
_activeConnections.TryRemove(key, out removed);
|
||||
|
||||
if (_activeConnections.TryRemove(key, out removed))
|
||||
{
|
||||
OnSessionEnded(removed);
|
||||
}
|
||||
OnSessionEnded(session);
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in New Issue
Block a user