ServerConfiguration.cs 20 KB

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