ServerApplicationPaths.cs 6.2 KB

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