ServerConfiguration.cs 20 KB

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