ServerConfiguration.cs 20 KB

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