2
0

ServerApplicationPaths.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. using System;
  2. using System.IO;
  3. using Emby.Server.Implementations.AppBase;
  4. using MediaBrowser.Controller;
  5. namespace Emby.Server.Implementations
  6. {
  7. /// <summary>
  8. /// Extends BaseApplicationPaths to add paths that are only applicable on the server
  9. /// </summary>
  10. public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths
  11. {
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="BaseApplicationPaths" /> class.
  14. /// </summary>
  15. public ServerApplicationPaths(string programDataPath, string appFolderPath, string applicationResourcesPath, Action<string> createDirectoryFn)
  16. : base(programDataPath, appFolderPath, createDirectoryFn)
  17. {
  18. ApplicationResourcesPath = applicationResourcesPath;
  19. }
  20. public string ApplicationResourcesPath { get; private set; }
  21. /// <summary>
  22. /// Gets the path to the base root media directory
  23. /// </summary>
  24. /// <value>The root folder path.</value>
  25. public string RootFolderPath
  26. {
  27. get
  28. {
  29. return Path.Combine(ProgramDataPath, "root");
  30. }
  31. }
  32. /// <summary>
  33. /// Gets the path to the default user view directory. Used if no specific user view is defined.
  34. /// </summary>
  35. /// <value>The default user views path.</value>
  36. public string DefaultUserViewsPath
  37. {
  38. get
  39. {
  40. return Path.Combine(RootFolderPath, "default");
  41. }
  42. }
  43. /// <summary>
  44. /// Gets the path to localization data.
  45. /// </summary>
  46. /// <value>The localization path.</value>
  47. public string LocalizationPath
  48. {
  49. get
  50. {
  51. return Path.Combine(ProgramDataPath, "localization");
  52. }
  53. }
  54. /// <summary>
  55. /// The _ibn path
  56. /// </summary>
  57. private string _ibnPath;
  58. /// <summary>
  59. /// Gets the path to the Images By Name directory
  60. /// </summary>
  61. /// <value>The images by name path.</value>
  62. public string ItemsByNamePath
  63. {
  64. get
  65. {
  66. return _ibnPath ?? (_ibnPath = Path.Combine(ProgramDataPath, "ImagesByName"));
  67. }
  68. set
  69. {
  70. _ibnPath = value;
  71. }
  72. }
  73. /// <summary>
  74. /// Gets the path to the People directory
  75. /// </summary>
  76. /// <value>The people path.</value>
  77. public string PeoplePath
  78. {
  79. get
  80. {
  81. return Path.Combine(ItemsByNamePath, "People");
  82. }
  83. }
  84. public string ArtistsPath
  85. {
  86. get
  87. {
  88. return Path.Combine(ItemsByNamePath, "artists");
  89. }
  90. }
  91. /// <summary>
  92. /// Gets the path to the Genre directory
  93. /// </summary>
  94. /// <value>The genre path.</value>
  95. public string GenrePath
  96. {
  97. get
  98. {
  99. return Path.Combine(ItemsByNamePath, "Genre");
  100. }
  101. }
  102. /// <summary>
  103. /// Gets the path to the Genre directory
  104. /// </summary>
  105. /// <value>The genre path.</value>
  106. public string MusicGenrePath
  107. {
  108. get
  109. {
  110. return Path.Combine(ItemsByNamePath, "MusicGenre");
  111. }
  112. }
  113. /// <summary>
  114. /// Gets the path to the Studio directory
  115. /// </summary>
  116. /// <value>The studio path.</value>
  117. public string StudioPath
  118. {
  119. get
  120. {
  121. return Path.Combine(ItemsByNamePath, "Studio");
  122. }
  123. }
  124. /// <summary>
  125. /// Gets the path to the Year directory
  126. /// </summary>
  127. /// <value>The year path.</value>
  128. public string YearPath
  129. {
  130. get
  131. {
  132. return Path.Combine(ItemsByNamePath, "Year");
  133. }
  134. }
  135. /// <summary>
  136. /// Gets the path to the General IBN directory
  137. /// </summary>
  138. /// <value>The general path.</value>
  139. public string GeneralPath
  140. {
  141. get
  142. {
  143. return Path.Combine(ItemsByNamePath, "general");
  144. }
  145. }
  146. /// <summary>
  147. /// Gets the path to the Ratings IBN directory
  148. /// </summary>
  149. /// <value>The ratings path.</value>
  150. public string RatingsPath
  151. {
  152. get
  153. {
  154. return Path.Combine(ItemsByNamePath, "ratings");
  155. }
  156. }
  157. /// <summary>
  158. /// Gets the media info images path.
  159. /// </summary>
  160. /// <value>The media info images path.</value>
  161. public string MediaInfoImagesPath
  162. {
  163. get
  164. {
  165. return Path.Combine(ItemsByNamePath, "mediainfo");
  166. }
  167. }
  168. /// <summary>
  169. /// Gets the path to the user configuration directory
  170. /// </summary>
  171. /// <value>The user configuration directory path.</value>
  172. public string UserConfigurationDirectoryPath
  173. {
  174. get
  175. {
  176. return Path.Combine(ConfigurationDirectoryPath, "users");
  177. }
  178. }
  179. private string _transcodingTempPath;
  180. public string TranscodingTempPath
  181. {
  182. get
  183. {
  184. return _transcodingTempPath ?? (_transcodingTempPath = Path.Combine(ProgramDataPath, "transcoding-temp"));
  185. }
  186. set
  187. {
  188. _transcodingTempPath = value;
  189. }
  190. }
  191. /// <summary>
  192. /// Gets the game genre path.
  193. /// </summary>
  194. /// <value>The game genre path.</value>
  195. public string GameGenrePath
  196. {
  197. get
  198. {
  199. return Path.Combine(ItemsByNamePath, "GameGenre");
  200. }
  201. }
  202. private string _internalMetadataPath;
  203. public string InternalMetadataPath
  204. {
  205. get
  206. {
  207. return _internalMetadataPath ?? (_internalMetadataPath = Path.Combine(DataPath, "metadata"));
  208. }
  209. set
  210. {
  211. _internalMetadataPath = value;
  212. }
  213. }
  214. }
  215. }