ServerConfiguration.cs 14 KB

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