ServerConfiguration.cs 20 KB

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