ServerConfiguration.cs 21 KB

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