ServerConfiguration.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  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. public bool EnableSeriesPresentationUniqueKey { get; set; }
  43. /// <summary>
  44. /// Gets or sets the value pointing to the file system where the ssl certiifcate is located..
  45. /// </summary>
  46. /// <value>The value pointing to the file system where the ssl certiifcate is located..</value>
  47. public string CertificatePath { get; set; }
  48. /// <summary>
  49. /// Gets or sets a value indicating whether [enable internet providers].
  50. /// </summary>
  51. /// <value><c>true</c> if [enable internet providers]; otherwise, <c>false</c>.</value>
  52. public bool EnableInternetProviders { get; set; }
  53. /// <summary>
  54. /// Gets or sets a value indicating whether this instance is port authorized.
  55. /// </summary>
  56. /// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
  57. public bool IsPortAuthorized { get; set; }
  58. /// <summary>
  59. /// Gets or sets a value indicating whether [enable case sensitive item ids].
  60. /// </summary>
  61. /// <value><c>true</c> if [enable case sensitive item ids]; otherwise, <c>false</c>.</value>
  62. public bool EnableCaseSensitiveItemIds { get; set; }
  63. /// <summary>
  64. /// Gets or sets the metadata path.
  65. /// </summary>
  66. /// <value>The metadata path.</value>
  67. public string MetadataPath { get; set; }
  68. public string MetadataNetworkPath { get; set; }
  69. public string LastVersion { get; set; }
  70. /// <summary>
  71. /// Gets or sets the display name of the season zero.
  72. /// </summary>
  73. /// <value>The display name of the season zero.</value>
  74. public string SeasonZeroDisplayName { get; set; }
  75. /// <summary>
  76. /// Gets or sets a value indicating whether [save local meta].
  77. /// </summary>
  78. /// <value><c>true</c> if [save local meta]; otherwise, <c>false</c>.</value>
  79. public bool SaveLocalMeta { get; set; }
  80. /// <summary>
  81. /// Gets or sets the preferred metadata language.
  82. /// </summary>
  83. /// <value>The preferred metadata language.</value>
  84. public string PreferredMetadataLanguage { get; set; }
  85. /// <summary>
  86. /// Gets or sets the metadata country code.
  87. /// </summary>
  88. /// <value>The metadata country code.</value>
  89. public string MetadataCountryCode { get; set; }
  90. /// <summary>
  91. /// Characters to be replaced with a ' ' in strings to create a sort name
  92. /// </summary>
  93. /// <value>The sort replace characters.</value>
  94. public string[] SortReplaceCharacters { get; set; }
  95. /// <summary>
  96. /// Characters to be removed from strings to create a sort name
  97. /// </summary>
  98. /// <value>The sort remove characters.</value>
  99. public string[] SortRemoveCharacters { get; set; }
  100. /// <summary>
  101. /// Words to be removed from strings to create a sort name
  102. /// </summary>
  103. /// <value>The sort remove words.</value>
  104. public string[] SortRemoveWords { get; set; }
  105. /// <summary>
  106. /// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated.
  107. /// </summary>
  108. /// <value>The min resume PCT.</value>
  109. public int MinResumePct { get; set; }
  110. /// <summary>
  111. /// 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.
  112. /// </summary>
  113. /// <value>The max resume PCT.</value>
  114. public int MaxResumePct { get; set; }
  115. /// <summary>
  116. /// Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates..
  117. /// </summary>
  118. /// <value>The min resume duration seconds.</value>
  119. public int MinResumeDurationSeconds { get; set; }
  120. /// <summary>
  121. /// The delay in seconds that we will wait after a file system change to try and discover what has been added/removed
  122. /// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
  123. /// different directories and files.
  124. /// </summary>
  125. /// <value>The file watcher delay.</value>
  126. public int LibraryMonitorDelay { get; set; }
  127. /// <summary>
  128. /// Gets or sets a value indicating whether [enable dashboard response caching].
  129. /// Allows potential contributors without visual studio to modify production dashboard code and test changes.
  130. /// </summary>
  131. /// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value>
  132. public bool EnableDashboardResponseCaching { 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 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. MetadataOptions = new[]
  211. {
  212. new MetadataOptions(1, 1280) {ItemType = "Book"},
  213. new MetadataOptions(1, 1280)
  214. {
  215. ItemType = "Movie",
  216. ImageOptions = new []
  217. {
  218. new ImageOption
  219. {
  220. Limit = 1,
  221. MinWidth = 1280,
  222. Type = ImageType.Backdrop
  223. },
  224. // Don't download this by default as it's rarely used.
  225. new ImageOption
  226. {
  227. Limit = 0,
  228. Type = ImageType.Art
  229. },
  230. // Don't download this by default as it's rarely used.
  231. new ImageOption
  232. {
  233. Limit = 0,
  234. Type = ImageType.Disc
  235. },
  236. new ImageOption
  237. {
  238. Limit = 1,
  239. Type = ImageType.Primary
  240. },
  241. new ImageOption
  242. {
  243. Limit = 0,
  244. Type = ImageType.Banner
  245. },
  246. new ImageOption
  247. {
  248. Limit = 1,
  249. Type = ImageType.Thumb
  250. },
  251. new ImageOption
  252. {
  253. Limit = 1,
  254. Type = ImageType.Logo
  255. }
  256. }
  257. },
  258. new MetadataOptions(1, 1280)
  259. {
  260. ItemType = "MusicVideo",
  261. ImageOptions = new []
  262. {
  263. new ImageOption
  264. {
  265. Limit = 1,
  266. MinWidth = 1280,
  267. Type = ImageType.Backdrop
  268. },
  269. // Don't download this by default as it's rarely used.
  270. new ImageOption
  271. {
  272. Limit = 0,
  273. Type = ImageType.Art
  274. },
  275. // Don't download this by default as it's rarely used.
  276. new ImageOption
  277. {
  278. Limit = 0,
  279. Type = ImageType.Disc
  280. },
  281. new ImageOption
  282. {
  283. Limit = 1,
  284. Type = ImageType.Primary
  285. },
  286. new ImageOption
  287. {
  288. Limit = 0,
  289. Type = ImageType.Banner
  290. },
  291. new ImageOption
  292. {
  293. Limit = 1,
  294. Type = ImageType.Thumb
  295. },
  296. new ImageOption
  297. {
  298. Limit = 1,
  299. Type = ImageType.Logo
  300. }
  301. }
  302. },
  303. new MetadataOptions(1, 1280)
  304. {
  305. ItemType = "Series",
  306. ImageOptions = new []
  307. {
  308. new ImageOption
  309. {
  310. Limit = 1,
  311. MinWidth = 1280,
  312. Type = ImageType.Backdrop
  313. },
  314. // Don't download this by default as it's rarely used.
  315. new ImageOption
  316. {
  317. Limit = 0,
  318. Type = ImageType.Art
  319. },
  320. new ImageOption
  321. {
  322. Limit = 1,
  323. Type = ImageType.Primary
  324. },
  325. new ImageOption
  326. {
  327. Limit = 1,
  328. Type = ImageType.Banner
  329. },
  330. new ImageOption
  331. {
  332. Limit = 1,
  333. Type = ImageType.Thumb
  334. },
  335. new ImageOption
  336. {
  337. Limit = 1,
  338. Type = ImageType.Logo
  339. }
  340. }
  341. },
  342. new MetadataOptions(1, 1280)
  343. {
  344. ItemType = "MusicAlbum",
  345. ImageOptions = new []
  346. {
  347. new ImageOption
  348. {
  349. Limit = 0,
  350. MinWidth = 1280,
  351. Type = ImageType.Backdrop
  352. },
  353. // Don't download this by default as it's rarely used.
  354. new ImageOption
  355. {
  356. Limit = 0,
  357. Type = ImageType.Disc
  358. }
  359. },
  360. DisabledMetadataFetchers = new []{ "TheAudioDB" }
  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. DisabledMetadataFetchers = new []{ "TheAudioDB" }
  396. },
  397. new MetadataOptions(1, 1280)
  398. {
  399. ItemType = "BoxSet",
  400. ImageOptions = new []
  401. {
  402. new ImageOption
  403. {
  404. Limit = 1,
  405. MinWidth = 1280,
  406. Type = ImageType.Backdrop
  407. },
  408. new ImageOption
  409. {
  410. Limit = 1,
  411. Type = ImageType.Primary
  412. },
  413. new ImageOption
  414. {
  415. Limit = 1,
  416. Type = ImageType.Thumb
  417. },
  418. new ImageOption
  419. {
  420. Limit = 1,
  421. Type = ImageType.Logo
  422. },
  423. // Don't download this by default as it's rarely used.
  424. new ImageOption
  425. {
  426. Limit = 0,
  427. Type = ImageType.Art
  428. },
  429. // Don't download this by default as it's rarely used.
  430. new ImageOption
  431. {
  432. Limit = 0,
  433. Type = ImageType.Disc
  434. },
  435. // Don't download this by default as it's rarely used.
  436. new ImageOption
  437. {
  438. Limit = 0,
  439. Type = ImageType.Banner
  440. }
  441. }
  442. },
  443. new MetadataOptions(0, 1280)
  444. {
  445. ItemType = "Season",
  446. ImageOptions = new []
  447. {
  448. new ImageOption
  449. {
  450. Limit = 0,
  451. MinWidth = 1280,
  452. Type = ImageType.Backdrop
  453. },
  454. new ImageOption
  455. {
  456. Limit = 1,
  457. Type = ImageType.Primary
  458. },
  459. new ImageOption
  460. {
  461. Limit = 0,
  462. Type = ImageType.Banner
  463. },
  464. new ImageOption
  465. {
  466. Limit = 0,
  467. Type = ImageType.Thumb
  468. }
  469. },
  470. DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
  471. },
  472. new MetadataOptions(0, 1280)
  473. {
  474. ItemType = "Episode",
  475. ImageOptions = new []
  476. {
  477. new ImageOption
  478. {
  479. Limit = 0,
  480. MinWidth = 1280,
  481. Type = ImageType.Backdrop
  482. },
  483. new ImageOption
  484. {
  485. Limit = 1,
  486. Type = ImageType.Primary
  487. }
  488. },
  489. DisabledMetadataFetchers = new []{ "The Open Movie Database" },
  490. DisabledImageFetchers = new []{ "TheMovieDb" }
  491. }
  492. };
  493. }
  494. }
  495. }