ServerConfiguration.cs 21 KB

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