ServerConfiguration.cs 13 KB

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