update network share settings

This commit is contained in:
Luke Pulverenti 2016-09-24 13:58:17 -04:00
parent fdc2826709
commit 48d7f686eb
9 changed files with 55 additions and 39 deletions

View File

@ -148,12 +148,6 @@ namespace MediaBrowser.Api
{ {
var user = _userManager.Users.First(); var user = _userManager.Users.First();
// TODO: This should be handled internally by xbmc metadata
const string metadataKey = "xbmcmetadata";
var metadata = _config.GetConfiguration<XbmcMetadataOptions>(metadataKey);
metadata.UserId = user.Id.ToString("N");
_config.SaveConfiguration(metadataKey, metadata);
user.Name = request.Name; user.Name = request.Name;
await _userManager.UpdateUser(user).ConfigureAwait(false); await _userManager.UpdateUser(user).ConfigureAwait(false);

View File

@ -318,7 +318,6 @@
<Compile Include="Providers\SongInfo.cs" /> <Compile Include="Providers\SongInfo.cs" />
<Compile Include="Providers\TrailerInfo.cs" /> <Compile Include="Providers\TrailerInfo.cs" />
<Compile Include="Providers\VideoContentType.cs" /> <Compile Include="Providers\VideoContentType.cs" />
<Compile Include="RelatedMedia\IRelatedMediaProvider.cs" />
<Compile Include="Security\AuthenticationInfo.cs" /> <Compile Include="Security\AuthenticationInfo.cs" />
<Compile Include="Security\AuthenticationInfoQuery.cs" /> <Compile Include="Security\AuthenticationInfoQuery.cs" />
<Compile Include="Security\IAuthenticationRepository.cs" /> <Compile Include="Security\IAuthenticationRepository.cs" />

View File

@ -1,11 +0,0 @@
namespace MediaBrowser.Controller.RelatedMedia
{
public interface IRelatedMediaProvider
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; }
}
}

View File

@ -474,7 +474,7 @@ namespace MediaBrowser.Dlna.PlayTo
if (_disposed) if (_disposed)
return; return;
_logger.ErrorException("Error updating device info for {0}", ex, Properties.Name); //_logger.ErrorException("Error updating device info for {0}", ex, Properties.Name);
_successiveStopCount++; _successiveStopCount++;
_connectFailureCount++; _connectFailureCount++;

View File

@ -2829,6 +2829,16 @@ namespace MediaBrowser.Server.Implementations.Library
throw new DirectoryNotFoundException("The path does not exist."); 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 rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName); var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);
@ -2850,6 +2860,8 @@ namespace MediaBrowser.Server.Implementations.Library
{ {
var libraryOptions = CollectionFolder.GetLibraryOptions(virtualFolderPath); var libraryOptions = CollectionFolder.GetLibraryOptions(virtualFolderPath);
SyncLibraryOptionsToLocations(virtualFolderPath, libraryOptions);
var list = libraryOptions.PathInfos.ToList(); var list = libraryOptions.PathInfos.ToList();
list.Add(pathInfo); list.Add(pathInfo);
libraryOptions.PathInfos = list.ToArray(); libraryOptions.PathInfos = list.ToArray();
@ -2865,11 +2877,18 @@ namespace MediaBrowser.Server.Implementations.Library
throw new ArgumentNullException("path"); 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 rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName); var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);
var libraryOptions = CollectionFolder.GetLibraryOptions(virtualFolderPath); var libraryOptions = CollectionFolder.GetLibraryOptions(virtualFolderPath);
SyncLibraryOptionsToLocations(virtualFolderPath, libraryOptions);
var list = libraryOptions.PathInfos.ToList(); var list = libraryOptions.PathInfos.ToList();
foreach (var originalPathInfo in list) foreach (var originalPathInfo in list)
{ {
@ -2879,11 +2898,36 @@ namespace MediaBrowser.Server.Implementations.Library
break; break;
} }
} }
libraryOptions.PathInfos = list.ToArray(); libraryOptions.PathInfos = list.ToArray();
CollectionFolder.SaveLibraryOptions(virtualFolderPath, libraryOptions); 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) public void RemoveVirtualFolder(string name, bool refreshLibrary)
{ {
if (string.IsNullOrWhiteSpace(name)) if (string.IsNullOrWhiteSpace(name))

View File

@ -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); return _security.GetRegistrationStatus(feature);
} }

View File

@ -294,11 +294,9 @@ namespace MediaBrowser.Server.Implementations.Session
var key = GetSessionKey(session.Client, session.DeviceId); var key = GetSessionKey(session.Client, session.DeviceId);
SessionInfo removed; SessionInfo removed;
_activeConnections.TryRemove(key, out removed);
if (_activeConnections.TryRemove(key, out removed)) OnSessionEnded(session);
{
OnSessionEnded(removed);
}
} }
} }
finally finally

View File

@ -8,7 +8,7 @@
</nlog> </nlog>
<appSettings> <appSettings>
<add key="DebugProgramDataPath" value="ProgramData-Server"/> <add key="DebugProgramDataPath" value="ProgramData-Server"/>
<add key="ReleaseProgramDataPath" value="ProgramData-Server"/> <add key="ReleaseProgramDataPath" value="%ApplicationData%/emby"/>
</appSettings> </appSettings>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

View File

@ -18,10 +18,16 @@ namespace MediaBrowser.Server.Startup.Common
useDebugPath = true; useDebugPath = true;
#endif #endif
var programDataPath = useDebugPath ? ConfigurationManager.AppSettings["DebugProgramDataPath"] : ConfigurationManager.AppSettings["ReleaseProgramDataPath"]; var programDataPath = useDebugPath ?
ConfigurationManager.AppSettings["DebugProgramDataPath"] :
ConfigurationManager.AppSettings["ReleaseProgramDataPath"];
programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
programDataPath = programDataPath
.Replace('/', Path.DirectorySeparatorChar)
.Replace('\\', Path.DirectorySeparatorChar);
// If it's a relative path, e.g. "..\" // If it's a relative path, e.g. "..\"
if (!Path.IsPathRooted(programDataPath)) if (!Path.IsPathRooted(programDataPath))
{ {