Game.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using MediaBrowser.Controller.Providers;
  2. using MediaBrowser.Model.Configuration;
  3. using MediaBrowser.Model.Entities;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. namespace MediaBrowser.Controller.Entities
  8. {
  9. public class Game : BaseItem, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, ISupportsPlaceHolders, IHasLookupInfo<GameInfo>
  10. {
  11. public List<Guid> ThemeSongIds { get; set; }
  12. public List<Guid> ThemeVideoIds { get; set; }
  13. public Game()
  14. {
  15. MultiPartGameFiles = new List<string>();
  16. RemoteTrailers = new List<MediaUrl>();
  17. LocalTrailerIds = new List<Guid>();
  18. RemoteTrailerIds = new List<Guid>();
  19. ThemeSongIds = new List<Guid>();
  20. ThemeVideoIds = new List<Guid>();
  21. }
  22. public List<Guid> LocalTrailerIds { get; set; }
  23. public List<Guid> RemoteTrailerIds { get; set; }
  24. public override bool CanDownload()
  25. {
  26. var locationType = LocationType;
  27. return locationType != LocationType.Remote &&
  28. locationType != LocationType.Virtual;
  29. }
  30. /// <summary>
  31. /// Gets or sets the remote trailers.
  32. /// </summary>
  33. /// <value>The remote trailers.</value>
  34. public List<MediaUrl> RemoteTrailers { get; set; }
  35. /// <summary>
  36. /// Gets the type of the media.
  37. /// </summary>
  38. /// <value>The type of the media.</value>
  39. public override string MediaType
  40. {
  41. get { return Model.Entities.MediaType.Game; }
  42. }
  43. /// <summary>
  44. /// Gets or sets the players supported.
  45. /// </summary>
  46. /// <value>The players supported.</value>
  47. public int? PlayersSupported { get; set; }
  48. /// <summary>
  49. /// Gets a value indicating whether this instance is place holder.
  50. /// </summary>
  51. /// <value><c>true</c> if this instance is place holder; otherwise, <c>false</c>.</value>
  52. public bool IsPlaceHolder { get; set; }
  53. /// <summary>
  54. /// Gets or sets the game system.
  55. /// </summary>
  56. /// <value>The game system.</value>
  57. public string GameSystem { get; set; }
  58. /// <summary>
  59. /// Gets or sets a value indicating whether this instance is multi part.
  60. /// </summary>
  61. /// <value><c>true</c> if this instance is multi part; otherwise, <c>false</c>.</value>
  62. public bool IsMultiPart { get; set; }
  63. /// <summary>
  64. /// Holds the paths to the game files in the event this is a multipart game
  65. /// </summary>
  66. public List<string> MultiPartGameFiles { get; set; }
  67. public override List<string> GetUserDataKeys()
  68. {
  69. var list = base.GetUserDataKeys();
  70. var id = this.GetProviderId(MetadataProviders.Gamesdb);
  71. if (!string.IsNullOrEmpty(id))
  72. {
  73. list.Insert(0, "Game-Gamesdb-" + id);
  74. }
  75. return list;
  76. }
  77. public override IEnumerable<string> GetDeletePaths()
  78. {
  79. if (!IsInMixedFolder)
  80. {
  81. return new[] { System.IO.Path.GetDirectoryName(Path) };
  82. }
  83. return base.GetDeletePaths();
  84. }
  85. public override UnratedItem GetBlockUnratedType()
  86. {
  87. return UnratedItem.Game;
  88. }
  89. public GameInfo GetLookupInfo()
  90. {
  91. var id = GetItemLookupInfo<GameInfo>();
  92. id.GameSystem = GameSystem;
  93. return id;
  94. }
  95. /// <summary>
  96. /// Gets the trailer ids.
  97. /// </summary>
  98. /// <returns>List&lt;Guid&gt;.</returns>
  99. public List<Guid> GetTrailerIds()
  100. {
  101. var list = LocalTrailerIds.ToList();
  102. list.AddRange(RemoteTrailerIds);
  103. return list;
  104. }
  105. }
  106. }