ServerApplicationPaths.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. /// <summary>
  84. /// Gets the path to the Genre directory
  85. /// </summary>
  86. /// <value>The genre path.</value>
  87. public string GenrePath
  88. {
  89. get
  90. {
  91. return Path.Combine(ItemsByNamePath, "Genre");
  92. }
  93. }
  94. /// <summary>
  95. /// Gets the path to the Genre directory
  96. /// </summary>
  97. /// <value>The genre path.</value>
  98. public string MusicGenrePath
  99. {
  100. get
  101. {
  102. return Path.Combine(ItemsByNamePath, "MusicGenre");
  103. }
  104. }
  105. /// <summary>
  106. /// Gets the path to the Studio directory
  107. /// </summary>
  108. /// <value>The studio path.</value>
  109. public string StudioPath
  110. {
  111. get
  112. {
  113. return Path.Combine(ItemsByNamePath, "Studio");
  114. }
  115. }
  116. /// <summary>
  117. /// Gets the path to the Year directory
  118. /// </summary>
  119. /// <value>The year path.</value>
  120. public string YearPath
  121. {
  122. get
  123. {
  124. return Path.Combine(ItemsByNamePath, "Year");
  125. }
  126. }
  127. /// <summary>
  128. /// Gets the path to the General IBN directory
  129. /// </summary>
  130. /// <value>The general path.</value>
  131. public string GeneralPath
  132. {
  133. get
  134. {
  135. return Path.Combine(ItemsByNamePath, "general");
  136. }
  137. }
  138. /// <summary>
  139. /// Gets the path to the Ratings IBN directory
  140. /// </summary>
  141. /// <value>The ratings path.</value>
  142. public string RatingsPath
  143. {
  144. get
  145. {
  146. return Path.Combine(ItemsByNamePath, "ratings");
  147. }
  148. }
  149. /// <summary>
  150. /// Gets the media info images path.
  151. /// </summary>
  152. /// <value>The media info images path.</value>
  153. public string MediaInfoImagesPath
  154. {
  155. get
  156. {
  157. return Path.Combine(ItemsByNamePath, "mediainfo");
  158. }
  159. }
  160. /// <summary>
  161. /// Gets the path to the user configuration directory
  162. /// </summary>
  163. /// <value>The user configuration directory path.</value>
  164. public string UserConfigurationDirectoryPath
  165. {
  166. get
  167. {
  168. return Path.Combine(ConfigurationDirectoryPath, "users");
  169. }
  170. }
  171. private string _transcodingTempPath;
  172. public string TranscodingTempPath
  173. {
  174. get
  175. {
  176. return _transcodingTempPath ?? (_transcodingTempPath = Path.Combine(ProgramDataPath, "transcoding-temp"));
  177. }
  178. set
  179. {
  180. _transcodingTempPath = value;
  181. }
  182. }
  183. /// <summary>
  184. /// Gets the game genre path.
  185. /// </summary>
  186. /// <value>The game genre path.</value>
  187. public string GameGenrePath
  188. {
  189. get
  190. {
  191. return Path.Combine(ItemsByNamePath, "GameGenre");
  192. }
  193. }
  194. private string _internalMetadataPath;
  195. public string InternalMetadataPath
  196. {
  197. get
  198. {
  199. return _internalMetadataPath ?? (_internalMetadataPath = Path.Combine(DataPath, "metadata"));
  200. }
  201. set
  202. {
  203. _internalMetadataPath = value;
  204. }
  205. }
  206. }
  207. }