ServerConfiguration.cs 20 KB

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