ServerConfiguration.cs 21 KB

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