ServerConfiguration.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  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. /// <summary>
  174. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
  175. /// </summary>
  176. public ServerConfiguration()
  177. : base()
  178. {
  179. ImageSavingConvention = ImageSavingConvention.Compatible;
  180. PublicPort = 8096;
  181. PublicHttpsPort = 8920;
  182. HttpServerPortNumber = 8096;
  183. HttpsPortNumber = 8920;
  184. EnableHttps = false;
  185. EnableDashboardResponseCaching = true;
  186. EnableDashboardResourceMinification = true;
  187. EnableAutomaticRestart = true;
  188. DenyIFrameEmbedding = true;
  189. EnableUPnP = true;
  190. SharingExpirationDays = 30;
  191. MinResumePct = 5;
  192. MaxResumePct = 90;
  193. // 5 minutes
  194. MinResumeDurationSeconds = 300;
  195. EnableLibraryMonitor = AutoOnOff.Auto;
  196. RealtimeLibraryMonitorDelay = 40;
  197. EnableInternetProviders = true;
  198. FindInternetTrailers = 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. InsecureApps9 = new[]
  210. {
  211. "Chromecast",
  212. "iOS",
  213. "Unknown app",
  214. "iPad",
  215. "iPhone",
  216. "Windows Phone"
  217. };
  218. MetadataOptions = new[]
  219. {
  220. new MetadataOptions(1, 1280) {ItemType = "Book"},
  221. new MetadataOptions(1, 1280)
  222. {
  223. ItemType = "Movie",
  224. ImageOptions = new []
  225. {
  226. new ImageOption
  227. {
  228. Limit = 1,
  229. MinWidth = 1280,
  230. Type = ImageType.Backdrop
  231. },
  232. // Don't download this by default as it's rarely used.
  233. new ImageOption
  234. {
  235. Limit = 0,
  236. Type = ImageType.Art
  237. },
  238. // Don't download this by default as it's rarely used.
  239. new ImageOption
  240. {
  241. Limit = 0,
  242. Type = ImageType.Disc
  243. },
  244. new ImageOption
  245. {
  246. Limit = 1,
  247. Type = ImageType.Primary
  248. },
  249. new ImageOption
  250. {
  251. Limit = 0,
  252. Type = ImageType.Banner
  253. },
  254. new ImageOption
  255. {
  256. Limit = 1,
  257. Type = ImageType.Thumb
  258. },
  259. new ImageOption
  260. {
  261. Limit = 1,
  262. Type = ImageType.Logo
  263. }
  264. }
  265. },
  266. new MetadataOptions(1, 1280)
  267. {
  268. ItemType = "MusicVideo",
  269. ImageOptions = new []
  270. {
  271. new ImageOption
  272. {
  273. Limit = 1,
  274. MinWidth = 1280,
  275. Type = ImageType.Backdrop
  276. },
  277. // Don't download this by default as it's rarely used.
  278. new ImageOption
  279. {
  280. Limit = 0,
  281. Type = ImageType.Art
  282. },
  283. // Don't download this by default as it's rarely used.
  284. new ImageOption
  285. {
  286. Limit = 0,
  287. Type = ImageType.Disc
  288. },
  289. new ImageOption
  290. {
  291. Limit = 1,
  292. Type = ImageType.Primary
  293. },
  294. new ImageOption
  295. {
  296. Limit = 0,
  297. Type = ImageType.Banner
  298. },
  299. new ImageOption
  300. {
  301. Limit = 1,
  302. Type = ImageType.Thumb
  303. },
  304. new ImageOption
  305. {
  306. Limit = 1,
  307. Type = ImageType.Logo
  308. }
  309. }
  310. },
  311. new MetadataOptions(1, 1280)
  312. {
  313. ItemType = "Series",
  314. ImageOptions = new []
  315. {
  316. new ImageOption
  317. {
  318. Limit = 1,
  319. MinWidth = 1280,
  320. Type = ImageType.Backdrop
  321. },
  322. // Don't download this by default as it's rarely used.
  323. new ImageOption
  324. {
  325. Limit = 0,
  326. Type = ImageType.Art
  327. },
  328. new ImageOption
  329. {
  330. Limit = 1,
  331. Type = ImageType.Primary
  332. },
  333. new ImageOption
  334. {
  335. Limit = 1,
  336. Type = ImageType.Banner
  337. },
  338. new ImageOption
  339. {
  340. Limit = 1,
  341. Type = ImageType.Thumb
  342. },
  343. new ImageOption
  344. {
  345. Limit = 1,
  346. Type = ImageType.Logo
  347. }
  348. }
  349. },
  350. new MetadataOptions(1, 1280)
  351. {
  352. ItemType = "MusicAlbum",
  353. ImageOptions = new []
  354. {
  355. new ImageOption
  356. {
  357. Limit = 0,
  358. MinWidth = 1280,
  359. Type = ImageType.Backdrop
  360. },
  361. // Don't download this by default as it's rarely used.
  362. new ImageOption
  363. {
  364. Limit = 0,
  365. Type = ImageType.Disc
  366. }
  367. }
  368. },
  369. new MetadataOptions(1, 1280)
  370. {
  371. ItemType = "MusicArtist",
  372. ImageOptions = new []
  373. {
  374. new ImageOption
  375. {
  376. Limit = 1,
  377. MinWidth = 1280,
  378. Type = ImageType.Backdrop
  379. },
  380. // Don't download this by default
  381. // They do look great, but most artists won't have them, which means a banner view isn't really possible
  382. new ImageOption
  383. {
  384. Limit = 0,
  385. Type = ImageType.Banner
  386. },
  387. // Don't download this by default
  388. // Generally not used
  389. new ImageOption
  390. {
  391. Limit = 0,
  392. Type = ImageType.Art
  393. },
  394. // Don't download this by default
  395. // Generally not used
  396. new ImageOption
  397. {
  398. Limit = 0,
  399. Type = ImageType.Logo
  400. }
  401. }
  402. },
  403. new MetadataOptions(1, 1280)
  404. {
  405. ItemType = "BoxSet",
  406. ImageOptions = new []
  407. {
  408. new ImageOption
  409. {
  410. Limit = 1,
  411. MinWidth = 1280,
  412. Type = ImageType.Backdrop
  413. },
  414. new ImageOption
  415. {
  416. Limit = 1,
  417. Type = ImageType.Primary
  418. },
  419. new ImageOption
  420. {
  421. Limit = 1,
  422. Type = ImageType.Thumb
  423. },
  424. new ImageOption
  425. {
  426. Limit = 1,
  427. Type = ImageType.Logo
  428. },
  429. // Don't download this by default as it's rarely used.
  430. new ImageOption
  431. {
  432. Limit = 0,
  433. Type = ImageType.Art
  434. },
  435. // Don't download this by default as it's rarely used.
  436. new ImageOption
  437. {
  438. Limit = 0,
  439. Type = ImageType.Disc
  440. },
  441. // Don't download this by default as it's rarely used.
  442. new ImageOption
  443. {
  444. Limit = 0,
  445. Type = ImageType.Banner
  446. }
  447. }
  448. },
  449. new MetadataOptions(0, 1280)
  450. {
  451. ItemType = "Season",
  452. ImageOptions = new []
  453. {
  454. new ImageOption
  455. {
  456. Limit = 0,
  457. MinWidth = 1280,
  458. Type = ImageType.Backdrop
  459. },
  460. new ImageOption
  461. {
  462. Limit = 1,
  463. Type = ImageType.Primary
  464. },
  465. new ImageOption
  466. {
  467. Limit = 0,
  468. Type = ImageType.Banner
  469. },
  470. new ImageOption
  471. {
  472. Limit = 0,
  473. Type = ImageType.Thumb
  474. }
  475. }
  476. }
  477. };
  478. }
  479. }
  480. }