ServerConfiguration.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. using MediaBrowser.Model.Dto;
  2. using MediaBrowser.Model.Entities;
  3. namespace MediaBrowser.Model.Configuration
  4. {
  5. /// <summary>
  6. /// Represents the server configuration.
  7. /// </summary>
  8. public class ServerConfiguration : BaseApplicationConfiguration
  9. {
  10. /// <summary>
  11. /// Gets or sets a value indicating whether [enable u pn p].
  12. /// </summary>
  13. /// <value><c>true</c> if [enable u pn p]; otherwise, <c>false</c>.</value>
  14. public bool EnableUPnP { get; set; }
  15. /// <summary>
  16. /// Gets or sets the public mapped port.
  17. /// </summary>
  18. /// <value>The public mapped port.</value>
  19. public int PublicPort { get; set; }
  20. /// <summary>
  21. /// Gets or sets the public HTTPS port.
  22. /// </summary>
  23. /// <value>The public HTTPS port.</value>
  24. public int PublicHttpsPort { get; set; }
  25. /// <summary>
  26. /// Gets or sets the HTTP server port number.
  27. /// </summary>
  28. /// <value>The HTTP server port number.</value>
  29. public int HttpServerPortNumber { get; set; }
  30. /// <summary>
  31. /// Gets or sets the HTTPS server port number.
  32. /// </summary>
  33. /// <value>The HTTPS server port number.</value>
  34. public int HttpsPortNumber { get; set; }
  35. /// <summary>
  36. /// Gets or sets a value indicating whether [use HTTPS].
  37. /// </summary>
  38. /// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value>
  39. public bool EnableHttps { get; set; }
  40. /// <summary>
  41. /// Gets or sets the value pointing to the file system where the ssl certiifcate is located..
  42. /// </summary>
  43. /// <value>The value pointing to the file system where the ssl certiifcate is located..</value>
  44. public string CertificatePath { get; set; }
  45. /// <summary>
  46. /// Gets or sets a value indicating whether [enable internet providers].
  47. /// </summary>
  48. /// <value><c>true</c> if [enable internet providers]; otherwise, <c>false</c>.</value>
  49. public bool EnableInternetProviders { get; set; }
  50. /// <summary>
  51. /// Gets or sets a value indicating whether this instance is port authorized.
  52. /// </summary>
  53. /// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
  54. public bool IsPortAuthorized { get; set; }
  55. /// <summary>
  56. /// Gets or sets a value indicating whether [enable case sensitive item ids].
  57. /// </summary>
  58. /// <value><c>true</c> if [enable case sensitive item ids]; otherwise, <c>false</c>.</value>
  59. public bool EnableCaseSensitiveItemIds { get; set; }
  60. /// <summary>
  61. /// Gets or sets the metadata path.
  62. /// </summary>
  63. /// <value>The metadata path.</value>
  64. public string MetadataPath { get; set; }
  65. /// <summary>
  66. /// Gets or sets the display name of the season zero.
  67. /// </summary>
  68. /// <value>The display name of the season zero.</value>
  69. public string SeasonZeroDisplayName { get; set; }
  70. /// <summary>
  71. /// Gets or sets a value indicating whether [save local meta].
  72. /// </summary>
  73. /// <value><c>true</c> if [save local meta]; otherwise, <c>false</c>.</value>
  74. public bool SaveLocalMeta { get; set; }
  75. /// <summary>
  76. /// Gets or sets the preferred metadata language.
  77. /// </summary>
  78. /// <value>The preferred metadata language.</value>
  79. public string PreferredMetadataLanguage { get; set; }
  80. /// <summary>
  81. /// Gets or sets the metadata country code.
  82. /// </summary>
  83. /// <value>The metadata country code.</value>
  84. public string MetadataCountryCode { get; set; }
  85. /// <summary>
  86. /// Characters to be replaced with a ' ' in strings to create a sort name
  87. /// </summary>
  88. /// <value>The sort replace characters.</value>
  89. public string[] SortReplaceCharacters { get; set; }
  90. /// <summary>
  91. /// Characters to be removed from strings to create a sort name
  92. /// </summary>
  93. /// <value>The sort remove characters.</value>
  94. public string[] SortRemoveCharacters { get; set; }
  95. /// <summary>
  96. /// Words to be removed from strings to create a sort name
  97. /// </summary>
  98. /// <value>The sort remove words.</value>
  99. public string[] SortRemoveWords { get; set; }
  100. /// <summary>
  101. /// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated.
  102. /// </summary>
  103. /// <value>The min resume PCT.</value>
  104. public int MinResumePct { get; set; }
  105. /// <summary>
  106. /// 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.
  107. /// </summary>
  108. /// <value>The max resume PCT.</value>
  109. public int MaxResumePct { get; set; }
  110. /// <summary>
  111. /// Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates..
  112. /// </summary>
  113. /// <value>The min resume duration seconds.</value>
  114. public int MinResumeDurationSeconds { get; set; }
  115. /// <summary>
  116. /// The delay in seconds that we will wait after a file system change to try and discover what has been added/removed
  117. /// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
  118. /// different directories and files.
  119. /// </summary>
  120. /// <value>The file watcher delay.</value>
  121. public int LibraryMonitorDelay { get; set; }
  122. /// <summary>
  123. /// Gets or sets a value indicating whether [enable dashboard response caching].
  124. /// Allows potential contributors without visual studio to modify production dashboard code and test changes.
  125. /// </summary>
  126. /// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value>
  127. public bool EnableDashboardResponseCaching { get; set; }
  128. public bool EnableDashboardResourceMinification { get; set; }
  129. /// <summary>
  130. /// Allows the dashboard to be served from a custom path.
  131. /// </summary>
  132. /// <value>The dashboard source path.</value>
  133. public string DashboardSourcePath { get; set; }
  134. /// <summary>
  135. /// Gets or sets the image saving convention.
  136. /// </summary>
  137. /// <value>The image saving convention.</value>
  138. public ImageSavingConvention ImageSavingConvention { get; set; }
  139. public MetadataOptions[] MetadataOptions { get; set; }
  140. public bool EnableAutomaticRestart { get; set; }
  141. public PathSubstitution[] PathSubstitutions { get; set; }
  142. public string ServerName { get; set; }
  143. public string WanDdns { get; set; }
  144. public string UICulture { get; set; }
  145. public PeopleMetadataOptions PeopleMetadataOptions { get; set; }
  146. public bool FindInternetTrailers { get; set; }
  147. public bool SaveMetadataHidden { get; set; }
  148. public NameValuePair[] ContentTypes { get; set; }
  149. public bool EnableAudioArchiveFiles { get; set; }
  150. public bool EnableVideoArchiveFiles { get; set; }
  151. public int RemoteClientBitrateLimit { get; set; }
  152. public bool DenyIFrameEmbedding { get; set; }
  153. public AutoOnOff EnableLibraryMonitor { get; set; }
  154. public int SharingExpirationDays { get; set; }
  155. public string[] Migrations { get; set; }
  156. public int MigrationVersion { get; set; }
  157. public int SchemaVersion { get; set; }
  158. public bool DownloadImagesInAdvance { get; set; }
  159. public bool EnableAnonymousUsageReporting { get; set; }
  160. public bool EnableStandaloneMusicKeys { get; set; }
  161. public bool EnableLocalizedGuids { get; set; }
  162. /// <summary>
  163. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
  164. /// </summary>
  165. public ServerConfiguration()
  166. {
  167. Migrations = new string[] { };
  168. EnableCustomPathSubFolders = true;
  169. EnableLocalizedGuids = true;
  170. ImageSavingConvention = ImageSavingConvention.Compatible;
  171. PublicPort = 8096;
  172. PublicHttpsPort = 8920;
  173. HttpServerPortNumber = 8096;
  174. HttpsPortNumber = 8920;
  175. EnableHttps = false;
  176. EnableDashboardResponseCaching = true;
  177. EnableDashboardResourceMinification = true;
  178. EnableAnonymousUsageReporting = true;
  179. EnableAutomaticRestart = true;
  180. DenyIFrameEmbedding = true;
  181. EnableUPnP = true;
  182. SharingExpirationDays = 30;
  183. MinResumePct = 5;
  184. MaxResumePct = 90;
  185. // 5 minutes
  186. MinResumeDurationSeconds = 300;
  187. EnableLibraryMonitor = AutoOnOff.Auto;
  188. LibraryMonitorDelay = 60;
  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. UICulture = "en-us";
  200. PeopleMetadataOptions = new PeopleMetadataOptions();
  201. MetadataOptions = new[]
  202. {
  203. new MetadataOptions(1, 1280) {ItemType = "Book"},
  204. new MetadataOptions(1, 1280)
  205. {
  206. ItemType = "Movie",
  207. ImageOptions = new []
  208. {
  209. new ImageOption
  210. {
  211. Limit = 1,
  212. MinWidth = 1280,
  213. Type = ImageType.Backdrop
  214. },
  215. // Don't download this by default as it's rarely used.
  216. new ImageOption
  217. {
  218. Limit = 0,
  219. Type = ImageType.Art
  220. },
  221. // Don't download this by default as it's rarely used.
  222. new ImageOption
  223. {
  224. Limit = 0,
  225. Type = ImageType.Disc
  226. },
  227. new ImageOption
  228. {
  229. Limit = 1,
  230. Type = ImageType.Primary
  231. },
  232. new ImageOption
  233. {
  234. Limit = 0,
  235. Type = ImageType.Banner
  236. },
  237. new ImageOption
  238. {
  239. Limit = 1,
  240. Type = ImageType.Thumb
  241. },
  242. new ImageOption
  243. {
  244. Limit = 1,
  245. Type = ImageType.Logo
  246. }
  247. }
  248. },
  249. new MetadataOptions(1, 1280)
  250. {
  251. ItemType = "MusicVideo",
  252. ImageOptions = new []
  253. {
  254. new ImageOption
  255. {
  256. Limit = 1,
  257. MinWidth = 1280,
  258. Type = ImageType.Backdrop
  259. },
  260. // Don't download this by default as it's rarely used.
  261. new ImageOption
  262. {
  263. Limit = 0,
  264. Type = ImageType.Art
  265. },
  266. // Don't download this by default as it's rarely used.
  267. new ImageOption
  268. {
  269. Limit = 0,
  270. Type = ImageType.Disc
  271. },
  272. new ImageOption
  273. {
  274. Limit = 1,
  275. Type = ImageType.Primary
  276. },
  277. new ImageOption
  278. {
  279. Limit = 0,
  280. Type = ImageType.Banner
  281. },
  282. new ImageOption
  283. {
  284. Limit = 1,
  285. Type = ImageType.Thumb
  286. },
  287. new ImageOption
  288. {
  289. Limit = 1,
  290. Type = ImageType.Logo
  291. }
  292. }
  293. },
  294. new MetadataOptions(1, 1280)
  295. {
  296. ItemType = "Series",
  297. ImageOptions = new []
  298. {
  299. new ImageOption
  300. {
  301. Limit = 1,
  302. MinWidth = 1280,
  303. Type = ImageType.Backdrop
  304. },
  305. // Don't download this by default as it's rarely used.
  306. new ImageOption
  307. {
  308. Limit = 0,
  309. Type = ImageType.Art
  310. },
  311. new ImageOption
  312. {
  313. Limit = 1,
  314. Type = ImageType.Primary
  315. },
  316. new ImageOption
  317. {
  318. Limit = 1,
  319. Type = ImageType.Banner
  320. },
  321. new ImageOption
  322. {
  323. Limit = 1,
  324. Type = ImageType.Thumb
  325. },
  326. new ImageOption
  327. {
  328. Limit = 1,
  329. Type = ImageType.Logo
  330. }
  331. }
  332. },
  333. new MetadataOptions(1, 1280)
  334. {
  335. ItemType = "MusicAlbum",
  336. ImageOptions = new []
  337. {
  338. new ImageOption
  339. {
  340. Limit = 0,
  341. MinWidth = 1280,
  342. Type = ImageType.Backdrop
  343. },
  344. // Don't download this by default as it's rarely used.
  345. new ImageOption
  346. {
  347. Limit = 0,
  348. Type = ImageType.Disc
  349. }
  350. }
  351. },
  352. new MetadataOptions(1, 1280)
  353. {
  354. ItemType = "MusicArtist",
  355. ImageOptions = new []
  356. {
  357. new ImageOption
  358. {
  359. Limit = 1,
  360. MinWidth = 1280,
  361. Type = ImageType.Backdrop
  362. },
  363. // Don't download this by default
  364. // They do look great, but most artists won't have them, which means a banner view isn't really possible
  365. new ImageOption
  366. {
  367. Limit = 0,
  368. Type = ImageType.Banner
  369. },
  370. // Don't download this by default
  371. // Generally not used
  372. new ImageOption
  373. {
  374. Limit = 0,
  375. Type = ImageType.Art
  376. },
  377. // Don't download this by default
  378. // Generally not used
  379. new ImageOption
  380. {
  381. Limit = 0,
  382. Type = ImageType.Logo
  383. }
  384. }
  385. },
  386. new MetadataOptions(1, 1280)
  387. {
  388. ItemType = "BoxSet",
  389. ImageOptions = new []
  390. {
  391. new ImageOption
  392. {
  393. Limit = 1,
  394. MinWidth = 1280,
  395. Type = ImageType.Backdrop
  396. },
  397. new ImageOption
  398. {
  399. Limit = 1,
  400. Type = ImageType.Primary
  401. },
  402. new ImageOption
  403. {
  404. Limit = 1,
  405. Type = ImageType.Thumb
  406. },
  407. new ImageOption
  408. {
  409. Limit = 1,
  410. Type = ImageType.Logo
  411. },
  412. // Don't download this by default as it's rarely used.
  413. new ImageOption
  414. {
  415. Limit = 0,
  416. Type = ImageType.Art
  417. },
  418. // Don't download this by default as it's rarely used.
  419. new ImageOption
  420. {
  421. Limit = 0,
  422. Type = ImageType.Disc
  423. },
  424. // Don't download this by default as it's rarely used.
  425. new ImageOption
  426. {
  427. Limit = 0,
  428. Type = ImageType.Banner
  429. }
  430. }
  431. },
  432. new MetadataOptions(0, 1280)
  433. {
  434. ItemType = "Season",
  435. ImageOptions = new []
  436. {
  437. new ImageOption
  438. {
  439. Limit = 0,
  440. MinWidth = 1280,
  441. Type = ImageType.Backdrop
  442. },
  443. new ImageOption
  444. {
  445. Limit = 1,
  446. Type = ImageType.Primary
  447. },
  448. new ImageOption
  449. {
  450. Limit = 0,
  451. Type = ImageType.Banner
  452. },
  453. new ImageOption
  454. {
  455. Limit = 0,
  456. Type = ImageType.Thumb
  457. }
  458. },
  459. DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
  460. },
  461. new MetadataOptions(0, 1280)
  462. {
  463. ItemType = "Episode",
  464. ImageOptions = new []
  465. {
  466. new ImageOption
  467. {
  468. Limit = 0,
  469. MinWidth = 1280,
  470. Type = ImageType.Backdrop
  471. },
  472. new ImageOption
  473. {
  474. Limit = 1,
  475. Type = ImageType.Primary
  476. }
  477. },
  478. DisabledMetadataFetchers = new []{ "The Open Movie Database" },
  479. DisabledImageFetchers = new []{ "TheMovieDb" }
  480. }
  481. };
  482. }
  483. }
  484. }