Game.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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, 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. ThemeSongIds = new List<Guid>();
  27. ThemeVideoIds = new List<Guid>();
  28. Tags = new List<string>();
  29. }
  30. public List<Guid> LocalTrailerIds { get; set; }
  31. /// <summary>
  32. /// Gets or sets the tags.
  33. /// </summary>
  34. /// <value>The tags.</value>
  35. public List<string> Tags { get; set; }
  36. /// <summary>
  37. /// Gets or sets the remote trailers.
  38. /// </summary>
  39. /// <value>The remote trailers.</value>
  40. public List<MediaUrl> RemoteTrailers { get; set; }
  41. /// <summary>
  42. /// Gets the type of the media.
  43. /// </summary>
  44. /// <value>The type of the media.</value>
  45. public override string MediaType
  46. {
  47. get { return Model.Entities.MediaType.Game; }
  48. }
  49. /// <summary>
  50. /// Gets or sets the players supported.
  51. /// </summary>
  52. /// <value>The players supported.</value>
  53. public int? PlayersSupported { get; set; }
  54. /// <summary>
  55. /// Gets or sets a value indicating whether this instance is installed on client.
  56. /// </summary>
  57. /// <value><c>true</c> if this instance is installed on client; otherwise, <c>false</c>.</value>
  58. public bool IsInstalledOnClient { get; set; }
  59. /// <summary>
  60. /// Gets or sets the game system.
  61. /// </summary>
  62. /// <value>The game system.</value>
  63. public string GameSystem { get; set; }
  64. /// <summary>
  65. /// Gets or sets a value indicating whether this instance is multi part.
  66. /// </summary>
  67. /// <value><c>true</c> if this instance is multi part; otherwise, <c>false</c>.</value>
  68. public bool IsMultiPart { get; set; }
  69. /// <summary>
  70. /// Holds the paths to the game files in the event this is a multipart game
  71. /// </summary>
  72. public List<string> MultiPartGameFiles { get; set; }
  73. public override string GetUserDataKey()
  74. {
  75. var id = this.GetProviderId(MetadataProviders.Gamesdb);
  76. if (!string.IsNullOrEmpty(id))
  77. {
  78. return "Game-Gamesdb-" + id;
  79. }
  80. return base.GetUserDataKey();
  81. }
  82. public override IEnumerable<string> GetDeletePaths()
  83. {
  84. if (!IsInMixedFolder)
  85. {
  86. return new[] { System.IO.Path.GetDirectoryName(Path) };
  87. }
  88. return base.GetDeletePaths();
  89. }
  90. protected override bool GetBlockUnratedValue(UserConfiguration config)
  91. {
  92. return config.BlockUnratedItems.Contains(UnratedItem.Game);
  93. }
  94. public GameInfo GetLookupInfo()
  95. {
  96. var id = GetItemLookupInfo<GameInfo>();
  97. id.GameSystem = GameSystem;
  98. return id;
  99. }
  100. }
  101. }