ServerConfiguration.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  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 a value indicating whether [enable localized guids].
  77. /// </summary>
  78. /// <value><c>true</c> if [enable localized guids]; otherwise, <c>false</c>.</value>
  79. public bool EnableLocalizedGuids { 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 LibraryMonitorDelay { 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. public bool EnableDashboardResourceMinification { get; set; }
  134. /// <summary>
  135. /// Allows the dashboard to be served from a custom path.
  136. /// </summary>
  137. /// <value>The dashboard source path.</value>
  138. public string DashboardSourcePath { get; set; }
  139. /// <summary>
  140. /// Gets or sets the image saving convention.
  141. /// </summary>
  142. /// <value>The image saving convention.</value>
  143. public ImageSavingConvention ImageSavingConvention { get; set; }
  144. public MetadataOptions[] MetadataOptions { get; set; }
  145. public bool EnableAutomaticRestart { get; set; }
  146. public PathSubstitution[] PathSubstitutions { get; set; }
  147. public string ServerName { get; set; }
  148. public string WanDdns { get; set; }
  149. public string UICulture { get; set; }
  150. public PeopleMetadataOptions PeopleMetadataOptions { get; set; }
  151. public bool FindInternetTrailers { get; set; }
  152. public bool SaveMetadataHidden { get; set; }
  153. public NameValuePair[] ContentTypes { get; set; }
  154. public bool EnableAudioArchiveFiles { get; set; }
  155. public bool EnableVideoArchiveFiles { get; set; }
  156. public int RemoteClientBitrateLimit { get; set; }
  157. public bool DenyIFrameEmbedding { get; set; }
  158. public AutoOnOff EnableLibraryMonitor { get; set; }
  159. public int SharingExpirationDays { get; set; }
  160. public bool EnableDateLastRefresh { get; set; }
  161. public string[] Migrations { get; set; }
  162. public int MigrationVersion { get; set; }
  163. public int SchemaVersion { get; set; }
  164. public bool DownloadImagesInAdvance { get; set; }
  165. public bool EnableAnonymousUsageReporting { get; set; }
  166. public bool EnableStandaloneMusicKeys { get; set; }
  167. /// <summary>
  168. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
  169. /// </summary>
  170. public ServerConfiguration()
  171. {
  172. Migrations = new string[] { };
  173. ImageSavingConvention = ImageSavingConvention.Compatible;
  174. PublicPort = 8096;
  175. PublicHttpsPort = 8920;
  176. HttpServerPortNumber = 8096;
  177. HttpsPortNumber = 8920;
  178. EnableHttps = false;
  179. EnableDashboardResponseCaching = true;
  180. EnableDashboardResourceMinification = true;
  181. EnableAnonymousUsageReporting = true;
  182. EnableAutomaticRestart = true;
  183. DenyIFrameEmbedding = true;
  184. EnableUPnP = true;
  185. SharingExpirationDays = 30;
  186. MinResumePct = 5;
  187. MaxResumePct = 90;
  188. // 5 minutes
  189. MinResumeDurationSeconds = 300;
  190. EnableLibraryMonitor = AutoOnOff.Auto;
  191. LibraryMonitorDelay = 60;
  192. EnableInternetProviders = true;
  193. FindInternetTrailers = true;
  194. PathSubstitutions = new PathSubstitution[] { };
  195. ContentTypes = new NameValuePair[] { };
  196. PreferredMetadataLanguage = "en";
  197. MetadataCountryCode = "US";
  198. SortReplaceCharacters = new[] { ".", "+", "%" };
  199. SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" };
  200. SortRemoveWords = new[] { "the", "a", "an" };
  201. SeasonZeroDisplayName = "Specials";
  202. UICulture = "en-us";
  203. PeopleMetadataOptions = new PeopleMetadataOptions();
  204. MetadataOptions = new[]
  205. {
  206. new MetadataOptions(1, 1280) {ItemType = "Book"},
  207. new MetadataOptions(1, 1280)
  208. {
  209. ItemType = "Movie",
  210. ImageOptions = new []
  211. {
  212. new ImageOption
  213. {
  214. Limit = 1,
  215. MinWidth = 1280,
  216. Type = ImageType.Backdrop
  217. },
  218. // Don't download this by default as it's rarely used.
  219. new ImageOption
  220. {
  221. Limit = 0,
  222. Type = ImageType.Art
  223. },
  224. // Don't download this by default as it's rarely used.
  225. new ImageOption
  226. {
  227. Limit = 0,
  228. Type = ImageType.Disc
  229. },
  230. new ImageOption
  231. {
  232. Limit = 1,
  233. Type = ImageType.Primary
  234. },
  235. new ImageOption
  236. {
  237. Limit = 0,
  238. Type = ImageType.Banner
  239. },
  240. new ImageOption
  241. {
  242. Limit = 1,
  243. Type = ImageType.Thumb
  244. },
  245. new ImageOption
  246. {
  247. Limit = 1,
  248. Type = ImageType.Logo
  249. }
  250. }
  251. },
  252. new MetadataOptions(1, 1280)
  253. {
  254. ItemType = "MusicVideo",
  255. ImageOptions = new []
  256. {
  257. new ImageOption
  258. {
  259. Limit = 1,
  260. MinWidth = 1280,
  261. Type = ImageType.Backdrop
  262. },
  263. // Don't download this by default as it's rarely used.
  264. new ImageOption
  265. {
  266. Limit = 0,
  267. Type = ImageType.Art
  268. },
  269. // Don't download this by default as it's rarely used.
  270. new ImageOption
  271. {
  272. Limit = 0,
  273. Type = ImageType.Disc
  274. },
  275. new ImageOption
  276. {
  277. Limit = 1,
  278. Type = ImageType.Primary
  279. },
  280. new ImageOption
  281. {
  282. Limit = 0,
  283. Type = ImageType.Banner
  284. },
  285. new ImageOption
  286. {
  287. Limit = 1,
  288. Type = ImageType.Thumb
  289. },
  290. new ImageOption
  291. {
  292. Limit = 1,
  293. Type = ImageType.Logo
  294. }
  295. }
  296. },
  297. new MetadataOptions(1, 1280)
  298. {
  299. ItemType = "Series",
  300. ImageOptions = new []
  301. {
  302. new ImageOption
  303. {
  304. Limit = 1,
  305. MinWidth = 1280,
  306. Type = ImageType.Backdrop
  307. },
  308. // Don't download this by default as it's rarely used.
  309. new ImageOption
  310. {
  311. Limit = 0,
  312. Type = ImageType.Art
  313. },
  314. new ImageOption
  315. {
  316. Limit = 1,
  317. Type = ImageType.Primary
  318. },
  319. new ImageOption
  320. {
  321. Limit = 1,
  322. Type = ImageType.Banner
  323. },
  324. new ImageOption
  325. {
  326. Limit = 1,
  327. Type = ImageType.Thumb
  328. },
  329. new ImageOption
  330. {
  331. Limit = 1,
  332. Type = ImageType.Logo
  333. }
  334. }
  335. },
  336. new MetadataOptions(1, 1280)
  337. {
  338. ItemType = "MusicAlbum",
  339. ImageOptions = new []
  340. {
  341. new ImageOption
  342. {
  343. Limit = 0,
  344. MinWidth = 1280,
  345. Type = ImageType.Backdrop
  346. },
  347. // Don't download this by default as it's rarely used.
  348. new ImageOption
  349. {
  350. Limit = 0,
  351. Type = ImageType.Disc
  352. }
  353. }
  354. },
  355. new MetadataOptions(1, 1280)
  356. {
  357. ItemType = "MusicArtist",
  358. ImageOptions = new []
  359. {
  360. new ImageOption
  361. {
  362. Limit = 1,
  363. MinWidth = 1280,
  364. Type = ImageType.Backdrop
  365. },
  366. // Don't download this by default
  367. // They do look great, but most artists won't have them, which means a banner view isn't really possible
  368. new ImageOption
  369. {
  370. Limit = 0,
  371. Type = ImageType.Banner
  372. },
  373. // Don't download this by default
  374. // Generally not used
  375. new ImageOption
  376. {
  377. Limit = 0,
  378. Type = ImageType.Art
  379. },
  380. // Don't download this by default
  381. // Generally not used
  382. new ImageOption
  383. {
  384. Limit = 0,
  385. Type = ImageType.Logo
  386. }
  387. }
  388. },
  389. new MetadataOptions(1, 1280)
  390. {
  391. ItemType = "BoxSet",
  392. ImageOptions = new []
  393. {
  394. new ImageOption
  395. {
  396. Limit = 1,
  397. MinWidth = 1280,
  398. Type = ImageType.Backdrop
  399. },
  400. new ImageOption
  401. {
  402. Limit = 1,
  403. Type = ImageType.Primary
  404. },
  405. new ImageOption
  406. {
  407. Limit = 1,
  408. Type = ImageType.Thumb
  409. },
  410. new ImageOption
  411. {
  412. Limit = 1,
  413. Type = ImageType.Logo
  414. },
  415. // Don't download this by default as it's rarely used.
  416. new ImageOption
  417. {
  418. Limit = 0,
  419. Type = ImageType.Art
  420. },
  421. // Don't download this by default as it's rarely used.
  422. new ImageOption
  423. {
  424. Limit = 0,
  425. Type = ImageType.Disc
  426. },
  427. // Don't download this by default as it's rarely used.
  428. new ImageOption
  429. {
  430. Limit = 0,
  431. Type = ImageType.Banner
  432. }
  433. }
  434. },
  435. new MetadataOptions(0, 1280)
  436. {
  437. ItemType = "Season",
  438. ImageOptions = new []
  439. {
  440. new ImageOption
  441. {
  442. Limit = 0,
  443. MinWidth = 1280,
  444. Type = ImageType.Backdrop
  445. },
  446. new ImageOption
  447. {
  448. Limit = 1,
  449. Type = ImageType.Primary
  450. },
  451. new ImageOption
  452. {
  453. Limit = 0,
  454. Type = ImageType.Banner
  455. },
  456. new ImageOption
  457. {
  458. Limit = 0,
  459. Type = ImageType.Thumb
  460. }
  461. },
  462. DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
  463. },
  464. new MetadataOptions(0, 1280)
  465. {
  466. ItemType = "Episode",
  467. ImageOptions = new []
  468. {
  469. new ImageOption
  470. {
  471. Limit = 0,
  472. MinWidth = 1280,
  473. Type = ImageType.Backdrop
  474. },
  475. new ImageOption
  476. {
  477. Limit = 1,
  478. Type = ImageType.Primary
  479. }
  480. },
  481. DisabledMetadataFetchers = new []{ "The Open Movie Database" },
  482. DisabledImageFetchers = new []{ "TheMovieDb" }
  483. }
  484. };
  485. }
  486. }
  487. }