2
0

ServerConfiguration.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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. /// Gets or sets the minimum percentage of an item that must be played in order for playstate to be updated.
  76. /// </summary>
  77. /// <value>The min resume PCT.</value>
  78. public int MinResumePct { get; set; }
  79. /// <summary>
  80. /// 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.
  81. /// </summary>
  82. /// <value>The max resume PCT.</value>
  83. public int MaxResumePct { get; set; }
  84. /// <summary>
  85. /// Gets or sets the minimum duration that an item must have in order to be eligible for playstate updates..
  86. /// </summary>
  87. /// <value>The min resume duration seconds.</value>
  88. public int MinResumeDurationSeconds { get; set; }
  89. /// <summary>
  90. /// The delay in seconds that we will wait after a file system change to try and discover what has been added/removed
  91. /// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
  92. /// different directories and files.
  93. /// </summary>
  94. /// <value>The file watcher delay.</value>
  95. public int RealtimeMonitorDelay { get; set; }
  96. /// <summary>
  97. /// Gets or sets a value indicating whether [enable dashboard response caching].
  98. /// Allows potential contributors without visual studio to modify production dashboard code and test changes.
  99. /// </summary>
  100. /// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value>
  101. public bool EnableDashboardResponseCaching { get; set; }
  102. /// <summary>
  103. /// Allows the dashboard to be served from a custom path.
  104. /// </summary>
  105. /// <value>The dashboard source path.</value>
  106. public string DashboardSourcePath { get; set; }
  107. /// <summary>
  108. /// Gets or sets a value indicating whether [enable tv db updates].
  109. /// </summary>
  110. /// <value><c>true</c> if [enable tv db updates]; otherwise, <c>false</c>.</value>
  111. public bool EnableTvDbUpdates { get; set; }
  112. public bool EnableTmdbUpdates { get; set; }
  113. public bool EnableFanArtUpdates { get; set; }
  114. /// <summary>
  115. /// Gets or sets the image saving convention.
  116. /// </summary>
  117. /// <value>The image saving convention.</value>
  118. public ImageSavingConvention ImageSavingConvention { get; set; }
  119. /// <summary>
  120. /// Gets or sets a value indicating whether [enable people prefix sub folders].
  121. /// </summary>
  122. /// <value><c>true</c> if [enable people prefix sub folders]; otherwise, <c>false</c>.</value>
  123. public bool EnablePeoplePrefixSubFolders { get; set; }
  124. /// <summary>
  125. /// Gets or sets the encoding quality.
  126. /// </summary>
  127. /// <value>The encoding quality.</value>
  128. public EncodingQuality MediaEncodingQuality { get; set; }
  129. public MetadataOptions[] MetadataOptions { get; set; }
  130. public bool EnableDebugEncodingLogging { get; set; }
  131. public string TranscodingTempPath { get; set; }
  132. public bool EnableAutomaticRestart { get; set; }
  133. public bool EnableRealtimeMonitor { get; set; }
  134. public PathSubstitution[] PathSubstitutions { get; set; }
  135. public string ServerName { get; set; }
  136. public string WanDdns { get; set; }
  137. public string UICulture { get; set; }
  138. public double DownMixAudioBoost { get; set; }
  139. public PeopleMetadataOptions PeopleMetadataOptions { get; set; }
  140. public bool FindInternetTrailers { get; set; }
  141. public string[] InsecureApps6 { get; set; }
  142. public bool SaveMetadataHidden { get; set; }
  143. public bool PlaylistImagesDeleted { get; set; }
  144. /// <summary>
  145. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
  146. /// </summary>
  147. public ServerConfiguration()
  148. : base()
  149. {
  150. MediaEncodingQuality = EncodingQuality.Auto;
  151. ImageSavingConvention = ImageSavingConvention.Compatible;
  152. PublicPort = 8096;
  153. HttpServerPortNumber = 8096;
  154. EnableDashboardResponseCaching = true;
  155. EnableAutomaticRestart = true;
  156. EnablePeoplePrefixSubFolders = true;
  157. EnableUPnP = true;
  158. DownMixAudioBoost = 2;
  159. MinResumePct = 5;
  160. MaxResumePct = 90;
  161. // 5 minutes
  162. MinResumeDurationSeconds = 300;
  163. RealtimeMonitorDelay = 30;
  164. EnableInternetProviders = true;
  165. FindInternetTrailers = true;
  166. PathSubstitutions = new PathSubstitution[] { };
  167. PreferredMetadataLanguage = "en";
  168. MetadataCountryCode = "US";
  169. SortReplaceCharacters = new[] { ".", "+", "%" };
  170. SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" };
  171. SortRemoveWords = new[] { "the", "a", "an" };
  172. SeasonZeroDisplayName = "Specials";
  173. EnableRealtimeMonitor = true;
  174. UICulture = "en-us";
  175. PeopleMetadataOptions = new PeopleMetadataOptions();
  176. InsecureApps6 = new[]
  177. {
  178. "Roku",
  179. "Chromecast",
  180. "iOS",
  181. "Windows Phone",
  182. "Windows RT",
  183. "Xbmc",
  184. "Unknown app",
  185. "MediaPortal",
  186. "Media Portal",
  187. "iPad",
  188. "iPhone"
  189. };
  190. MetadataOptions = new[]
  191. {
  192. new MetadataOptions(1, 1280) {ItemType = "Book"},
  193. new MetadataOptions(1, 1280)
  194. {
  195. ItemType = "Movie",
  196. ImageOptions = new []
  197. {
  198. new ImageOption
  199. {
  200. Limit = 3,
  201. MinWidth = 1280,
  202. Type = ImageType.Backdrop
  203. },
  204. // Don't download this by default as it's rarely used.
  205. new ImageOption
  206. {
  207. Limit = 0,
  208. Type = ImageType.Art
  209. },
  210. // Don't download this by default as it's rarely used.
  211. new ImageOption
  212. {
  213. Limit = 0,
  214. Type = ImageType.Disc
  215. },
  216. new ImageOption
  217. {
  218. Limit = 1,
  219. Type = ImageType.Primary
  220. },
  221. new ImageOption
  222. {
  223. Limit = 1,
  224. Type = ImageType.Banner
  225. },
  226. new ImageOption
  227. {
  228. Limit = 1,
  229. Type = ImageType.Thumb
  230. },
  231. new ImageOption
  232. {
  233. Limit = 1,
  234. Type = ImageType.Logo
  235. }
  236. }
  237. },
  238. new MetadataOptions(1, 1280)
  239. {
  240. ItemType = "Series",
  241. ImageOptions = new []
  242. {
  243. new ImageOption
  244. {
  245. Limit = 2,
  246. MinWidth = 1280,
  247. Type = ImageType.Backdrop
  248. },
  249. // Don't download this by default as it's rarely used.
  250. new ImageOption
  251. {
  252. Limit = 0,
  253. Type = ImageType.Art
  254. },
  255. new ImageOption
  256. {
  257. Limit = 1,
  258. Type = ImageType.Primary
  259. },
  260. new ImageOption
  261. {
  262. Limit = 1,
  263. Type = ImageType.Banner
  264. },
  265. new ImageOption
  266. {
  267. Limit = 1,
  268. Type = ImageType.Thumb
  269. },
  270. new ImageOption
  271. {
  272. Limit = 1,
  273. Type = ImageType.Logo
  274. }
  275. }
  276. },
  277. new MetadataOptions(1, 1280)
  278. {
  279. ItemType = "MusicAlbum",
  280. ImageOptions = new []
  281. {
  282. new ImageOption
  283. {
  284. Limit = 1,
  285. MinWidth = 1280,
  286. Type = ImageType.Backdrop
  287. },
  288. // Don't download this by default as it's rarely used.
  289. new ImageOption
  290. {
  291. Limit = 0,
  292. Type = ImageType.Disc
  293. }
  294. }
  295. },
  296. new MetadataOptions(1, 1280)
  297. {
  298. ItemType = "MusicArtist",
  299. ImageOptions = new []
  300. {
  301. new ImageOption
  302. {
  303. Limit = 1,
  304. MinWidth = 1280,
  305. Type = ImageType.Backdrop
  306. },
  307. // Don't download this by default
  308. // They do look great, but most artists won't have them, which means a banner view isn't really possible
  309. new ImageOption
  310. {
  311. Limit = 0,
  312. Type = ImageType.Banner
  313. },
  314. // Don't download this by default
  315. // Generally not used
  316. new ImageOption
  317. {
  318. Limit = 0,
  319. Type = ImageType.Art
  320. }
  321. }
  322. },
  323. new MetadataOptions(0, 1280) {ItemType = "Season"}
  324. };
  325. }
  326. }
  327. }