ServerConfiguration.cs 21 KB

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