ServerConfiguration.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  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 FindInternetTrailers { get; set; }
  148. public bool SaveMetadataHidden { get; set; }
  149. public NameValuePair[] ContentTypes { get; set; }
  150. public int RemoteClientBitrateLimit { get; set; }
  151. public AutoOnOff EnableLibraryMonitor { get; set; }
  152. public int SharingExpirationDays { get; set; }
  153. public string[] Migrations { get; set; }
  154. public int MigrationVersion { get; set; }
  155. public int SchemaVersion { get; set; }
  156. public int SqliteCacheSize { get; set; }
  157. public bool DownloadImagesInAdvance { get; set; }
  158. public bool EnableAnonymousUsageReporting { get; set; }
  159. public bool EnableStandaloneMusicKeys { get; set; }
  160. public bool EnableLocalizedGuids { get; set; }
  161. public bool EnableFolderView { get; set; }
  162. public bool EnableGroupingIntoCollections { get; set; }
  163. public bool DisplaySpecialsWithinSeasons { get; set; }
  164. public bool DisplayCollectionsView { get; set; }
  165. public string[] LocalNetworkAddresses { get; set; }
  166. public string[] CodecsUsed { get; set; }
  167. /// <summary>
  168. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
  169. /// </summary>
  170. public ServerConfiguration()
  171. {
  172. LocalNetworkAddresses = new string[] { };
  173. Migrations = new string[] { };
  174. CodecsUsed = new string[] { };
  175. SqliteCacheSize = 0;
  176. EnableLocalizedGuids = true;
  177. DisplaySpecialsWithinSeasons = true;
  178. ImageSavingConvention = ImageSavingConvention.Compatible;
  179. PublicPort = 8096;
  180. PublicHttpsPort = 8920;
  181. HttpServerPortNumber = 8096;
  182. HttpsPortNumber = 8920;
  183. EnableHttps = false;
  184. EnableDashboardResponseCaching = true;
  185. EnableDashboardResourceMinification = true;
  186. EnableAnonymousUsageReporting = true;
  187. EnableAutomaticRestart = true;
  188. EnableUPnP = true;
  189. SharingExpirationDays = 30;
  190. MinResumePct = 5;
  191. MaxResumePct = 90;
  192. // 5 minutes
  193. MinResumeDurationSeconds = 300;
  194. EnableLibraryMonitor = AutoOnOff.Auto;
  195. LibraryMonitorDelay = 60;
  196. EnableInternetProviders = true;
  197. FindInternetTrailers = true;
  198. PathSubstitutions = new PathSubstitution[] { };
  199. ContentTypes = new NameValuePair[] { };
  200. PreferredMetadataLanguage = "en";
  201. MetadataCountryCode = "US";
  202. SortReplaceCharacters = new[] { ".", "+", "%" };
  203. SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" };
  204. SortRemoveWords = new[] { "the", "a", "an" };
  205. SeasonZeroDisplayName = "Specials";
  206. UICulture = "en-us";
  207. PeopleMetadataOptions = new PeopleMetadataOptions();
  208. MetadataOptions = new[]
  209. {
  210. new MetadataOptions(1, 1280) {ItemType = "Book"},
  211. new MetadataOptions(1, 1280)
  212. {
  213. ItemType = "Movie",
  214. ImageOptions = new []
  215. {
  216. new ImageOption
  217. {
  218. Limit = 1,
  219. MinWidth = 1280,
  220. Type = ImageType.Backdrop
  221. },
  222. // Don't download this by default as it's rarely used.
  223. new ImageOption
  224. {
  225. Limit = 0,
  226. Type = ImageType.Art
  227. },
  228. // Don't download this by default as it's rarely used.
  229. new ImageOption
  230. {
  231. Limit = 0,
  232. Type = ImageType.Disc
  233. },
  234. new ImageOption
  235. {
  236. Limit = 1,
  237. Type = ImageType.Primary
  238. },
  239. new ImageOption
  240. {
  241. Limit = 0,
  242. Type = ImageType.Banner
  243. },
  244. new ImageOption
  245. {
  246. Limit = 1,
  247. Type = ImageType.Thumb
  248. },
  249. new ImageOption
  250. {
  251. Limit = 1,
  252. Type = ImageType.Logo
  253. }
  254. }
  255. },
  256. new MetadataOptions(1, 1280)
  257. {
  258. ItemType = "MusicVideo",
  259. ImageOptions = new []
  260. {
  261. new ImageOption
  262. {
  263. Limit = 1,
  264. MinWidth = 1280,
  265. Type = ImageType.Backdrop
  266. },
  267. // Don't download this by default as it's rarely used.
  268. new ImageOption
  269. {
  270. Limit = 0,
  271. Type = ImageType.Art
  272. },
  273. // Don't download this by default as it's rarely used.
  274. new ImageOption
  275. {
  276. Limit = 0,
  277. Type = ImageType.Disc
  278. },
  279. new ImageOption
  280. {
  281. Limit = 1,
  282. Type = ImageType.Primary
  283. },
  284. new ImageOption
  285. {
  286. Limit = 0,
  287. Type = ImageType.Banner
  288. },
  289. new ImageOption
  290. {
  291. Limit = 1,
  292. Type = ImageType.Thumb
  293. },
  294. new ImageOption
  295. {
  296. Limit = 1,
  297. Type = ImageType.Logo
  298. }
  299. }
  300. },
  301. new MetadataOptions(1, 1280)
  302. {
  303. ItemType = "Series",
  304. ImageOptions = new []
  305. {
  306. new ImageOption
  307. {
  308. Limit = 1,
  309. MinWidth = 1280,
  310. Type = ImageType.Backdrop
  311. },
  312. // Don't download this by default as it's rarely used.
  313. new ImageOption
  314. {
  315. Limit = 0,
  316. Type = ImageType.Art
  317. },
  318. new ImageOption
  319. {
  320. Limit = 1,
  321. Type = ImageType.Primary
  322. },
  323. new ImageOption
  324. {
  325. Limit = 1,
  326. Type = ImageType.Banner
  327. },
  328. new ImageOption
  329. {
  330. Limit = 1,
  331. Type = ImageType.Thumb
  332. },
  333. new ImageOption
  334. {
  335. Limit = 1,
  336. Type = ImageType.Logo
  337. }
  338. }
  339. },
  340. new MetadataOptions(1, 1280)
  341. {
  342. ItemType = "MusicAlbum",
  343. ImageOptions = new []
  344. {
  345. new ImageOption
  346. {
  347. Limit = 0,
  348. MinWidth = 1280,
  349. Type = ImageType.Backdrop
  350. },
  351. // Don't download this by default as it's rarely used.
  352. new ImageOption
  353. {
  354. Limit = 0,
  355. Type = ImageType.Disc
  356. }
  357. }
  358. },
  359. new MetadataOptions(1, 1280)
  360. {
  361. ItemType = "MusicArtist",
  362. ImageOptions = new []
  363. {
  364. new ImageOption
  365. {
  366. Limit = 1,
  367. MinWidth = 1280,
  368. Type = ImageType.Backdrop
  369. },
  370. // Don't download this by default
  371. // They do look great, but most artists won't have them, which means a banner view isn't really possible
  372. new ImageOption
  373. {
  374. Limit = 0,
  375. Type = ImageType.Banner
  376. },
  377. // Don't download this by default
  378. // Generally not used
  379. new ImageOption
  380. {
  381. Limit = 0,
  382. Type = ImageType.Art
  383. },
  384. // Don't download this by default
  385. // Generally not used
  386. new ImageOption
  387. {
  388. Limit = 0,
  389. Type = ImageType.Logo
  390. }
  391. }
  392. },
  393. new MetadataOptions(1, 1280)
  394. {
  395. ItemType = "BoxSet",
  396. ImageOptions = new []
  397. {
  398. new ImageOption
  399. {
  400. Limit = 1,
  401. MinWidth = 1280,
  402. Type = ImageType.Backdrop
  403. },
  404. new ImageOption
  405. {
  406. Limit = 1,
  407. Type = ImageType.Primary
  408. },
  409. new ImageOption
  410. {
  411. Limit = 1,
  412. Type = ImageType.Thumb
  413. },
  414. new ImageOption
  415. {
  416. Limit = 1,
  417. Type = ImageType.Logo
  418. },
  419. // Don't download this by default as it's rarely used.
  420. new ImageOption
  421. {
  422. Limit = 0,
  423. Type = ImageType.Art
  424. },
  425. // Don't download this by default as it's rarely used.
  426. new ImageOption
  427. {
  428. Limit = 0,
  429. Type = ImageType.Disc
  430. },
  431. // Don't download this by default as it's rarely used.
  432. new ImageOption
  433. {
  434. Limit = 0,
  435. Type = ImageType.Banner
  436. }
  437. }
  438. },
  439. new MetadataOptions(0, 1280)
  440. {
  441. ItemType = "Season",
  442. ImageOptions = new []
  443. {
  444. new ImageOption
  445. {
  446. Limit = 0,
  447. MinWidth = 1280,
  448. Type = ImageType.Backdrop
  449. },
  450. new ImageOption
  451. {
  452. Limit = 1,
  453. Type = ImageType.Primary
  454. },
  455. new ImageOption
  456. {
  457. Limit = 0,
  458. Type = ImageType.Banner
  459. },
  460. new ImageOption
  461. {
  462. Limit = 0,
  463. Type = ImageType.Thumb
  464. }
  465. },
  466. DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
  467. },
  468. new MetadataOptions(0, 1280)
  469. {
  470. ItemType = "Episode",
  471. ImageOptions = new []
  472. {
  473. new ImageOption
  474. {
  475. Limit = 0,
  476. MinWidth = 1280,
  477. Type = ImageType.Backdrop
  478. },
  479. new ImageOption
  480. {
  481. Limit = 1,
  482. Type = ImageType.Primary
  483. }
  484. },
  485. DisabledMetadataFetchers = new []{ "The Open Movie Database" },
  486. DisabledImageFetchers = new []{ "TheMovieDb" }
  487. }
  488. };
  489. }
  490. }
  491. }