From 5d55b36487b25b2efaf6923a3c069f4b0b59a449 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 20 Feb 2017 15:50:58 -0500 Subject: make more classes portable --- .../ServerApplicationPaths.cs | 234 +++++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 Emby.Server.Implementations/ServerApplicationPaths.cs (limited to 'Emby.Server.Implementations/ServerApplicationPaths.cs') diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs new file mode 100644 index 000000000..b4b2bb139 --- /dev/null +++ b/Emby.Server.Implementations/ServerApplicationPaths.cs @@ -0,0 +1,234 @@ +using System; +using System.IO; +using Emby.Server.Implementations.AppBase; +using MediaBrowser.Controller; + +namespace Emby.Server.Implementations +{ + /// + /// Extends BaseApplicationPaths to add paths that are only applicable on the server + /// + public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths + { + /// + /// Initializes a new instance of the class. + /// + public ServerApplicationPaths(string programDataPath, string appFolderPath, string applicationResourcesPath, Action createDirectoryFn) + : base(programDataPath, appFolderPath, createDirectoryFn) + { + ApplicationResourcesPath = applicationResourcesPath; + } + + public string ApplicationResourcesPath { get; private set; } + + /// + /// Gets the path to the base root media directory + /// + /// The root folder path. + public string RootFolderPath + { + get + { + return Path.Combine(ProgramDataPath, "root"); + } + } + + /// + /// Gets the path to the default user view directory. Used if no specific user view is defined. + /// + /// The default user views path. + public string DefaultUserViewsPath + { + get + { + return Path.Combine(RootFolderPath, "default"); + } + } + + /// + /// Gets the path to localization data. + /// + /// The localization path. + public string LocalizationPath + { + get + { + return Path.Combine(ProgramDataPath, "localization"); + } + } + + /// + /// The _ibn path + /// + private string _ibnPath; + /// + /// Gets the path to the Images By Name directory + /// + /// The images by name path. + public string ItemsByNamePath + { + get + { + return _ibnPath ?? (_ibnPath = Path.Combine(ProgramDataPath, "ImagesByName")); + } + set + { + _ibnPath = value; + } + } + + /// + /// Gets the path to the People directory + /// + /// The people path. + public string PeoplePath + { + get + { + return Path.Combine(ItemsByNamePath, "People"); + } + } + + public string ArtistsPath + { + get + { + return Path.Combine(ItemsByNamePath, "artists"); + } + } + + /// + /// Gets the path to the Genre directory + /// + /// The genre path. + public string GenrePath + { + get + { + return Path.Combine(ItemsByNamePath, "Genre"); + } + } + + /// + /// Gets the path to the Genre directory + /// + /// The genre path. + public string MusicGenrePath + { + get + { + return Path.Combine(ItemsByNamePath, "MusicGenre"); + } + } + + /// + /// Gets the path to the Studio directory + /// + /// The studio path. + public string StudioPath + { + get + { + return Path.Combine(ItemsByNamePath, "Studio"); + } + } + + /// + /// Gets the path to the Year directory + /// + /// The year path. + public string YearPath + { + get + { + return Path.Combine(ItemsByNamePath, "Year"); + } + } + + /// + /// Gets the path to the General IBN directory + /// + /// The general path. + public string GeneralPath + { + get + { + return Path.Combine(ItemsByNamePath, "general"); + } + } + + /// + /// Gets the path to the Ratings IBN directory + /// + /// The ratings path. + public string RatingsPath + { + get + { + return Path.Combine(ItemsByNamePath, "ratings"); + } + } + + /// + /// Gets the media info images path. + /// + /// The media info images path. + public string MediaInfoImagesPath + { + get + { + return Path.Combine(ItemsByNamePath, "mediainfo"); + } + } + + /// + /// Gets the path to the user configuration directory + /// + /// The user configuration directory path. + 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; + } + } + + /// + /// Gets the game genre path. + /// + /// The game genre path. + 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; + } + } + } +} -- cgit v1.2.3