using MediaBrowser.Common.Implementations;
using MediaBrowser.Controller;
using System.IO;
namespace MediaBrowser.Server.Implementations
{
///
/// Extends BaseApplicationPaths to add paths that are only applicable on the server
///
public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths
{
#if (DEBUG)
///
/// Initializes a new instance of the class.
///
public ServerApplicationPaths()
: base(true)
{
}
#else
public ServerApplicationPaths()
: base(false)
{
}
#endif
///
/// The _root folder path
///
private string _rootFolderPath;
///
/// Gets the path to the base root media directory
///
/// The root folder path.
public string RootFolderPath
{
get
{
if (_rootFolderPath == null)
{
_rootFolderPath = Path.Combine(ProgramDataPath, "Root");
if (!Directory.Exists(_rootFolderPath))
{
Directory.CreateDirectory(_rootFolderPath);
}
}
return _rootFolderPath;
}
}
///
/// The _default user views path
///
private string _defaultUserViewsPath;
///
/// 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
{
if (_defaultUserViewsPath == null)
{
_defaultUserViewsPath = Path.Combine(RootFolderPath, "Default");
if (!Directory.Exists(_defaultUserViewsPath))
{
Directory.CreateDirectory(_defaultUserViewsPath);
}
}
return _defaultUserViewsPath;
}
}
///
/// The _localization path
///
private string _localizationPath;
///
/// Gets the path to localization data.
///
/// The localization path.
public string LocalizationPath
{
get
{
if (_localizationPath == null)
{
_localizationPath = Path.Combine(ProgramDataPath, "Localization");
if (!Directory.Exists(_localizationPath))
{
Directory.CreateDirectory(_localizationPath);
}
}
return _localizationPath;
}
}
///
/// The _ibn path
///
private string _ibnPath;
///
/// Gets the path to the Images By Name directory
///
/// The images by name path.
public string ImagesByNamePath
{
get
{
if (_ibnPath == null)
{
_ibnPath = Path.Combine(ProgramDataPath, "ImagesByName");
if (!Directory.Exists(_ibnPath))
{
Directory.CreateDirectory(_ibnPath);
}
}
return _ibnPath;
}
}
///
/// The _people path
///
private string _peoplePath;
///
/// Gets the path to the People directory
///
/// The people path.
public string PeoplePath
{
get
{
if (_peoplePath == null)
{
_peoplePath = Path.Combine(ImagesByNamePath, "People");
if (!Directory.Exists(_peoplePath))
{
Directory.CreateDirectory(_peoplePath);
}
}
return _peoplePath;
}
}
///
/// The _genre path
///
private string _genrePath;
///
/// Gets the path to the Genre directory
///
/// The genre path.
public string GenrePath
{
get
{
if (_genrePath == null)
{
_genrePath = Path.Combine(ImagesByNamePath, "Genre");
if (!Directory.Exists(_genrePath))
{
Directory.CreateDirectory(_genrePath);
}
}
return _genrePath;
}
}
///
/// The _studio path
///
private string _studioPath;
///
/// Gets the path to the Studio directory
///
/// The studio path.
public string StudioPath
{
get
{
if (_studioPath == null)
{
_studioPath = Path.Combine(ImagesByNamePath, "Studio");
if (!Directory.Exists(_studioPath))
{
Directory.CreateDirectory(_studioPath);
}
}
return _studioPath;
}
}
///
/// The _year path
///
private string _yearPath;
///
/// Gets the path to the Year directory
///
/// The year path.
public string YearPath
{
get
{
if (_yearPath == null)
{
_yearPath = Path.Combine(ImagesByNamePath, "Year");
if (!Directory.Exists(_yearPath))
{
Directory.CreateDirectory(_yearPath);
}
}
return _yearPath;
}
}
///
/// The _general path
///
private string _generalPath;
///
/// Gets the path to the General IBN directory
///
/// The general path.
public string GeneralPath
{
get
{
if (_generalPath == null)
{
_generalPath = Path.Combine(ImagesByNamePath, "General");
if (!Directory.Exists(_generalPath))
{
Directory.CreateDirectory(_generalPath);
}
}
return _generalPath;
}
}
///
/// The _ratings path
///
private string _ratingsPath;
///
/// Gets the path to the Ratings IBN directory
///
/// The ratings path.
public string RatingsPath
{
get
{
if (_ratingsPath == null)
{
_ratingsPath = Path.Combine(ImagesByNamePath, "Ratings");
if (!Directory.Exists(_ratingsPath))
{
Directory.CreateDirectory(_ratingsPath);
}
}
return _ratingsPath;
}
}
///
/// The _user configuration directory path
///
private string _userConfigurationDirectoryPath;
///
/// Gets the path to the user configuration directory
///
/// The user configuration directory path.
public string UserConfigurationDirectoryPath
{
get
{
if (_userConfigurationDirectoryPath == null)
{
_userConfigurationDirectoryPath = Path.Combine(ConfigurationDirectoryPath, "users");
if (!Directory.Exists(_userConfigurationDirectoryPath))
{
Directory.CreateDirectory(_userConfigurationDirectoryPath);
}
}
return _userConfigurationDirectoryPath;
}
}
///
/// The _f F MPEG stream cache path
///
private string _fFMpegStreamCachePath;
///
/// Gets the FF MPEG stream cache path.
///
/// The FF MPEG stream cache path.
public string FFMpegStreamCachePath
{
get
{
if (_fFMpegStreamCachePath == null)
{
_fFMpegStreamCachePath = Path.Combine(CachePath, "ffmpeg-streams");
if (!Directory.Exists(_fFMpegStreamCachePath))
{
Directory.CreateDirectory(_fFMpegStreamCachePath);
}
}
return _fFMpegStreamCachePath;
}
}
///
/// The _media tools path
///
private string _mediaToolsPath;
///
/// Gets the folder path to tools
///
/// The media tools path.
public string MediaToolsPath
{
get
{
if (_mediaToolsPath == null)
{
_mediaToolsPath = Path.Combine(ProgramDataPath, "MediaTools");
if (!Directory.Exists(_mediaToolsPath))
{
Directory.CreateDirectory(_mediaToolsPath);
}
}
return _mediaToolsPath;
}
}
}
}