ServerConfiguration.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. using MediaBrowser.Model.Entities;
  2. namespace MediaBrowser.Model.Configuration
  3. {
  4. /// <summary>
  5. /// Represents the server configuration.
  6. /// </summary>
  7. public class ServerConfiguration : BaseApplicationConfiguration
  8. {
  9. /// <summary>
  10. /// Gets or sets a value indicating whether [enable u pn p].
  11. /// </summary>
  12. /// <value><c>true</c> if [enable u pn p]; otherwise, <c>false</c>.</value>
  13. public bool EnableUPnP { get; set; }
  14. /// <summary>
  15. /// Gets or sets the public mapped port.
  16. /// </summary>
  17. /// <value>The public mapped port.</value>
  18. public int PublicPort { get; set; }
  19. /// <summary>
  20. /// Gets or sets the HTTP server port number.
  21. /// </summary>
  22. /// <value>The HTTP server port number.</value>
  23. public int HttpServerPortNumber { get; set; }
  24. /// <summary>
  25. /// Gets or sets a value indicating whether [enable internet providers].
  26. /// </summary>
  27. /// <value><c>true</c> if [enable internet providers]; otherwise, <c>false</c>.</value>
  28. public bool EnableInternetProviders { get; set; }
  29. /// <summary>
  30. /// Gets or sets the item by name path.
  31. /// </summary>
  32. /// <value>The item by name path.</value>
  33. public string ItemsByNamePath { get; set; }
  34. /// <summary>
  35. /// Gets or sets the metadata path.
  36. /// </summary>
  37. /// <value>The metadata path.</value>
  38. public string MetadataPath { get; set; }
  39. /// <summary>
  40. /// Gets or sets the display name of the season zero.
  41. /// </summary>
  42. /// <value>The display name of the season zero.</value>
  43. public string SeasonZeroDisplayName { get; set; }
  44. /// <summary>
  45. /// Gets or sets a value indicating whether [save local meta].
  46. /// </summary>
  47. /// <value><c>true</c> if [save local meta]; otherwise, <c>false</c>.</value>
  48. public bool SaveLocalMeta { get; set; }
  49. /// <summary>
  50. /// Gets or sets the preferred metadata language.
  51. /// </summary>
  52. /// <value>The preferred metadata language.</value>
  53. public string PreferredMetadataLanguage { get; set; }
  54. /// <summary>
  55. /// Gets or sets the metadata country code.
  56. /// </summary>
  57. /// <value>The metadata country code.</value>
  58. public string MetadataCountryCode { get; set; }
  59. /// <summary>
  60. /// Characters to be replaced with a ' ' in strings to create a sort name
  61. /// </summary>
  62. /// <value>The sort replace characters.</value>
  63. public string[] SortReplaceCharacters { get; set; }
  64. /// <summary>
  65. /// Characters to be removed from strings to create a sort name
  66. /// </summary>
  67. /// <value>The sort remove characters.</value>
  68. public string[] SortRemoveCharacters { get; set; }
  69. /// <summary>
  70. /// Words to be removed from strings to create a sort name
  71. /// </summary>
  72. /// <value>The sort remove words.</value>
  73. public string[] SortRemoveWords { get; set; }
  74. /// <summary>
  75. /// Show an output log window for debugging
  76. /// </summary>
  77. /// <value><c>true</c> if [show log window]; otherwise, <c>false</c>.</value>
  78. public bool ShowLogWindow { get; set; }
  79. /// <summary>
  80. /// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated.
  81. /// </summary>
  82. /// <value>The min resume PCT.</value>
  83. public int MinResumePct { get; set; }
  84. /// <summary>
  85. /// 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.
  86. /// </summary>
  87. /// <value>The max resume PCT.</value>
  88. public int MaxResumePct { get; set; }
  89. /// <summary>
  90. /// Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates..
  91. /// </summary>
  92. /// <value>The min resume duration seconds.</value>
  93. public int MinResumeDurationSeconds { get; set; }
  94. /// <summary>
  95. /// The delay in seconds that we will wait after a file system change to try and discover what has been added/removed
  96. /// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
  97. /// different directories and files.
  98. /// </summary>
  99. /// <value>The file watcher delay.</value>
  100. public int RealtimeMonitorDelay { get; set; }
  101. /// <summary>
  102. /// Gets or sets a value indicating whether [enable dashboard response caching].
  103. /// Allows potential contributors without visual studio to modify production dashboard code and test changes.
  104. /// </summary>
  105. /// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value>
  106. public bool EnableDashboardResponseCaching { get; set; }
  107. /// <summary>
  108. /// Allows the dashboard to be served from a custom path.
  109. /// </summary>
  110. /// <value>The dashboard source path.</value>
  111. public string DashboardSourcePath { get; set; }
  112. /// <summary>
  113. /// Gets or sets a value indicating whether [enable tv db updates].
  114. /// </summary>
  115. /// <value><c>true</c> if [enable tv db updates]; otherwise, <c>false</c>.</value>
  116. public bool EnableTvDbUpdates { get; set; }
  117. public bool EnableTmdbUpdates { get; set; }
  118. public bool EnableFanArtUpdates { get; set; }
  119. /// <summary>
  120. /// Gets or sets the image saving convention.
  121. /// </summary>
  122. /// <value>The image saving convention.</value>
  123. public ImageSavingConvention ImageSavingConvention { get; set; }
  124. /// <summary>
  125. /// Gets or sets a value indicating whether [enable people prefix sub folders].
  126. /// </summary>
  127. /// <value><c>true</c> if [enable people prefix sub folders]; otherwise, <c>false</c>.</value>
  128. public bool EnablePeoplePrefixSubFolders { get; set; }
  129. /// <summary>
  130. /// Gets or sets the encoding quality.
  131. /// </summary>
  132. /// <value>The encoding quality.</value>
  133. public EncodingQuality MediaEncodingQuality { get; set; }
  134. public MetadataOptions[] MetadataOptions { get; set; }
  135. public bool EnableDebugEncodingLogging { get; set; }
  136. public string TranscodingTempPath { get; set; }
  137. public bool EnableAutomaticRestart { get; set; }
  138. public bool EnableRealtimeMonitor { get; set; }
  139. public PathSubstitution[] PathSubstitutions { get; set; }
  140. public string ServerName { get; set; }
  141. public string WanDdns { get; set; }
  142. public string UICulture { get; set; }
  143. public double DownMixAudioBoost { get; set; }
  144. public PeopleMetadataOptions PeopleMetadataOptions { get; set; }
  145. public bool FindInternetTrailers { get; set; }
  146. public string[] InsecureApps2 { get; set; }
  147. public bool SaveMetadataHidden { get; set; }
  148. /// <summary>
  149. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
  150. /// </summary>
  151. public ServerConfiguration()
  152. : base()
  153. {
  154. MediaEncodingQuality = EncodingQuality.Auto;
  155. ImageSavingConvention = ImageSavingConvention.Compatible;
  156. PublicPort = 8096;
  157. HttpServerPortNumber = 8096;
  158. EnableDashboardResponseCaching = true;
  159. EnableAutomaticRestart = true;
  160. EnablePeoplePrefixSubFolders = true;
  161. EnableUPnP = true;
  162. DownMixAudioBoost = 2;
  163. MinResumePct = 5;
  164. MaxResumePct = 90;
  165. // 5 minutes
  166. MinResumeDurationSeconds = 300;
  167. RealtimeMonitorDelay = 30;
  168. EnableInternetProviders = true;
  169. FindInternetTrailers = true;
  170. PathSubstitutions = new PathSubstitution[] { };
  171. PreferredMetadataLanguage = "en";
  172. MetadataCountryCode = "US";
  173. SortReplaceCharacters = new[] { ".", "+", "%" };
  174. SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" };
  175. SortRemoveWords = new[] { "the", "a", "an" };
  176. SeasonZeroDisplayName = "Specials";
  177. EnableRealtimeMonitor = true;
  178. UICulture = "en-us";
  179. PeopleMetadataOptions = new PeopleMetadataOptions();
  180. InsecureApps2 = new[]
  181. {
  182. "Roku",
  183. "Chromecast",
  184. "iOS",
  185. "Windows Phone"
  186. };
  187. MetadataOptions = new[]
  188. {
  189. new MetadataOptions(1, 1280) {ItemType = "Book"},
  190. new MetadataOptions(1, 1280)
  191. {
  192. ItemType = "Movie",
  193. ImageOptions = new []
  194. {
  195. new ImageOption
  196. {
  197. Limit = 3,
  198. MinWidth = 1280,
  199. Type = ImageType.Backdrop
  200. },
  201. // Don't download this by default as it's rarely used.
  202. new ImageOption
  203. {
  204. Limit = 0,
  205. Type = ImageType.Art
  206. },
  207. // Don't download this by default as it's rarely used.
  208. new ImageOption
  209. {
  210. Limit = 0,
  211. Type = ImageType.Disc
  212. },
  213. new ImageOption
  214. {
  215. Limit = 1,
  216. Type = ImageType.Primary
  217. },
  218. new ImageOption
  219. {
  220. Limit = 1,
  221. Type = ImageType.Banner
  222. },
  223. new ImageOption
  224. {
  225. Limit = 1,
  226. Type = ImageType.Thumb
  227. },
  228. new ImageOption
  229. {
  230. Limit = 1,
  231. Type = ImageType.Logo
  232. }
  233. }
  234. },
  235. new MetadataOptions(1, 1280)
  236. {
  237. ItemType = "Series",
  238. ImageOptions = new []
  239. {
  240. new ImageOption
  241. {
  242. Limit = 2,
  243. MinWidth = 1280,
  244. Type = ImageType.Backdrop
  245. },
  246. // Don't download this by default as it's rarely used.
  247. new ImageOption
  248. {
  249. Limit = 0,
  250. Type = ImageType.Art
  251. },
  252. new ImageOption
  253. {
  254. Limit = 1,
  255. Type = ImageType.Primary
  256. },
  257. new ImageOption
  258. {
  259. Limit = 1,
  260. Type = ImageType.Banner
  261. },
  262. new ImageOption
  263. {
  264. Limit = 1,
  265. Type = ImageType.Thumb
  266. },
  267. new ImageOption
  268. {
  269. Limit = 1,
  270. Type = ImageType.Logo
  271. }
  272. }
  273. },
  274. new MetadataOptions(1, 1280)
  275. {
  276. ItemType = "MusicAlbum",
  277. ImageOptions = new []
  278. {
  279. new ImageOption
  280. {
  281. Limit = 1,
  282. MinWidth = 1280,
  283. Type = ImageType.Backdrop
  284. },
  285. // Don't download this by default as it's rarely used.
  286. new ImageOption
  287. {
  288. Limit = 0,
  289. Type = ImageType.Disc
  290. }
  291. }
  292. },
  293. new MetadataOptions(1, 1280)
  294. {
  295. ItemType = "MusicArtist",
  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
  305. // They do look great, but most artists won't have them, which means a banner view isn't really possible
  306. new ImageOption
  307. {
  308. Limit = 0,
  309. Type = ImageType.Banner
  310. },
  311. // Don't download this by default
  312. // Generally not used
  313. new ImageOption
  314. {
  315. Limit = 0,
  316. Type = ImageType.Art
  317. }
  318. }
  319. },
  320. new MetadataOptions(0, 1280) {ItemType = "Season"}
  321. };
  322. }
  323. }
  324. }