ServerConfiguration.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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[] InsecureApps6 { get; set; }
  147. public bool SaveMetadataHidden { get; set; }
  148. public bool PlaylistImagesDeleted { get; set; }
  149. /// <summary>
  150. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
  151. /// </summary>
  152. public ServerConfiguration()
  153. : base()
  154. {
  155. MediaEncodingQuality = EncodingQuality.Auto;
  156. ImageSavingConvention = ImageSavingConvention.Compatible;
  157. PublicPort = 8096;
  158. HttpServerPortNumber = 8096;
  159. EnableDashboardResponseCaching = true;
  160. EnableAutomaticRestart = true;
  161. EnablePeoplePrefixSubFolders = true;
  162. EnableUPnP = true;
  163. DownMixAudioBoost = 2;
  164. MinResumePct = 5;
  165. MaxResumePct = 90;
  166. // 5 minutes
  167. MinResumeDurationSeconds = 300;
  168. RealtimeMonitorDelay = 30;
  169. EnableInternetProviders = true;
  170. FindInternetTrailers = true;
  171. PathSubstitutions = new PathSubstitution[] { };
  172. PreferredMetadataLanguage = "en";
  173. MetadataCountryCode = "US";
  174. SortReplaceCharacters = new[] { ".", "+", "%" };
  175. SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" };
  176. SortRemoveWords = new[] { "the", "a", "an" };
  177. SeasonZeroDisplayName = "Specials";
  178. EnableRealtimeMonitor = true;
  179. UICulture = "en-us";
  180. PeopleMetadataOptions = new PeopleMetadataOptions();
  181. InsecureApps6 = new[]
  182. {
  183. "Roku",
  184. "Chromecast",
  185. "iOS",
  186. "Windows Phone",
  187. "Windows RT",
  188. "Xbmc",
  189. "Unknown app",
  190. "MediaPortal",
  191. "Media Portal",
  192. "iPad",
  193. "iPhone"
  194. };
  195. MetadataOptions = new[]
  196. {
  197. new MetadataOptions(1, 1280) {ItemType = "Book"},
  198. new MetadataOptions(1, 1280)
  199. {
  200. ItemType = "Movie",
  201. ImageOptions = new []
  202. {
  203. new ImageOption
  204. {
  205. Limit = 3,
  206. MinWidth = 1280,
  207. Type = ImageType.Backdrop
  208. },
  209. // Don't download this by default as it's rarely used.
  210. new ImageOption
  211. {
  212. Limit = 0,
  213. Type = ImageType.Art
  214. },
  215. // Don't download this by default as it's rarely used.
  216. new ImageOption
  217. {
  218. Limit = 0,
  219. Type = ImageType.Disc
  220. },
  221. new ImageOption
  222. {
  223. Limit = 1,
  224. Type = ImageType.Primary
  225. },
  226. new ImageOption
  227. {
  228. Limit = 1,
  229. Type = ImageType.Banner
  230. },
  231. new ImageOption
  232. {
  233. Limit = 1,
  234. Type = ImageType.Thumb
  235. },
  236. new ImageOption
  237. {
  238. Limit = 1,
  239. Type = ImageType.Logo
  240. }
  241. }
  242. },
  243. new MetadataOptions(1, 1280)
  244. {
  245. ItemType = "Series",
  246. ImageOptions = new []
  247. {
  248. new ImageOption
  249. {
  250. Limit = 2,
  251. MinWidth = 1280,
  252. Type = ImageType.Backdrop
  253. },
  254. // Don't download this by default as it's rarely used.
  255. new ImageOption
  256. {
  257. Limit = 0,
  258. Type = ImageType.Art
  259. },
  260. new ImageOption
  261. {
  262. Limit = 1,
  263. Type = ImageType.Primary
  264. },
  265. new ImageOption
  266. {
  267. Limit = 1,
  268. Type = ImageType.Banner
  269. },
  270. new ImageOption
  271. {
  272. Limit = 1,
  273. Type = ImageType.Thumb
  274. },
  275. new ImageOption
  276. {
  277. Limit = 1,
  278. Type = ImageType.Logo
  279. }
  280. }
  281. },
  282. new MetadataOptions(1, 1280)
  283. {
  284. ItemType = "MusicAlbum",
  285. ImageOptions = new []
  286. {
  287. new ImageOption
  288. {
  289. Limit = 1,
  290. MinWidth = 1280,
  291. Type = ImageType.Backdrop
  292. },
  293. // Don't download this by default as it's rarely used.
  294. new ImageOption
  295. {
  296. Limit = 0,
  297. Type = ImageType.Disc
  298. }
  299. }
  300. },
  301. new MetadataOptions(1, 1280)
  302. {
  303. ItemType = "MusicArtist",
  304. ImageOptions = new []
  305. {
  306. new ImageOption
  307. {
  308. Limit = 1,
  309. MinWidth = 1280,
  310. Type = ImageType.Backdrop
  311. },
  312. // Don't download this by default
  313. // They do look great, but most artists won't have them, which means a banner view isn't really possible
  314. new ImageOption
  315. {
  316. Limit = 0,
  317. Type = ImageType.Banner
  318. },
  319. // Don't download this by default
  320. // Generally not used
  321. new ImageOption
  322. {
  323. Limit = 0,
  324. Type = ImageType.Art
  325. }
  326. }
  327. },
  328. new MetadataOptions(0, 1280) {ItemType = "Season"}
  329. };
  330. }
  331. }
  332. }