2
0

ServerApplicationPaths.cs 6.6 KB

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