ServerConfiguration.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  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 EnableLocalizedGuids { get; set; }
  43. public bool EnableNormalizedItemByNameIds { 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. public string CertificatePassword { get; set; }
  50. /// <summary>
  51. /// Gets or sets a value indicating whether this instance is port authorized.
  52. /// </summary>
  53. /// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
  54. public bool IsPortAuthorized { get; set; }
  55. /// <summary>
  56. /// Gets or sets a value indicating whether [enable case sensitive item ids].
  57. /// </summary>
  58. /// <value><c>true</c> if [enable case sensitive item ids]; otherwise, <c>false</c>.</value>
  59. public bool EnableCaseSensitiveItemIds { get; set; }
  60. public bool DisableLiveTvChannelUserDataName { get; set; }
  61. /// <summary>
  62. /// Gets or sets the metadata path.
  63. /// </summary>
  64. /// <value>The metadata path.</value>
  65. public string MetadataPath { get; set; }
  66. public string MetadataNetworkPath { get; set; }
  67. /// <summary>
  68. /// Gets or sets the display name of the season zero.
  69. /// </summary>
  70. /// <value>The display name of the season zero.</value>
  71. public string SeasonZeroDisplayName { get; set; }
  72. /// <summary>
  73. /// Gets or sets the preferred metadata language.
  74. /// </summary>
  75. /// <value>The preferred metadata language.</value>
  76. public string PreferredMetadataLanguage { get; set; }
  77. /// <summary>
  78. /// Gets or sets the metadata country code.
  79. /// </summary>
  80. /// <value>The metadata country code.</value>
  81. public string MetadataCountryCode { get; set; }
  82. /// <summary>
  83. /// Characters to be replaced with a ' ' in strings to create a sort name
  84. /// </summary>
  85. /// <value>The sort replace characters.</value>
  86. public string[] SortReplaceCharacters { get; set; }
  87. /// <summary>
  88. /// Characters to be removed from strings to create a sort name
  89. /// </summary>
  90. /// <value>The sort remove characters.</value>
  91. public string[] SortRemoveCharacters { get; set; }
  92. /// <summary>
  93. /// Words to be removed from strings to create a sort name
  94. /// </summary>
  95. /// <value>The sort remove words.</value>
  96. public string[] SortRemoveWords { get; set; }
  97. /// <summary>
  98. /// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated.
  99. /// </summary>
  100. /// <value>The min resume PCT.</value>
  101. public int MinResumePct { get; set; }
  102. /// <summary>
  103. /// 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.
  104. /// </summary>
  105. /// <value>The max resume PCT.</value>
  106. public int MaxResumePct { get; set; }
  107. /// <summary>
  108. /// Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates..
  109. /// </summary>
  110. /// <value>The min resume duration seconds.</value>
  111. public int MinResumeDurationSeconds { get; set; }
  112. /// <summary>
  113. /// The delay in seconds that we will wait after a file system change to try and discover what has been added/removed
  114. /// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
  115. /// different directories and files.
  116. /// </summary>
  117. /// <value>The file watcher delay.</value>
  118. public int LibraryMonitorDelay { get; set; }
  119. /// <summary>
  120. /// Gets or sets a value indicating whether [enable dashboard response caching].
  121. /// Allows potential contributors without visual studio to modify production dashboard code and test changes.
  122. /// </summary>
  123. /// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value>
  124. public bool EnableDashboardResponseCaching { get; set; }
  125. /// <summary>
  126. /// Allows the dashboard to be served from a custom path.
  127. /// </summary>
  128. /// <value>The dashboard source path.</value>
  129. public string DashboardSourcePath { get; set; }
  130. /// <summary>
  131. /// Gets or sets the image saving convention.
  132. /// </summary>
  133. /// <value>The image saving convention.</value>
  134. public ImageSavingConvention ImageSavingConvention { get; set; }
  135. public MetadataOptions[] MetadataOptions { get; set; }
  136. public bool EnableAutomaticRestart { get; set; }
  137. public bool SkipDeserializationForBasicTypes { get; set; }
  138. public string ServerName { get; set; }
  139. public string WanDdns { get; set; }
  140. public string UICulture { get; set; }
  141. public bool SaveMetadataHidden { get; set; }
  142. public NameValuePair[] ContentTypes { get; set; }
  143. public int RemoteClientBitrateLimit { get; set; }
  144. public int SharingExpirationDays { get; set; }
  145. public int SchemaVersion { get; set; }
  146. public bool EnableAnonymousUsageReporting { get; set; }
  147. public bool EnableFolderView { get; set; }
  148. public bool EnableGroupingIntoCollections { get; set; }
  149. public bool DisplaySpecialsWithinSeasons { get; set; }
  150. public bool DisplayCollectionsView { get; set; }
  151. public string[] LocalNetworkAddresses { get; set; }
  152. public string[] CodecsUsed { get; set; }
  153. public bool EnableChannelView { get; set; }
  154. public bool EnableExternalContentInSuggestions { get; set; }
  155. public int ImageExtractionTimeoutMs { get; set; }
  156. public PathSubstitution[] PathSubstitutions { get; set; }
  157. public bool EnableSimpleArtistDetection { get; set; }
  158. /// <summary>
  159. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
  160. /// </summary>
  161. public ServerConfiguration()
  162. {
  163. LocalNetworkAddresses = new string[] { };
  164. CodecsUsed = new string[] { };
  165. ImageExtractionTimeoutMs = 0;
  166. EnableLocalizedGuids = true;
  167. PathSubstitutions = new PathSubstitution[] { };
  168. EnableSimpleArtistDetection = 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. EnableCaseSensitiveItemIds = true;
  180. EnableAutomaticRestart = 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. DisabledImageFetchers = new [] {"FanArt"}
  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. DisabledImageFetchers = new [] { "FanArt" }
  457. },
  458. new MetadataOptions(0, 1280)
  459. {
  460. ItemType = "Episode",
  461. ImageOptions = new []
  462. {
  463. new ImageOption
  464. {
  465. Limit = 0,
  466. MinWidth = 1280,
  467. Type = ImageType.Backdrop
  468. },
  469. new ImageOption
  470. {
  471. Limit = 1,
  472. Type = ImageType.Primary
  473. }
  474. },
  475. DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" },
  476. DisabledImageFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
  477. }
  478. };
  479. }
  480. }
  481. public class PathSubstitution
  482. {
  483. public string From { get; set; }
  484. public string To { get; set; }
  485. }
  486. }