Game.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, ISupportsPlaceHolders, IHasPreferredMetadataLanguage, IHasLookupInfo<GameInfo>
  10. {
  11. public List<Guid> SoundtrackIds { get; set; }
  12. public List<Guid> ThemeSongIds { get; set; }
  13. public List<Guid> ThemeVideoIds { get; set; }
  14. public string PreferredMetadataLanguage { get; set; }
  15. /// <summary>
  16. /// Gets or sets the preferred metadata country code.
  17. /// </summary>
  18. /// <value>The preferred metadata country code.</value>
  19. public string PreferredMetadataCountryCode { get; set; }
  20. public Game()
  21. {
  22. MultiPartGameFiles = new List<string>();
  23. SoundtrackIds = new List<Guid>();
  24. RemoteTrailers = new List<MediaUrl>();
  25. LocalTrailerIds = new List<Guid>();
  26. RemoteTrailerIds = new List<Guid>();
  27. ThemeSongIds = new List<Guid>();
  28. ThemeVideoIds = new List<Guid>();
  29. Tags = new List<string>();
  30. }
  31. public List<Guid> LocalTrailerIds { get; set; }
  32. public List<Guid> RemoteTrailerIds { get; set; }
  33. /// <summary>
  34. /// Gets or sets the tags.
  35. /// </summary>
  36. /// <value>The tags.</value>
  37. public List<string> Tags { get; set; }
  38. /// <summary>
  39. /// Gets or sets the remote trailers.
  40. /// </summary>
  41. /// <value>The remote trailers.</value>
  42. public List<MediaUrl> RemoteTrailers { get; set; }
  43. /// <summary>
  44. /// Gets the type of the media.
  45. /// </summary>
  46. /// <value>The type of the media.</value>
  47. public override string MediaType
  48. {
  49. get { return Model.Entities.MediaType.Game; }
  50. }
  51. /// <summary>
  52. /// Gets or sets the players supported.
  53. /// </summary>
  54. /// <value>The players supported.</value>
  55. public int? PlayersSupported { get; set; }
  56. /// <summary>
  57. /// Gets a value indicating whether this instance is place holder.
  58. /// </summary>
  59. /// <value><c>true</c> if this instance is place holder; otherwise, <c>false</c>.</value>
  60. public bool IsPlaceHolder { get; set; }
  61. /// <summary>
  62. /// Gets or sets the game system.
  63. /// </summary>
  64. /// <value>The game system.</value>
  65. public string GameSystem { get; set; }
  66. /// <summary>
  67. /// Gets or sets a value indicating whether this instance is multi part.
  68. /// </summary>
  69. /// <value><c>true</c> if this instance is multi part; otherwise, <c>false</c>.</value>
  70. public bool IsMultiPart { get; set; }
  71. /// <summary>
  72. /// Holds the paths to the game files in the event this is a multipart game
  73. /// </summary>
  74. public List<string> MultiPartGameFiles { get; set; }
  75. public override string GetUserDataKey()
  76. {
  77. var id = this.GetProviderId(MetadataProviders.Gamesdb);
  78. if (!string.IsNullOrEmpty(id))
  79. {
  80. return "Game-Gamesdb-" + id;
  81. }
  82. return base.GetUserDataKey();
  83. }
  84. public override IEnumerable<string> GetDeletePaths()
  85. {
  86. if (!IsInMixedFolder)
  87. {
  88. return new[] { System.IO.Path.GetDirectoryName(Path) };
  89. }
  90. return base.GetDeletePaths();
  91. }
  92. protected override bool GetBlockUnratedValue(UserConfiguration config)
  93. {
  94. return config.BlockUnratedItems.Contains(UnratedItem.Game);
  95. }
  96. public GameInfo GetLookupInfo()
  97. {
  98. var id = GetItemLookupInfo<GameInfo>();
  99. id.GameSystem = GameSystem;
  100. return id;
  101. }
  102. /// <summary>
  103. /// Gets the trailer ids.
  104. /// </summary>
  105. /// <returns>List&lt;Guid&gt;.</returns>
  106. public List<Guid> GetTrailerIds()
  107. {
  108. var list = LocalTrailerIds.ToList();
  109. list.AddRange(RemoteTrailerIds);
  110. return list;
  111. }
  112. }
  113. }