ServerConfiguration.cs 15 KB

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