ServerApplicationPaths.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. #if (DEBUG)
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="ServerApplicationPaths" /> class.
  14. /// </summary>
  15. public ServerApplicationPaths()
  16. : base(true)
  17. {
  18. }
  19. #else
  20. /// <summary>
  21. /// Initializes a new instance of the <see cref="ServerApplicationPaths"/> class.
  22. /// </summary>
  23. public ServerApplicationPaths()
  24. : base(false)
  25. {
  26. }
  27. #endif
  28. /// <summary>
  29. /// Gets the path to the base root media directory
  30. /// </summary>
  31. /// <value>The root folder path.</value>
  32. public string RootFolderPath
  33. {
  34. get
  35. {
  36. return Path.Combine(ProgramDataPath, "root");
  37. }
  38. }
  39. /// <summary>
  40. /// Gets the path to the default user view directory. Used if no specific user view is defined.
  41. /// </summary>
  42. /// <value>The default user views path.</value>
  43. public string DefaultUserViewsPath
  44. {
  45. get
  46. {
  47. return Path.Combine(RootFolderPath, "default");
  48. }
  49. }
  50. /// <summary>
  51. /// Gets the path to localization data.
  52. /// </summary>
  53. /// <value>The localization path.</value>
  54. public string LocalizationPath
  55. {
  56. get
  57. {
  58. return Path.Combine(ProgramDataPath, "localization");
  59. }
  60. }
  61. /// <summary>
  62. /// The _ibn path
  63. /// </summary>
  64. private string _ibnPath;
  65. /// <summary>
  66. /// Gets the path to the Images By Name directory
  67. /// </summary>
  68. /// <value>The images by name path.</value>
  69. public string ItemsByNamePath
  70. {
  71. get
  72. {
  73. return _ibnPath ?? (_ibnPath = Path.Combine(ProgramDataPath, "ImagesByName"));
  74. }
  75. set
  76. {
  77. _ibnPath = value;
  78. }
  79. }
  80. /// <summary>
  81. /// Gets the path to the People directory
  82. /// </summary>
  83. /// <value>The people path.</value>
  84. public string PeoplePath
  85. {
  86. get
  87. {
  88. return Path.Combine(ItemsByNamePath, "People");
  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. /// <summary>
  180. /// Gets the FF MPEG stream cache path.
  181. /// </summary>
  182. /// <value>The FF MPEG stream cache path.</value>
  183. public string EncodedMediaCachePath
  184. {
  185. get
  186. {
  187. return Path.Combine(CachePath, "encoded-media");
  188. }
  189. }
  190. /// <summary>
  191. /// Gets the images data path.
  192. /// </summary>
  193. /// <value>The images data path.</value>
  194. public string DownloadedImagesDataPath
  195. {
  196. get
  197. {
  198. return Path.Combine(DataPath, "remote-images");
  199. }
  200. }
  201. /// <summary>
  202. /// Gets the artists path.
  203. /// </summary>
  204. /// <value>The artists path.</value>
  205. public string ArtistsPath
  206. {
  207. get
  208. {
  209. return Path.Combine(ItemsByNamePath, "artists");
  210. }
  211. }
  212. }
  213. }