ServerConfiguration.cs 13 KB

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