ServerApplicationPaths.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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. /// Initializes a new instance of the <see cref="BaseApplicationPaths" /> class.
  30. /// </summary>
  31. /// <param name="programDataPath">The program data path.</param>
  32. public ServerApplicationPaths(string programDataPath)
  33. : base(programDataPath)
  34. {
  35. }
  36. /// <summary>
  37. /// Gets the path to the base root media directory
  38. /// </summary>
  39. /// <value>The root folder path.</value>
  40. public string RootFolderPath
  41. {
  42. get
  43. {
  44. return Path.Combine(ProgramDataPath, "root");
  45. }
  46. }
  47. /// <summary>
  48. /// Gets the path to the default user view directory. Used if no specific user view is defined.
  49. /// </summary>
  50. /// <value>The default user views path.</value>
  51. public string DefaultUserViewsPath
  52. {
  53. get
  54. {
  55. return Path.Combine(RootFolderPath, "default");
  56. }
  57. }
  58. /// <summary>
  59. /// Gets the path to localization data.
  60. /// </summary>
  61. /// <value>The localization path.</value>
  62. public string LocalizationPath
  63. {
  64. get
  65. {
  66. return Path.Combine(ProgramDataPath, "localization");
  67. }
  68. }
  69. /// <summary>
  70. /// The _ibn path
  71. /// </summary>
  72. private string _ibnPath;
  73. /// <summary>
  74. /// Gets the path to the Images By Name directory
  75. /// </summary>
  76. /// <value>The images by name path.</value>
  77. public string ItemsByNamePath
  78. {
  79. get
  80. {
  81. return _ibnPath ?? (_ibnPath = Path.Combine(ProgramDataPath, "ImagesByName"));
  82. }
  83. set
  84. {
  85. _ibnPath = value;
  86. }
  87. }
  88. /// <summary>
  89. /// Gets the path to the People directory
  90. /// </summary>
  91. /// <value>The people path.</value>
  92. public string PeoplePath
  93. {
  94. get
  95. {
  96. return Path.Combine(ItemsByNamePath, "People");
  97. }
  98. }
  99. /// <summary>
  100. /// Gets the path to the Genre directory
  101. /// </summary>
  102. /// <value>The genre path.</value>
  103. public string GenrePath
  104. {
  105. get
  106. {
  107. return Path.Combine(ItemsByNamePath, "Genre");
  108. }
  109. }
  110. /// <summary>
  111. /// Gets the path to the Genre directory
  112. /// </summary>
  113. /// <value>The genre path.</value>
  114. public string MusicGenrePath
  115. {
  116. get
  117. {
  118. return Path.Combine(ItemsByNamePath, "MusicGenre");
  119. }
  120. }
  121. /// <summary>
  122. /// Gets the path to the Studio directory
  123. /// </summary>
  124. /// <value>The studio path.</value>
  125. public string StudioPath
  126. {
  127. get
  128. {
  129. return Path.Combine(ItemsByNamePath, "Studio");
  130. }
  131. }
  132. /// <summary>
  133. /// Gets the path to the Year directory
  134. /// </summary>
  135. /// <value>The year path.</value>
  136. public string YearPath
  137. {
  138. get
  139. {
  140. return Path.Combine(ItemsByNamePath, "Year");
  141. }
  142. }
  143. /// <summary>
  144. /// Gets the path to the General IBN directory
  145. /// </summary>
  146. /// <value>The general path.</value>
  147. public string GeneralPath
  148. {
  149. get
  150. {
  151. return Path.Combine(ItemsByNamePath, "general");
  152. }
  153. }
  154. /// <summary>
  155. /// Gets the path to the Ratings IBN directory
  156. /// </summary>
  157. /// <value>The ratings path.</value>
  158. public string RatingsPath
  159. {
  160. get
  161. {
  162. return Path.Combine(ItemsByNamePath, "ratings");
  163. }
  164. }
  165. /// <summary>
  166. /// Gets the media info images path.
  167. /// </summary>
  168. /// <value>The media info images path.</value>
  169. public string MediaInfoImagesPath
  170. {
  171. get
  172. {
  173. return Path.Combine(ItemsByNamePath, "mediainfo");
  174. }
  175. }
  176. /// <summary>
  177. /// Gets the path to the user configuration directory
  178. /// </summary>
  179. /// <value>The user configuration directory path.</value>
  180. public string UserConfigurationDirectoryPath
  181. {
  182. get
  183. {
  184. return Path.Combine(ConfigurationDirectoryPath, "users");
  185. }
  186. }
  187. /// <summary>
  188. /// Gets the FF MPEG stream cache path.
  189. /// </summary>
  190. /// <value>The FF MPEG stream cache path.</value>
  191. public string EncodedMediaCachePath
  192. {
  193. get
  194. {
  195. return Path.Combine(CachePath, "encoded-media");
  196. }
  197. }
  198. /// <summary>
  199. /// Gets the images data path.
  200. /// </summary>
  201. /// <value>The images data path.</value>
  202. public string DownloadedImagesDataPath
  203. {
  204. get
  205. {
  206. return Path.Combine(DataPath, "remote-images");
  207. }
  208. }
  209. /// <summary>
  210. /// Gets the artists path.
  211. /// </summary>
  212. /// <value>The artists path.</value>
  213. public string ArtistsPath
  214. {
  215. get
  216. {
  217. return Path.Combine(ItemsByNamePath, "artists");
  218. }
  219. }
  220. /// <summary>
  221. /// Gets the game genre path.
  222. /// </summary>
  223. /// <value>The game genre path.</value>
  224. public string GameGenrePath
  225. {
  226. get
  227. {
  228. return Path.Combine(ItemsByNamePath, "GameGenre");
  229. }
  230. }
  231. }
  232. }