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. public const int DefaultHttpPort = 8096;
  11. public const int DefaultHttpsPort = 8920;
  12. /// <summary>
  13. /// Gets or sets a value indicating whether [enable u pn p].
  14. /// </summary>
  15. /// <value><c>true</c> if [enable u pn p]; otherwise, <c>false</c>.</value>
  16. public bool EnableUPnP { get; set; }
  17. /// <summary>
  18. /// Gets or sets the public mapped port.
  19. /// </summary>
  20. /// <value>The public mapped port.</value>
  21. public int PublicPort { get; set; }
  22. /// <summary>
  23. /// Gets or sets the public HTTPS port.
  24. /// </summary>
  25. /// <value>The public HTTPS port.</value>
  26. public int PublicHttpsPort { get; set; }
  27. /// <summary>
  28. /// Gets or sets the HTTP server port number.
  29. /// </summary>
  30. /// <value>The HTTP server port number.</value>
  31. public int HttpServerPortNumber { get; set; }
  32. /// <summary>
  33. /// Gets or sets the HTTPS server port number.
  34. /// </summary>
  35. /// <value>The HTTPS server port number.</value>
  36. public int HttpsPortNumber { get; set; }
  37. /// <summary>
  38. /// Gets or sets a value indicating whether [use HTTPS].
  39. /// </summary>
  40. /// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value>
  41. public bool EnableHttps { get; set; }
  42. /// <summary>
  43. /// Gets or sets the value pointing to the file system where the ssl certiifcate is located..
  44. /// </summary>
  45. /// <value>The value pointing to the file system where the ssl certiifcate is located..</value>
  46. public string CertificatePath { get; set; }
  47. /// <summary>
  48. /// Gets or sets a value indicating whether [enable internet providers].
  49. /// </summary>
  50. /// <value><c>true</c> if [enable internet providers]; otherwise, <c>false</c>.</value>
  51. public bool EnableInternetProviders { get; set; }
  52. /// <summary>
  53. /// Gets or sets a value indicating whether this instance is port authorized.
  54. /// </summary>
  55. /// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
  56. public bool IsPortAuthorized { get; set; }
  57. /// <summary>
  58. /// Gets or sets a value indicating whether [enable case sensitive item ids].
  59. /// </summary>
  60. /// <value><c>true</c> if [enable case sensitive item ids]; otherwise, <c>false</c>.</value>
  61. public bool EnableCaseSensitiveItemIds { get; set; }
  62. /// <summary>
  63. /// Gets or sets the metadata path.
  64. /// </summary>
  65. /// <value>The metadata path.</value>
  66. public string MetadataPath { get; set; }
  67. public string MetadataNetworkPath { get; set; }
  68. public string LastVersion { get; set; }
  69. /// <summary>
  70. /// Gets or sets the display name of the season zero.
  71. /// </summary>
  72. /// <value>The display name of the season zero.</value>
  73. public string SeasonZeroDisplayName { get; set; }
  74. /// <summary>
  75. /// Gets or sets a value indicating whether [save local meta].
  76. /// </summary>
  77. /// <value><c>true</c> if [save local meta]; otherwise, <c>false</c>.</value>
  78. public bool SaveLocalMeta { get; set; }
  79. /// <summary>
  80. /// Gets or sets the preferred metadata language.
  81. /// </summary>
  82. /// <value>The preferred metadata language.</value>
  83. public string PreferredMetadataLanguage { get; set; }
  84. /// <summary>
  85. /// Gets or sets the metadata country code.
  86. /// </summary>
  87. /// <value>The metadata country code.</value>
  88. public string MetadataCountryCode { get; set; }
  89. /// <summary>
  90. /// Characters to be replaced with a ' ' in strings to create a sort name
  91. /// </summary>
  92. /// <value>The sort replace characters.</value>
  93. public string[] SortReplaceCharacters { get; set; }
  94. /// <summary>
  95. /// Characters to be removed from strings to create a sort name
  96. /// </summary>
  97. /// <value>The sort remove characters.</value>
  98. public string[] SortRemoveCharacters { get; set; }
  99. /// <summary>
  100. /// Words to be removed from strings to create a sort name
  101. /// </summary>
  102. /// <value>The sort remove words.</value>
  103. public string[] SortRemoveWords { get; set; }
  104. /// <summary>
  105. /// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated.
  106. /// </summary>
  107. /// <value>The min resume PCT.</value>
  108. public int MinResumePct { get; set; }
  109. /// <summary>
  110. /// 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.
  111. /// </summary>
  112. /// <value>The max resume PCT.</value>
  113. public int MaxResumePct { get; set; }
  114. /// <summary>
  115. /// Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates..
  116. /// </summary>
  117. /// <value>The min resume duration seconds.</value>
  118. public int MinResumeDurationSeconds { get; set; }
  119. /// <summary>
  120. /// The delay in seconds that we will wait after a file system change to try and discover what has been added/removed
  121. /// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
  122. /// different directories and files.
  123. /// </summary>
  124. /// <value>The file watcher delay.</value>
  125. public int LibraryMonitorDelay { get; set; }
  126. /// <summary>
  127. /// Gets or sets a value indicating whether [enable dashboard response caching].
  128. /// Allows potential contributors without visual studio to modify production dashboard code and test changes.
  129. /// </summary>
  130. /// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value>
  131. public bool EnableDashboardResponseCaching { get; set; }
  132. /// <summary>
  133. /// Allows the dashboard to be served from a custom path.
  134. /// </summary>
  135. /// <value>The dashboard source path.</value>
  136. public string DashboardSourcePath { get; set; }
  137. /// <summary>
  138. /// Gets or sets the image saving convention.
  139. /// </summary>
  140. /// <value>The image saving convention.</value>
  141. public ImageSavingConvention ImageSavingConvention { get; set; }
  142. public MetadataOptions[] MetadataOptions { get; set; }
  143. public bool EnableAutomaticRestart { get; set; }
  144. public bool SkipDeserializationForBasicTypes { get; set; }
  145. public bool SkipDeserializationForPrograms { get; set; }
  146. public bool SkipDeserializationForAudio { get; set; }
  147. public PathSubstitution[] PathSubstitutions { get; set; }
  148. public string ServerName { get; set; }
  149. public string WanDdns { get; set; }
  150. public string UICulture { get; set; }
  151. public PeopleMetadataOptions PeopleMetadataOptions { get; set; }
  152. public bool SaveMetadataHidden { get; set; }
  153. public NameValuePair[] ContentTypes { get; set; }
  154. public int RemoteClientBitrateLimit { get; set; }
  155. public int SharingExpirationDays { get; set; }
  156. public int SchemaVersion { get; set; }
  157. public int SqliteCacheSize { get; set; }
  158. public bool EnableAnonymousUsageReporting { get; set; }
  159. public bool EnableStandaloneMusicKeys { get; set; }
  160. public bool EnableLocalizedGuids { get; set; }
  161. public bool EnableFolderView { get; set; }
  162. public bool EnableGroupingIntoCollections { get; set; }
  163. public bool DisplaySpecialsWithinSeasons { get; set; }
  164. public bool DisplayCollectionsView { get; set; }
  165. public string[] LocalNetworkAddresses { get; set; }
  166. public string[] CodecsUsed { get; set; }
  167. public bool EnableChannelView { get; set; }
  168. public bool EnableExternalContentInSuggestions { get; set; }
  169. public bool EnableSimpleArtistDetection { get; set; }
  170. public int ImageExtractionTimeoutMs { get; set; }
  171. /// <summary>
  172. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
  173. /// </summary>
  174. public ServerConfiguration()
  175. {
  176. LocalNetworkAddresses = new string[] { };
  177. CodecsUsed = new string[] { };
  178. SqliteCacheSize = 0;
  179. ImageExtractionTimeoutMs = 0;
  180. EnableLocalizedGuids = true;
  181. DisplaySpecialsWithinSeasons = true;
  182. EnableExternalContentInSuggestions = true;
  183. ImageSavingConvention = ImageSavingConvention.Compatible;
  184. PublicPort = DefaultHttpPort;
  185. PublicHttpsPort = DefaultHttpsPort;
  186. HttpServerPortNumber = DefaultHttpPort;
  187. HttpsPortNumber = DefaultHttpsPort;
  188. EnableHttps = false;
  189. EnableDashboardResponseCaching = true;
  190. EnableAnonymousUsageReporting = true;
  191. EnableAutomaticRestart = true;
  192. EnableFolderView = true;
  193. EnableUPnP = true;
  194. SharingExpirationDays = 30;
  195. MinResumePct = 5;
  196. MaxResumePct = 90;
  197. // 5 minutes
  198. MinResumeDurationSeconds = 300;
  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. DisabledMetadataFetchers = new []{ "TheAudioDB" }
  362. },
  363. new MetadataOptions(1, 1280)
  364. {
  365. ItemType = "MusicArtist",
  366. ImageOptions = new []
  367. {
  368. new ImageOption
  369. {
  370. Limit = 1,
  371. MinWidth = 1280,
  372. Type = ImageType.Backdrop
  373. },
  374. // Don't download this by default
  375. // They do look great, but most artists won't have them, which means a banner view isn't really possible
  376. new ImageOption
  377. {
  378. Limit = 0,
  379. Type = ImageType.Banner
  380. },
  381. // Don't download this by default
  382. // Generally not used
  383. new ImageOption
  384. {
  385. Limit = 0,
  386. Type = ImageType.Art
  387. },
  388. // Don't download this by default
  389. // Generally not used
  390. new ImageOption
  391. {
  392. Limit = 0,
  393. Type = ImageType.Logo
  394. }
  395. },
  396. DisabledMetadataFetchers = new []{ "TheAudioDB" }
  397. },
  398. new MetadataOptions(1, 1280)
  399. {
  400. ItemType = "BoxSet",
  401. ImageOptions = new []
  402. {
  403. new ImageOption
  404. {
  405. Limit = 1,
  406. MinWidth = 1280,
  407. Type = ImageType.Backdrop
  408. },
  409. new ImageOption
  410. {
  411. Limit = 1,
  412. Type = ImageType.Primary
  413. },
  414. new ImageOption
  415. {
  416. Limit = 1,
  417. Type = ImageType.Thumb
  418. },
  419. new ImageOption
  420. {
  421. Limit = 1,
  422. Type = ImageType.Logo
  423. },
  424. // Don't download this by default as it's rarely used.
  425. new ImageOption
  426. {
  427. Limit = 0,
  428. Type = ImageType.Art
  429. },
  430. // Don't download this by default as it's rarely used.
  431. new ImageOption
  432. {
  433. Limit = 0,
  434. Type = ImageType.Disc
  435. },
  436. // Don't download this by default as it's rarely used.
  437. new ImageOption
  438. {
  439. Limit = 0,
  440. Type = ImageType.Banner
  441. }
  442. }
  443. },
  444. new MetadataOptions(0, 1280)
  445. {
  446. ItemType = "Season",
  447. ImageOptions = new []
  448. {
  449. new ImageOption
  450. {
  451. Limit = 0,
  452. MinWidth = 1280,
  453. Type = ImageType.Backdrop
  454. },
  455. new ImageOption
  456. {
  457. Limit = 1,
  458. Type = ImageType.Primary
  459. },
  460. new ImageOption
  461. {
  462. Limit = 0,
  463. Type = ImageType.Banner
  464. },
  465. new ImageOption
  466. {
  467. Limit = 0,
  468. Type = ImageType.Thumb
  469. }
  470. },
  471. DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
  472. },
  473. new MetadataOptions(0, 1280)
  474. {
  475. ItemType = "Episode",
  476. ImageOptions = new []
  477. {
  478. new ImageOption
  479. {
  480. Limit = 0,
  481. MinWidth = 1280,
  482. Type = ImageType.Backdrop
  483. },
  484. new ImageOption
  485. {
  486. Limit = 1,
  487. Type = ImageType.Primary
  488. }
  489. },
  490. DisabledMetadataFetchers = new []{ "The Open Movie Database" },
  491. DisabledImageFetchers = new []{ "TheMovieDb" }
  492. }
  493. };
  494. }
  495. }
  496. }