ServerConfiguration.cs 14 KB

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