ServerApplicationPaths.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System.IO;
  2. using Emby.Server.Implementations.AppBase;
  3. using MediaBrowser.Controller;
  4. namespace Emby.Server.Implementations
  5. {
  6. /// <summary>
  7. /// Extends BaseApplicationPaths to add paths that are only applicable on the server.
  8. /// </summary>
  9. public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths
  10. {
  11. /// <summary>
  12. /// Initializes a new instance of the <see cref="ServerApplicationPaths" /> class.
  13. /// </summary>
  14. public ServerApplicationPaths(
  15. string programDataPath,
  16. string logDirectoryPath,
  17. string configurationDirectoryPath,
  18. string cacheDirectoryPath,
  19. string webDirectoryPath)
  20. : base(
  21. programDataPath,
  22. logDirectoryPath,
  23. configurationDirectoryPath,
  24. cacheDirectoryPath,
  25. webDirectoryPath)
  26. {
  27. // ProgramDataPath cannot change when the server is running, so cache these to avoid allocations.
  28. RootFolderPath = Path.Join(ProgramDataPath, "root");
  29. DefaultUserViewsPath = Path.Combine(RootFolderPath, "default");
  30. DefaultInternalMetadataPath = Path.Combine(ProgramDataPath, "metadata");
  31. InternalMetadataPath = DefaultInternalMetadataPath;
  32. }
  33. /// <summary>
  34. /// Gets the path to the base root media directory.
  35. /// </summary>
  36. /// <value>The root folder path.</value>
  37. public string RootFolderPath { get; }
  38. /// <summary>
  39. /// Gets the path to the default user view directory. Used if no specific user view is defined.
  40. /// </summary>
  41. /// <value>The default user views path.</value>
  42. public string DefaultUserViewsPath { get; }
  43. /// <summary>
  44. /// Gets the path to the People directory.
  45. /// </summary>
  46. /// <value>The people path.</value>
  47. public string PeoplePath => Path.Combine(InternalMetadataPath, "People");
  48. /// <inheritdoc />
  49. public string ArtistsPath => Path.Combine(InternalMetadataPath, "artists");
  50. /// <summary>
  51. /// Gets the path to the Genre directory.
  52. /// </summary>
  53. /// <value>The genre path.</value>
  54. public string GenrePath => Path.Combine(InternalMetadataPath, "Genre");
  55. /// <summary>
  56. /// Gets the path to the Genre directory.
  57. /// </summary>
  58. /// <value>The genre path.</value>
  59. public string MusicGenrePath => Path.Combine(InternalMetadataPath, "MusicGenre");
  60. /// <summary>
  61. /// Gets the path to the Studio directory.
  62. /// </summary>
  63. /// <value>The studio path.</value>
  64. public string StudioPath => Path.Combine(InternalMetadataPath, "Studio");
  65. /// <summary>
  66. /// Gets the path to the Year directory.
  67. /// </summary>
  68. /// <value>The year path.</value>
  69. public string YearPath => Path.Combine(InternalMetadataPath, "Year");
  70. /// <summary>
  71. /// Gets the path to the General IBN directory.
  72. /// </summary>
  73. /// <value>The general path.</value>
  74. public string GeneralPath => Path.Combine(InternalMetadataPath, "general");
  75. /// <summary>
  76. /// Gets the path to the Ratings IBN directory.
  77. /// </summary>
  78. /// <value>The ratings path.</value>
  79. public string RatingsPath => Path.Combine(InternalMetadataPath, "ratings");
  80. /// <summary>
  81. /// Gets the media info images path.
  82. /// </summary>
  83. /// <value>The media info images path.</value>
  84. public string MediaInfoImagesPath => Path.Combine(InternalMetadataPath, "mediainfo");
  85. /// <summary>
  86. /// Gets the path to the user configuration directory.
  87. /// </summary>
  88. /// <value>The user configuration directory path.</value>
  89. public string UserConfigurationDirectoryPath => Path.Combine(ConfigurationDirectoryPath, "users");
  90. /// <inheritdoc/>
  91. public string DefaultInternalMetadataPath { get; }
  92. /// <inheritdoc />
  93. public string InternalMetadataPath { get; set; }
  94. /// <inheritdoc />
  95. public string VirtualInternalMetadataPath => "%MetadataPath%";
  96. }
  97. }