ServerConfiguration.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  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 EnableStandaloneMusicKeys { get; set; }
  148. public bool EnableFolderView { get; set; }
  149. public bool EnableGroupingIntoCollections { get; set; }
  150. public bool DisplaySpecialsWithinSeasons { get; set; }
  151. public bool DisplayCollectionsView { get; set; }
  152. public string[] LocalNetworkAddresses { get; set; }
  153. public string[] CodecsUsed { get; set; }
  154. public bool EnableChannelView { get; set; }
  155. public bool EnableExternalContentInSuggestions { get; set; }
  156. public int ImageExtractionTimeoutMs { get; set; }
  157. public PathSubstitution[] PathSubstitutions { get; set; }
  158. public bool EnableSimpleArtistDetection { 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. ImageExtractionTimeoutMs = 0;
  167. EnableLocalizedGuids = true;
  168. PathSubstitutions = new PathSubstitution[] { };
  169. EnableSimpleArtistDetection = true;
  170. DisplaySpecialsWithinSeasons = true;
  171. EnableExternalContentInSuggestions = true;
  172. ImageSavingConvention = ImageSavingConvention.Compatible;
  173. PublicPort = DefaultHttpPort;
  174. PublicHttpsPort = DefaultHttpsPort;
  175. HttpServerPortNumber = DefaultHttpPort;
  176. HttpsPortNumber = DefaultHttpsPort;
  177. EnableHttps = false;
  178. EnableDashboardResponseCaching = true;
  179. EnableAnonymousUsageReporting = true;
  180. EnableCaseSensitiveItemIds = true;
  181. EnableAutomaticRestart = true;
  182. EnableUPnP = true;
  183. SharingExpirationDays = 30;
  184. MinResumePct = 5;
  185. MaxResumePct = 90;
  186. // 5 minutes
  187. MinResumeDurationSeconds = 300;
  188. LibraryMonitorDelay = 60;
  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. DisabledImageFetchers = new [] {"FanArt"}
  290. },
  291. new MetadataOptions(1, 1280)
  292. {
  293. ItemType = "Series",
  294. ImageOptions = new []
  295. {
  296. new ImageOption
  297. {
  298. Limit = 1,
  299. MinWidth = 1280,
  300. Type = ImageType.Backdrop
  301. },
  302. // Don't download this by default as it's rarely used.
  303. new ImageOption
  304. {
  305. Limit = 0,
  306. Type = ImageType.Art
  307. },
  308. new ImageOption
  309. {
  310. Limit = 1,
  311. Type = ImageType.Primary
  312. },
  313. new ImageOption
  314. {
  315. Limit = 1,
  316. Type = ImageType.Banner
  317. },
  318. new ImageOption
  319. {
  320. Limit = 1,
  321. Type = ImageType.Thumb
  322. },
  323. new ImageOption
  324. {
  325. Limit = 1,
  326. Type = ImageType.Logo
  327. }
  328. }
  329. },
  330. new MetadataOptions(1, 1280)
  331. {
  332. ItemType = "MusicAlbum",
  333. ImageOptions = new []
  334. {
  335. new ImageOption
  336. {
  337. Limit = 0,
  338. MinWidth = 1280,
  339. Type = ImageType.Backdrop
  340. },
  341. // Don't download this by default as it's rarely used.
  342. new ImageOption
  343. {
  344. Limit = 0,
  345. Type = ImageType.Disc
  346. }
  347. },
  348. DisabledMetadataFetchers = new []{ "TheAudioDB" }
  349. },
  350. new MetadataOptions(1, 1280)
  351. {
  352. ItemType = "MusicArtist",
  353. ImageOptions = new []
  354. {
  355. new ImageOption
  356. {
  357. Limit = 1,
  358. MinWidth = 1280,
  359. Type = ImageType.Backdrop
  360. },
  361. // Don't download this by default
  362. // They do look great, but most artists won't have them, which means a banner view isn't really possible
  363. new ImageOption
  364. {
  365. Limit = 0,
  366. Type = ImageType.Banner
  367. },
  368. // Don't download this by default
  369. // Generally not used
  370. new ImageOption
  371. {
  372. Limit = 0,
  373. Type = ImageType.Art
  374. },
  375. new ImageOption
  376. {
  377. Limit = 1,
  378. Type = ImageType.Logo
  379. }
  380. },
  381. DisabledMetadataFetchers = new []{ "TheAudioDB" }
  382. },
  383. new MetadataOptions(1, 1280)
  384. {
  385. ItemType = "BoxSet",
  386. ImageOptions = new []
  387. {
  388. new ImageOption
  389. {
  390. Limit = 1,
  391. MinWidth = 1280,
  392. Type = ImageType.Backdrop
  393. },
  394. new ImageOption
  395. {
  396. Limit = 1,
  397. Type = ImageType.Primary
  398. },
  399. new ImageOption
  400. {
  401. Limit = 1,
  402. Type = ImageType.Thumb
  403. },
  404. new ImageOption
  405. {
  406. Limit = 1,
  407. Type = ImageType.Logo
  408. },
  409. // Don't download this by default as it's rarely used.
  410. new ImageOption
  411. {
  412. Limit = 0,
  413. Type = ImageType.Art
  414. },
  415. // Don't download this by default as it's rarely used.
  416. new ImageOption
  417. {
  418. Limit = 0,
  419. Type = ImageType.Disc
  420. },
  421. // Don't download this by default as it's rarely used.
  422. new ImageOption
  423. {
  424. Limit = 0,
  425. Type = ImageType.Banner
  426. }
  427. }
  428. },
  429. new MetadataOptions(0, 1280)
  430. {
  431. ItemType = "Season",
  432. ImageOptions = new []
  433. {
  434. new ImageOption
  435. {
  436. Limit = 0,
  437. MinWidth = 1280,
  438. Type = ImageType.Backdrop
  439. },
  440. new ImageOption
  441. {
  442. Limit = 1,
  443. Type = ImageType.Primary
  444. },
  445. new ImageOption
  446. {
  447. Limit = 0,
  448. Type = ImageType.Banner
  449. },
  450. new ImageOption
  451. {
  452. Limit = 0,
  453. Type = ImageType.Thumb
  454. }
  455. },
  456. DisabledMetadataFetchers = new []{ "TheMovieDb" },
  457. DisabledImageFetchers = new [] { "FanArt" }
  458. },
  459. new MetadataOptions(0, 1280)
  460. {
  461. ItemType = "Episode",
  462. ImageOptions = new []
  463. {
  464. new ImageOption
  465. {
  466. Limit = 0,
  467. MinWidth = 1280,
  468. Type = ImageType.Backdrop
  469. },
  470. new ImageOption
  471. {
  472. Limit = 1,
  473. Type = ImageType.Primary
  474. }
  475. },
  476. DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" },
  477. DisabledImageFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
  478. }
  479. };
  480. }
  481. }
  482. public class PathSubstitution
  483. {
  484. public string From { get; set; }
  485. public string To { get; set; }
  486. }
  487. }