ServerConfiguration.cs 20 KB

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