ServerConfiguration.cs 21 KB

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