ServerConfiguration.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. using System.Xml.Schema;
  2. using MediaBrowser.Model.Dto;
  3. using MediaBrowser.Model.Entities;
  4. namespace MediaBrowser.Model.Configuration
  5. {
  6. /// <summary>
  7. /// Represents the server configuration.
  8. /// </summary>
  9. public class ServerConfiguration : BaseApplicationConfiguration
  10. {
  11. /// <summary>
  12. /// Gets or sets a value indicating whether [enable u pn p].
  13. /// </summary>
  14. /// <value><c>true</c> if [enable u pn p]; otherwise, <c>false</c>.</value>
  15. public bool EnableUPnP { get; set; }
  16. /// <summary>
  17. /// Gets or sets the public mapped port.
  18. /// </summary>
  19. /// <value>The public mapped port.</value>
  20. public int PublicPort { get; set; }
  21. /// <summary>
  22. /// Gets or sets the HTTP server port number.
  23. /// </summary>
  24. /// <value>The HTTP server port number.</value>
  25. public int HttpServerPortNumber { get; set; }
  26. /// <summary>
  27. /// Gets or sets the HTTPS server port number.
  28. /// </summary>
  29. /// <value>The HTTPS server port number.</value>
  30. public int HttpsPortNumber { get; set; }
  31. /// Gets or sets the value pointing to the file system where the ssl certiifcate is located.
  32. /// </summary>
  33. /// <value>The value pointing to the file system where the ssl certiifcate is located.</value>
  34. public bool UseHttps { get; set; }
  35. /// <summary>
  36. /// Gets or sets the value pointing to the file system where the ssl certiifcate is located..
  37. /// </summary>
  38. /// <value>The value pointing to the file system where the ssl certiifcate is located..</value>
  39. public string CertificatePath { get; set; }
  40. /// <summary>
  41. /// Gets or sets a value indicating whether [enable internet providers].
  42. /// </summary>
  43. /// <value><c>true</c> if [enable internet providers]; otherwise, <c>false</c>.</value>
  44. public bool EnableInternetProviders { get; set; }
  45. /// <summary>
  46. /// Gets or sets a value indicating whether this instance is port authorized.
  47. /// </summary>
  48. /// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
  49. public bool IsPortAuthorized { get; set; }
  50. /// <summary>
  51. /// Gets or sets the item by name path.
  52. /// </summary>
  53. /// <value>The item by name path.</value>
  54. public string ItemsByNamePath { get; set; }
  55. /// <summary>
  56. /// Gets or sets the metadata path.
  57. /// </summary>
  58. /// <value>The metadata path.</value>
  59. public string MetadataPath { get; set; }
  60. /// <summary>
  61. /// Gets or sets the display name of the season zero.
  62. /// </summary>
  63. /// <value>The display name of the season zero.</value>
  64. public string SeasonZeroDisplayName { get; set; }
  65. /// <summary>
  66. /// Gets or sets a value indicating whether [save local meta].
  67. /// </summary>
  68. /// <value><c>true</c> if [save local meta]; otherwise, <c>false</c>.</value>
  69. public bool SaveLocalMeta { get; set; }
  70. /// <summary>
  71. /// Gets or sets a value indicating whether [enable localized guids].
  72. /// </summary>
  73. /// <value><c>true</c> if [enable localized guids]; otherwise, <c>false</c>.</value>
  74. public bool EnableLocalizedGuids { get; set; }
  75. /// <summary>
  76. /// Gets or sets a value indicating whether [enable library metadata sub folder].
  77. /// </summary>
  78. /// <value><c>true</c> if [enable library metadata sub folder]; otherwise, <c>false</c>.</value>
  79. public bool EnableLibraryMetadataSubFolder { get; set; }
  80. /// <summary>
  81. /// Gets or sets the preferred metadata language.
  82. /// </summary>
  83. /// <value>The preferred metadata language.</value>
  84. public string PreferredMetadataLanguage { get; set; }
  85. /// <summary>
  86. /// Gets or sets the metadata country code.
  87. /// </summary>
  88. /// <value>The metadata country code.</value>
  89. public string MetadataCountryCode { get; set; }
  90. /// <summary>
  91. /// Characters to be replaced with a ' ' in strings to create a sort name
  92. /// </summary>
  93. /// <value>The sort replace characters.</value>
  94. public string[] SortReplaceCharacters { get; set; }
  95. /// <summary>
  96. /// Characters to be removed from strings to create a sort name
  97. /// </summary>
  98. /// <value>The sort remove characters.</value>
  99. public string[] SortRemoveCharacters { get; set; }
  100. /// <summary>
  101. /// Words to be removed from strings to create a sort name
  102. /// </summary>
  103. /// <value>The sort remove words.</value>
  104. public string[] SortRemoveWords { get; set; }
  105. /// <summary>
  106. /// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated.
  107. /// </summary>
  108. /// <value>The min resume PCT.</value>
  109. public int MinResumePct { get; set; }
  110. /// <summary>
  111. /// Gets or sets the maximum percentage of an item that can be played while still saving playstate. If this percentage is crossed playstate will be reset to the beginning and the item will be marked watched.
  112. /// </summary>
  113. /// <value>The max resume PCT.</value>
  114. public int MaxResumePct { get; set; }
  115. /// <summary>
  116. /// Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates..
  117. /// </summary>
  118. /// <value>The min resume duration seconds.</value>
  119. public int MinResumeDurationSeconds { get; set; }
  120. /// <summary>
  121. /// The delay in seconds that we will wait after a file system change to try and discover what has been added/removed
  122. /// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
  123. /// different directories and files.
  124. /// </summary>
  125. /// <value>The file watcher delay.</value>
  126. public int RealtimeMonitorDelay { get; set; }
  127. /// <summary>
  128. /// Gets or sets a value indicating whether [enable dashboard response caching].
  129. /// Allows potential contributors without visual studio to modify production dashboard code and test changes.
  130. /// </summary>
  131. /// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value>
  132. public bool EnableDashboardResponseCaching { get; set; }
  133. /// <summary>
  134. /// Allows the dashboard to be served from a custom path.
  135. /// </summary>
  136. /// <value>The dashboard source path.</value>
  137. public string DashboardSourcePath { get; set; }
  138. /// <summary>
  139. /// Gets or sets a value indicating whether [enable tv db updates].
  140. /// </summary>
  141. /// <value><c>true</c> if [enable tv db updates]; otherwise, <c>false</c>.</value>
  142. public bool EnableTvDbUpdates { get; set; }
  143. public bool EnableTmdbUpdates { get; set; }
  144. public bool StoreArtistsInMetadata { get; set; }
  145. public bool EnableFanArtUpdates { get; set; }
  146. public string FanartApiKey { get; set; }
  147. /// <summary>
  148. /// Gets or sets the image saving convention.
  149. /// </summary>
  150. /// <value>The image saving convention.</value>
  151. public ImageSavingConvention ImageSavingConvention { get; set; }
  152. public MetadataOptions[] MetadataOptions { get; set; }
  153. public string TranscodingTempPath { get; set; }
  154. public bool EnableAutomaticRestart { get; set; }
  155. public bool EnableRealtimeMonitor { get; set; }
  156. public PathSubstitution[] PathSubstitutions { get; set; }
  157. public string ServerName { get; set; }
  158. public string WanDdns { get; set; }
  159. public string UICulture { get; set; }
  160. public PeopleMetadataOptions PeopleMetadataOptions { get; set; }
  161. public bool FindInternetTrailers { get; set; }
  162. public string[] InsecureApps8 { get; set; }
  163. public bool SaveMetadataHidden { get; set; }
  164. public bool EnableWin8HttpListener { get; set; }
  165. public NameValuePair[] ContentTypes { get; set; }
  166. public bool EnableAudioArchiveFiles { get; set; }
  167. public bool EnableVideoArchiveFiles { get; set; }
  168. /// <summary>
  169. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
  170. /// </summary>
  171. public ServerConfiguration()
  172. : base()
  173. {
  174. ImageSavingConvention = ImageSavingConvention.Compatible;
  175. PublicPort = 8096;
  176. HttpServerPortNumber = 8096;
  177. HttpsPortNumber = 8920;
  178. UseHttps = false;
  179. CertificatePath = null;
  180. EnableDashboardResponseCaching = true;
  181. EnableAutomaticRestart = true;
  182. EnableWin8HttpListener = true;
  183. EnableUPnP = true;
  184. MinResumePct = 5;
  185. MaxResumePct = 90;
  186. // 5 minutes
  187. MinResumeDurationSeconds = 300;
  188. RealtimeMonitorDelay = 30;
  189. EnableInternetProviders = true;
  190. FindInternetTrailers = true;
  191. PathSubstitutions = new PathSubstitution[] { };
  192. ContentTypes = new NameValuePair[] { };
  193. PreferredMetadataLanguage = "en";
  194. MetadataCountryCode = "US";
  195. SortReplaceCharacters = new[] { ".", "+", "%" };
  196. SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" };
  197. SortRemoveWords = new[] { "the", "a", "an" };
  198. SeasonZeroDisplayName = "Specials";
  199. EnableRealtimeMonitor = true;
  200. UICulture = "en-us";
  201. PeopleMetadataOptions = new PeopleMetadataOptions();
  202. InsecureApps8 = new[]
  203. {
  204. "Chromecast",
  205. "iOS",
  206. "Unknown app",
  207. "MediaPortal",
  208. "Media Portal",
  209. "iPad",
  210. "iPhone",
  211. "Roku",
  212. "Windows Phone"
  213. };
  214. MetadataOptions = new[]
  215. {
  216. new MetadataOptions(1, 1280) {ItemType = "Book"},
  217. new MetadataOptions(1, 1280)
  218. {
  219. ItemType = "Movie",
  220. ImageOptions = new []
  221. {
  222. new ImageOption
  223. {
  224. Limit = 3,
  225. MinWidth = 1280,
  226. Type = ImageType.Backdrop
  227. },
  228. // Don't download this by default as it's rarely used.
  229. new ImageOption
  230. {
  231. Limit = 0,
  232. Type = ImageType.Art
  233. },
  234. // Don't download this by default as it's rarely used.
  235. new ImageOption
  236. {
  237. Limit = 0,
  238. Type = ImageType.Disc
  239. },
  240. new ImageOption
  241. {
  242. Limit = 1,
  243. Type = ImageType.Primary
  244. },
  245. new ImageOption
  246. {
  247. Limit = 1,
  248. Type = ImageType.Banner
  249. },
  250. new ImageOption
  251. {
  252. Limit = 1,
  253. Type = ImageType.Thumb
  254. },
  255. new ImageOption
  256. {
  257. Limit = 1,
  258. Type = ImageType.Logo
  259. }
  260. }
  261. },
  262. new MetadataOptions(1, 1280)
  263. {
  264. ItemType = "Series",
  265. ImageOptions = new []
  266. {
  267. new ImageOption
  268. {
  269. Limit = 2,
  270. MinWidth = 1280,
  271. Type = ImageType.Backdrop
  272. },
  273. // Don't download this by default as it's rarely used.
  274. new ImageOption
  275. {
  276. Limit = 0,
  277. Type = ImageType.Art
  278. },
  279. new ImageOption
  280. {
  281. Limit = 1,
  282. Type = ImageType.Primary
  283. },
  284. new ImageOption
  285. {
  286. Limit = 1,
  287. Type = ImageType.Banner
  288. },
  289. new ImageOption
  290. {
  291. Limit = 1,
  292. Type = ImageType.Thumb
  293. },
  294. new ImageOption
  295. {
  296. Limit = 1,
  297. Type = ImageType.Logo
  298. }
  299. }
  300. },
  301. new MetadataOptions(1, 1280)
  302. {
  303. ItemType = "MusicAlbum",
  304. ImageOptions = new []
  305. {
  306. new ImageOption
  307. {
  308. Limit = 1,
  309. MinWidth = 1280,
  310. Type = ImageType.Backdrop
  311. },
  312. // Don't download this by default as it's rarely used.
  313. new ImageOption
  314. {
  315. Limit = 0,
  316. Type = ImageType.Disc
  317. }
  318. }
  319. },
  320. new MetadataOptions(1, 1280)
  321. {
  322. ItemType = "MusicArtist",
  323. ImageOptions = new []
  324. {
  325. new ImageOption
  326. {
  327. Limit = 1,
  328. MinWidth = 1280,
  329. Type = ImageType.Backdrop
  330. },
  331. // Don't download this by default
  332. // They do look great, but most artists won't have them, which means a banner view isn't really possible
  333. new ImageOption
  334. {
  335. Limit = 0,
  336. Type = ImageType.Banner
  337. },
  338. // Don't download this by default
  339. // Generally not used
  340. new ImageOption
  341. {
  342. Limit = 0,
  343. Type = ImageType.Art
  344. }
  345. }
  346. },
  347. new MetadataOptions(0, 1280) {ItemType = "Season"}
  348. };
  349. }
  350. }
  351. }