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