ServerConfiguration.cs 20 KB

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