ServerConfiguration.cs 21 KB

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