ServerConfiguration.cs 21 KB

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