ServerConfiguration.cs 20 KB

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