ServerConfiguration.cs 21 KB

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