diff options
Diffstat (limited to 'Emby.Server.Core')
| -rw-r--r-- | Emby.Server.Core/ApplicationHost.cs | 147 | ||||
| -rw-r--r-- | Emby.Server.Core/Configuration/ServerConfigurationManager.cs | 245 | ||||
| -rw-r--r-- | Emby.Server.Core/Emby.Server.Core.xproj | 1 | ||||
| -rw-r--r-- | Emby.Server.Core/EntryPoints/ExternalPortForwarding.cs | 26 | ||||
| -rw-r--r-- | Emby.Server.Core/Logging/ConsoleLogger.cs | 16 | ||||
| -rw-r--r-- | Emby.Server.Core/ServerApplicationPaths.cs | 233 | ||||
| -rw-r--r-- | Emby.Server.Core/UnhandledExceptionWriter.cs | 38 | ||||
| -rw-r--r-- | Emby.Server.Core/project.json | 6 |
8 files changed, 153 insertions, 559 deletions
diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.cs index a3c228a58..4425d1a0b 100644 --- a/Emby.Server.Core/ApplicationHost.cs +++ b/Emby.Server.Core/ApplicationHost.cs @@ -83,7 +83,6 @@ using Emby.Dlna.MediaReceiverRegistrar; using Emby.Dlna.Ssdp; using Emby.Server.Core; using Emby.Server.Implementations.Activity; -using Emby.Server.Core.Configuration; using Emby.Server.Implementations.Devices; using Emby.Server.Implementations.FFMpeg; using Emby.Server.Core.IO; @@ -91,10 +90,8 @@ using Emby.Server.Core.Localization; using Emby.Server.Implementations.Migrations; using Emby.Server.Implementations.Security; using Emby.Server.Implementations.Social; -using Emby.Server.Implementations.Sync; using Emby.Server.Implementations.Channels; using Emby.Server.Implementations.Collections; -using Emby.Server.Implementations.Connect; using Emby.Server.Implementations.Dto; using Emby.Server.Implementations.EntryPoints; using Emby.Server.Implementations.FileOrganization; @@ -111,7 +108,6 @@ using Emby.Server.Implementations; using Emby.Server.Implementations.ServerManager; using Emby.Server.Implementations.Session; using Emby.Server.Implementations.Social; -using Emby.Server.Implementations.Sync; using Emby.Server.Implementations.TV; using Emby.Server.Implementations.Updates; using MediaBrowser.Model.Activity; @@ -134,6 +130,7 @@ using Emby.Drawing; using Emby.Server.Implementations.Migrations; using MediaBrowser.Model.Diagnostics; using Emby.Common.Implementations.Diagnostics; +using Emby.Server.Implementations.Configuration; namespace Emby.Server.Core { @@ -312,7 +309,13 @@ namespace Emby.Server.Core } } - public abstract bool SupportsRunningAsService { get; } + public virtual bool SupportsRunningAsService + { + get + { + return false; + } + } /// <summary> /// Gets the name. @@ -326,14 +329,26 @@ namespace Emby.Server.Core } } - public abstract bool IsRunningAsService { get; } + public virtual bool IsRunningAsService + { + get + { + return false; + } + } private Assembly GetAssembly(Type type) { return type.GetTypeInfo().Assembly; } - public abstract bool SupportsAutoRunAtStartup { get; } + public virtual bool SupportsAutoRunAtStartup + { + get + { + return EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows; + } + } private void SetBaseExceptionMessage() { @@ -508,6 +523,9 @@ namespace Emby.Server.Core } } + protected abstract IConnectManager CreateConnectManager(); + protected abstract ISyncManager CreateSyncManager(); + /// <summary> /// Registers resources that classes will depend on /// </summary> @@ -568,9 +586,6 @@ namespace Emby.Server.Core AuthenticationRepository = await GetAuthenticationRepository().ConfigureAwait(false); RegisterSingleInstance(AuthenticationRepository); - SyncRepository = GetSyncRepository(); - RegisterSingleInstance(SyncRepository); - UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager, this, JsonSerializer, FileSystemManager, CryptographyProvider, _defaultUserNameFactory()); RegisterSingleInstance(UserManager); @@ -608,7 +623,7 @@ namespace Emby.Server.Core TVSeriesManager = new TVSeriesManager(UserManager, UserDataManager, LibraryManager, ServerConfigurationManager); RegisterSingleInstance(TVSeriesManager); - SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, () => DtoService, this, TVSeriesManager, () => MediaEncoder, FileSystemManager, () => SubtitleEncoder, ServerConfigurationManager, UserDataManager, () => MediaSourceManager, JsonSerializer, TaskManager, MemoryStreamFactory); + SyncManager = CreateSyncManager(); RegisterSingleInstance(SyncManager); DtoService = new DtoService(LogManager.GetLogger("DtoService"), LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, SyncManager, this, () => DeviceManager, () => MediaSourceManager, () => LiveTvManager); @@ -617,7 +632,7 @@ namespace Emby.Server.Core var encryptionManager = new EncryptionManager(); RegisterSingleInstance<IEncryptionManager>(encryptionManager); - ConnectManager = new ConnectManager(LogManager.GetLogger("ConnectManager"), ApplicationPaths, JsonSerializer, encryptionManager, HttpClient, this, ServerConfigurationManager, UserManager, ProviderManager, SecurityManager, FileSystemManager); + ConnectManager = CreateConnectManager(); RegisterSingleInstance(ConnectManager); DeviceManager = new DeviceManager(new DeviceRepository(ApplicationPaths, JsonSerializer, LogManager.GetLogger("DeviceManager"), FileSystemManager), UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LogManager.GetLogger("DeviceManager"), NetworkManager); @@ -716,7 +731,13 @@ namespace Emby.Server.Core await ((UserManager)UserManager).Initialize().ConfigureAwait(false); } - protected abstract bool SupportsDualModeSockets { get; } + protected virtual bool SupportsDualModeSockets + { + get + { + return true; + } + } private ICertificate GetCertificate(string certificateLocation) { @@ -761,7 +782,77 @@ namespace Emby.Server.Core return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, ImageEncoder, maxConcurrentImageProcesses, () => LibraryManager, TimerFactory); } - protected abstract FFMpegInstallInfo GetFfmpegInstallInfo(); + protected virtual FFMpegInstallInfo GetFfmpegInstallInfo() + { + var info = new FFMpegInstallInfo(); + + // Windows builds: http://ffmpeg.zeranoe.com/builds/ + // Linux builds: http://johnvansickle.com/ffmpeg/ + // OS X builds: http://ffmpegmac.net/ + // OS X x64: http://www.evermeet.cx/ffmpeg/ + + if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Linux) + { + info.FFMpegFilename = "ffmpeg"; + info.FFProbeFilename = "ffprobe"; + info.ArchiveType = "7z"; + info.Version = "20160215"; + info.DownloadUrls = GetLinuxDownloadUrls(); + } + else if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows) + { + info.FFMpegFilename = "ffmpeg.exe"; + info.FFProbeFilename = "ffprobe.exe"; + info.Version = "20160410"; + info.ArchiveType = "7z"; + info.DownloadUrls = GetWindowsDownloadUrls(); + } + else + { + // No version available - user requirement + info.DownloadUrls = new string[] { }; + } + + return info; + } + + private string[] GetWindowsDownloadUrls() + { + switch (EnvironmentInfo.SystemArchitecture) + { + case Architecture.X64: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win64.7z" + }; + case Architecture.X86: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win32.7z" + }; + } + + return new string[] { }; + } + + private string[] GetLinuxDownloadUrls() + { + switch (EnvironmentInfo.SystemArchitecture) + { + case Architecture.X64: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z" + }; + case Architecture.X86: + return new[] + { + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z" + }; + } + + return new string[] { }; + } /// <summary> /// Registers the media encoder. @@ -849,21 +940,12 @@ namespace Emby.Server.Core return repo; } - private ISyncRepository GetSyncRepository() - { - var repo = new SyncRepository(LogManager.GetLogger("SyncRepository"), JsonSerializer, ServerConfigurationManager.ApplicationPaths); - - repo.Initialize(); - - return repo; - } - /// <summary> /// Configures the repositories. /// </summary> private void ConfigureNotificationsRepository() { - var repo = new SqliteNotificationsRepository(LogManager.GetLogger("SqliteNotificationsRepository"), ServerConfigurationManager.ApplicationPaths); + var repo = new SqliteNotificationsRepository(LogManager.GetLogger("SqliteNotificationsRepository"), ServerConfigurationManager.ApplicationPaths, FileSystemManager); repo.Initialize(); @@ -1158,7 +1240,7 @@ namespace Emby.Server.Core list.Add(GetAssembly(typeof(InstallationManager))); // Emby.Server.Core - list.Add(GetAssembly(typeof(ServerApplicationPaths))); + list.Add(GetAssembly(typeof(ApplicationHost))); // MediaEncoding list.Add(GetAssembly(typeof(MediaEncoder))); @@ -1489,7 +1571,10 @@ namespace Emby.Server.Core } } - protected abstract void AuthorizeServer(); + protected virtual void AuthorizeServer() + { + throw new NotImplementedException(); + } public event EventHandler HasUpdateAvailableChanged; @@ -1565,7 +1650,10 @@ namespace Emby.Server.Core } } - protected abstract void ConfigureAutoRunInternal(bool autorun); + protected virtual void ConfigureAutoRunInternal(bool autorun) + { + throw new NotImplementedException(); + } /// <summary> /// This returns localhost in the case of no external dns, and the hostname if the @@ -1631,7 +1719,10 @@ namespace Emby.Server.Core EnableLoopbackInternal(appName); } - protected abstract void EnableLoopbackInternal(string appName); + protected virtual void EnableLoopbackInternal(string appName) + { + + } private void RegisterModules() { diff --git a/Emby.Server.Core/Configuration/ServerConfigurationManager.cs b/Emby.Server.Core/Configuration/ServerConfigurationManager.cs deleted file mode 100644 index eb3d8b9f9..000000000 --- a/Emby.Server.Core/Configuration/ServerConfigurationManager.cs +++ /dev/null @@ -1,245 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Emby.Common.Implementations.Configuration; -using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Events; -using MediaBrowser.Controller; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Serialization; - -namespace Emby.Server.Core.Configuration -{ - /// <summary> - /// Class ServerConfigurationManager - /// </summary> - public class ServerConfigurationManager : BaseConfigurationManager, IServerConfigurationManager - { - - /// <summary> - /// Initializes a new instance of the <see cref="ServerConfigurationManager" /> class. - /// </summary> - /// <param name="applicationPaths">The application paths.</param> - /// <param name="logManager">The log manager.</param> - /// <param name="xmlSerializer">The XML serializer.</param> - /// <param name="fileSystem">The file system.</param> - public ServerConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer, IFileSystem fileSystem) - : base(applicationPaths, logManager, xmlSerializer, fileSystem) - { - UpdateMetadataPath(); - } - - public event EventHandler<GenericEventArgs<ServerConfiguration>> ConfigurationUpdating; - - /// <summary> - /// Gets the type of the configuration. - /// </summary> - /// <value>The type of the configuration.</value> - protected override Type ConfigurationType - { - get { return typeof(ServerConfiguration); } - } - - /// <summary> - /// Gets the application paths. - /// </summary> - /// <value>The application paths.</value> - public IServerApplicationPaths ApplicationPaths - { - get { return (IServerApplicationPaths)CommonApplicationPaths; } - } - - /// <summary> - /// Gets the configuration. - /// </summary> - /// <value>The configuration.</value> - public ServerConfiguration Configuration - { - get { return (ServerConfiguration)CommonConfiguration; } - } - - /// <summary> - /// Called when [configuration updated]. - /// </summary> - protected override void OnConfigurationUpdated() - { - UpdateMetadataPath(); - - base.OnConfigurationUpdated(); - } - - public override void AddParts(IEnumerable<IConfigurationFactory> factories) - { - base.AddParts(factories); - - UpdateTranscodingTempPath(); - } - - /// <summary> - /// Updates the metadata path. - /// </summary> - private void UpdateMetadataPath() - { - string metadataPath; - - if (string.IsNullOrWhiteSpace(Configuration.MetadataPath)) - { - metadataPath = GetInternalMetadataPath(); - } - else - { - metadataPath = Path.Combine(Configuration.MetadataPath, "metadata"); - } - - ((ServerApplicationPaths)ApplicationPaths).InternalMetadataPath = metadataPath; - - ((ServerApplicationPaths)ApplicationPaths).ItemsByNamePath = ((ServerApplicationPaths)ApplicationPaths).InternalMetadataPath; - } - - private string GetInternalMetadataPath() - { - return Path.Combine(ApplicationPaths.ProgramDataPath, "metadata"); - } - - /// <summary> - /// Updates the transcoding temporary path. - /// </summary> - private void UpdateTranscodingTempPath() - { - var encodingConfig = this.GetConfiguration<EncodingOptions>("encoding"); - - ((ServerApplicationPaths)ApplicationPaths).TranscodingTempPath = string.IsNullOrEmpty(encodingConfig.TranscodingTempPath) ? - null : - Path.Combine(encodingConfig.TranscodingTempPath, "transcoding-temp"); - } - - protected override void OnNamedConfigurationUpdated(string key, object configuration) - { - base.OnNamedConfigurationUpdated(key, configuration); - - if (string.Equals(key, "encoding", StringComparison.OrdinalIgnoreCase)) - { - UpdateTranscodingTempPath(); - } - } - - /// <summary> - /// Replaces the configuration. - /// </summary> - /// <param name="newConfiguration">The new configuration.</param> - /// <exception cref="System.IO.DirectoryNotFoundException"></exception> - public override void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration) - { - var newConfig = (ServerConfiguration)newConfiguration; - - ValidateMetadataPath(newConfig); - ValidateSslCertificate(newConfig); - - EventHelper.FireEventIfNotNull(ConfigurationUpdating, this, new GenericEventArgs<ServerConfiguration> { Argument = newConfig }, Logger); - - base.ReplaceConfiguration(newConfiguration); - } - - - /// <summary> - /// Validates the SSL certificate. - /// </summary> - /// <param name="newConfig">The new configuration.</param> - /// <exception cref="System.IO.DirectoryNotFoundException"></exception> - private void ValidateSslCertificate(BaseApplicationConfiguration newConfig) - { - var serverConfig = (ServerConfiguration)newConfig; - - var newPath = serverConfig.CertificatePath; - - if (!string.IsNullOrWhiteSpace(newPath) - && !string.Equals(Configuration.CertificatePath ?? string.Empty, newPath)) - { - // Validate - if (!FileSystem.FileExists(newPath)) - { - throw new FileNotFoundException(string.Format("Certificate file '{0}' does not exist.", newPath)); - } - } - } - - /// <summary> - /// Validates the metadata path. - /// </summary> - /// <param name="newConfig">The new configuration.</param> - /// <exception cref="System.IO.DirectoryNotFoundException"></exception> - private void ValidateMetadataPath(ServerConfiguration newConfig) - { - var newPath = newConfig.MetadataPath; - - if (!string.IsNullOrWhiteSpace(newPath) - && !string.Equals(Configuration.MetadataPath ?? string.Empty, newPath)) - { - // Validate - if (!FileSystem.DirectoryExists(newPath)) - { - throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath)); - } - - EnsureWriteAccess(newPath); - } - } - - public void DisableMetadataService(string service) - { - DisableMetadataService(typeof(Movie), Configuration, service); - DisableMetadataService(typeof(Episode), Configuration, service); - DisableMetadataService(typeof(Series), Configuration, service); - DisableMetadataService(typeof(Season), Configuration, service); - DisableMetadataService(typeof(MusicArtist), Configuration, service); - DisableMetadataService(typeof(MusicAlbum), Configuration, service); - DisableMetadataService(typeof(MusicVideo), Configuration, service); - DisableMetadataService(typeof(Video), Configuration, service); - } - - private void DisableMetadataService(Type type, ServerConfiguration config, string service) - { - var options = GetMetadataOptions(type, config); - - if (!options.DisabledMetadataSavers.Contains(service, StringComparer.OrdinalIgnoreCase)) - { - var list = options.DisabledMetadataSavers.ToList(); - - list.Add(service); - - options.DisabledMetadataSavers = list.ToArray(); - } - } - - private MetadataOptions GetMetadataOptions(Type type, ServerConfiguration config) - { - var options = config.MetadataOptions - .FirstOrDefault(i => string.Equals(i.ItemType, type.Name, StringComparison.OrdinalIgnoreCase)); - - if (options == null) - { - var list = config.MetadataOptions.ToList(); - - options = new MetadataOptions - { - ItemType = type.Name - }; - - list.Add(options); - - config.MetadataOptions = list.ToArray(); - } - - return options; - } - } -} diff --git a/Emby.Server.Core/Emby.Server.Core.xproj b/Emby.Server.Core/Emby.Server.Core.xproj index 00f7664bd..fefaa6284 100644 --- a/Emby.Server.Core/Emby.Server.Core.xproj +++ b/Emby.Server.Core/Emby.Server.Core.xproj @@ -16,7 +16,6 @@ <SchemaVersion>2.0</SchemaVersion> </PropertyGroup> <ItemGroup> - <ProjectReference Include="..\ServiceStack\ServiceStack.csproj" /> <ProjectReference Include="..\Emby.Drawing\Emby.Drawing.csproj" /> <ProjectReference Include="..\Emby.Photos\Emby.Photos.csproj" /> <ProjectReference Include="..\MediaBrowser.Api\MediaBrowser.Api.csproj" /> diff --git a/Emby.Server.Core/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Core/EntryPoints/ExternalPortForwarding.cs index eb3a71465..2c7e6a487 100644 --- a/Emby.Server.Core/EntryPoints/ExternalPortForwarding.cs +++ b/Emby.Server.Core/EntryPoints/ExternalPortForwarding.cs @@ -187,7 +187,10 @@ namespace Emby.Server.Core.EntryPoints private void ClearCreatedRules(object state) { - _createdRules = new List<string>(); + lock (_createdRules) + { + _createdRules.Clear(); + } lock (_usnsHandled) { _usnsHandled.Clear(); @@ -236,16 +239,23 @@ namespace Emby.Server.Core.EntryPoints var address = device.LocalAddress.ToString(); - if (!_createdRules.Contains(address)) + lock (_createdRules) { - _createdRules.Add(address); - - var success = await CreatePortMap(device, _appHost.HttpPort, _config.Configuration.PublicPort).ConfigureAwait(false); - - if (success) + if (!_createdRules.Contains(address)) { - await CreatePortMap(device, _appHost.HttpsPort, _config.Configuration.PublicHttpsPort).ConfigureAwait(false); + _createdRules.Add(address); } + else + { + return; + } + } + + var success = await CreatePortMap(device, _appHost.HttpPort, _config.Configuration.PublicPort).ConfigureAwait(false); + + if (success) + { + await CreatePortMap(device, _appHost.HttpsPort, _config.Configuration.PublicHttpsPort).ConfigureAwait(false); } } diff --git a/Emby.Server.Core/Logging/ConsoleLogger.cs b/Emby.Server.Core/Logging/ConsoleLogger.cs new file mode 100644 index 000000000..01eca7b7e --- /dev/null +++ b/Emby.Server.Core/Logging/ConsoleLogger.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using MediaBrowser.Model.Logging; + +namespace Emby.Server.Core.Logging +{ + public class ConsoleLogger : IConsoleLogger + { + public void WriteLine(string message) + { + Console.WriteLine(message); + } + } +} diff --git a/Emby.Server.Core/ServerApplicationPaths.cs b/Emby.Server.Core/ServerApplicationPaths.cs deleted file mode 100644 index dc80b773c..000000000 --- a/Emby.Server.Core/ServerApplicationPaths.cs +++ /dev/null @@ -1,233 +0,0 @@ -using System.IO; -using Emby.Common.Implementations; -using MediaBrowser.Controller; - -namespace Emby.Server.Core -{ - /// <summary> - /// Extends BaseApplicationPaths to add paths that are only applicable on the server - /// </summary> - public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths - { - /// <summary> - /// Initializes a new instance of the <see cref="BaseApplicationPaths" /> class. - /// </summary> - public ServerApplicationPaths(string programDataPath, string appFolderPath, string applicationResourcesPath) - : base(programDataPath, appFolderPath) - { - ApplicationResourcesPath = applicationResourcesPath; - } - - public string ApplicationResourcesPath { get; private set; } - - /// <summary> - /// Gets the path to the base root media directory - /// </summary> - /// <value>The root folder path.</value> - public string RootFolderPath - { - get - { - return Path.Combine(ProgramDataPath, "root"); - } - } - - /// <summary> - /// Gets the path to the default user view directory. Used if no specific user view is defined. - /// </summary> - /// <value>The default user views path.</value> - public string DefaultUserViewsPath - { - get - { - return Path.Combine(RootFolderPath, "default"); - } - } - - /// <summary> - /// Gets the path to localization data. - /// </summary> - /// <value>The localization path.</value> - public string LocalizationPath - { - get - { - return Path.Combine(ProgramDataPath, "localization"); - } - } - - /// <summary> - /// The _ibn path - /// </summary> - private string _ibnPath; - /// <summary> - /// Gets the path to the Images By Name directory - /// </summary> - /// <value>The images by name path.</value> - public string ItemsByNamePath - { - get - { - return _ibnPath ?? (_ibnPath = Path.Combine(ProgramDataPath, "ImagesByName")); - } - set - { - _ibnPath = value; - } - } - - /// <summary> - /// Gets the path to the People directory - /// </summary> - /// <value>The people path.</value> - public string PeoplePath - { - get - { - return Path.Combine(ItemsByNamePath, "People"); - } - } - - public string ArtistsPath - { - get - { - return Path.Combine(ItemsByNamePath, "artists"); - } - } - - /// <summary> - /// Gets the path to the Genre directory - /// </summary> - /// <value>The genre path.</value> - public string GenrePath - { - get - { - return Path.Combine(ItemsByNamePath, "Genre"); - } - } - - /// <summary> - /// Gets the path to the Genre directory - /// </summary> - /// <value>The genre path.</value> - public string MusicGenrePath - { - get - { - return Path.Combine(ItemsByNamePath, "MusicGenre"); - } - } - - /// <summary> - /// Gets the path to the Studio directory - /// </summary> - /// <value>The studio path.</value> - public string StudioPath - { - get - { - return Path.Combine(ItemsByNamePath, "Studio"); - } - } - - /// <summary> - /// Gets the path to the Year directory - /// </summary> - /// <value>The year path.</value> - public string YearPath - { - get - { - return Path.Combine(ItemsByNamePath, "Year"); - } - } - - /// <summary> - /// Gets the path to the General IBN directory - /// </summary> - /// <value>The general path.</value> - public string GeneralPath - { - get - { - return Path.Combine(ItemsByNamePath, "general"); - } - } - - /// <summary> - /// Gets the path to the Ratings IBN directory - /// </summary> - /// <value>The ratings path.</value> - public string RatingsPath - { - get - { - return Path.Combine(ItemsByNamePath, "ratings"); - } - } - - /// <summary> - /// Gets the media info images path. - /// </summary> - /// <value>The media info images path.</value> - public string MediaInfoImagesPath - { - get - { - return Path.Combine(ItemsByNamePath, "mediainfo"); - } - } - - /// <summary> - /// Gets the path to the user configuration directory - /// </summary> - /// <value>The user configuration directory path.</value> - public string UserConfigurationDirectoryPath - { - get - { - return Path.Combine(ConfigurationDirectoryPath, "users"); - } - } - - private string _transcodingTempPath; - public string TranscodingTempPath - { - get - { - return _transcodingTempPath ?? (_transcodingTempPath = Path.Combine(ProgramDataPath, "transcoding-temp")); - } - set - { - _transcodingTempPath = value; - } - } - - /// <summary> - /// Gets the game genre path. - /// </summary> - /// <value>The game genre path.</value> - public string GameGenrePath - { - get - { - return Path.Combine(ItemsByNamePath, "GameGenre"); - } - } - - private string _internalMetadataPath; - public string InternalMetadataPath - { - get - { - return _internalMetadataPath ?? (_internalMetadataPath = Path.Combine(DataPath, "metadata")); - } - set - { - _internalMetadataPath = value; - } - } - } -} diff --git a/Emby.Server.Core/UnhandledExceptionWriter.cs b/Emby.Server.Core/UnhandledExceptionWriter.cs deleted file mode 100644 index 5147be9e7..000000000 --- a/Emby.Server.Core/UnhandledExceptionWriter.cs +++ /dev/null @@ -1,38 +0,0 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Model.Logging; -using System; -using System.IO; - -namespace Emby.Server.Core -{ - public class UnhandledExceptionWriter - { - private readonly IApplicationPaths _appPaths; - private readonly ILogger _logger; - private readonly ILogManager _logManager; - - public UnhandledExceptionWriter(IApplicationPaths appPaths, ILogger logger, ILogManager logManager) - { - _appPaths = appPaths; - _logger = logger; - _logManager = logManager; - } - - public void Log(Exception ex) - { - _logger.ErrorException("UnhandledException", ex); - _logManager.Flush(); - - var path = Path.Combine(_appPaths.LogDirectoryPath, "unhandled_" + Guid.NewGuid() + ".txt"); - Directory.CreateDirectory(Path.GetDirectoryName(path)); - - var builder = LogHelper.GetLogMessage(ex); - - // Write to console just in case file logging fails - Console.WriteLine("UnhandledException"); - Console.WriteLine(builder.ToString()); - - File.WriteAllText(path, builder.ToString()); - } - } -} diff --git a/Emby.Server.Core/project.json b/Emby.Server.Core/project.json index e987da6aa..70543d7df 100644 --- a/Emby.Server.Core/project.json +++ b/Emby.Server.Core/project.json @@ -56,9 +56,6 @@ "Emby.Drawing": { "target": "project" }, - "ServiceStack": { - "target": "project" - }, "SocketHttpListener.Portable": { "target": "project" } @@ -121,9 +118,6 @@ }, "SocketHttpListener.Portable": { "target": "project" - }, - "ServiceStack": { - "target": "project" } } } |
