ClientCapabilitiesDto.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System.Collections.Generic;
  2. using System.Text.Json.Serialization;
  3. using Jellyfin.Data.Enums;
  4. using Jellyfin.Extensions.Json.Converters;
  5. using MediaBrowser.Model.Dlna;
  6. using MediaBrowser.Model.Session;
  7. namespace MediaBrowser.Model.Dto;
  8. /// <summary>
  9. /// Client capabilities dto.
  10. /// </summary>
  11. public class ClientCapabilitiesDto
  12. {
  13. /// <summary>
  14. /// Gets or sets the list of playable media types.
  15. /// </summary>
  16. [JsonConverter(typeof(JsonCommaDelimitedCollectionConverterFactory))]
  17. public IReadOnlyList<MediaType> PlayableMediaTypes { get; set; } = [];
  18. /// <summary>
  19. /// Gets or sets the list of supported commands.
  20. /// </summary>
  21. [JsonConverter(typeof(JsonCommaDelimitedCollectionConverterFactory))]
  22. public IReadOnlyList<GeneralCommandType> SupportedCommands { get; set; } = [];
  23. /// <summary>
  24. /// Gets or sets a value indicating whether session supports media control.
  25. /// </summary>
  26. public bool SupportsMediaControl { get; set; }
  27. /// <summary>
  28. /// Gets or sets a value indicating whether session supports a persistent identifier.
  29. /// </summary>
  30. public bool SupportsPersistentIdentifier { get; set; }
  31. /// <summary>
  32. /// Gets or sets the device profile.
  33. /// </summary>
  34. public DeviceProfile? DeviceProfile { get; set; }
  35. /// <summary>
  36. /// Gets or sets the app store url.
  37. /// </summary>
  38. public string? AppStoreUrl { get; set; }
  39. /// <summary>
  40. /// Gets or sets the icon url.
  41. /// </summary>
  42. public string? IconUrl { get; set; }
  43. /// <summary>
  44. /// Convert the dto to the full <see cref="ClientCapabilities"/> model.
  45. /// </summary>
  46. /// <returns>The converted <see cref="ClientCapabilities"/> model.</returns>
  47. public ClientCapabilities ToClientCapabilities()
  48. {
  49. return new ClientCapabilities
  50. {
  51. PlayableMediaTypes = PlayableMediaTypes,
  52. SupportedCommands = SupportedCommands,
  53. SupportsMediaControl = SupportsMediaControl,
  54. SupportsPersistentIdentifier = SupportsPersistentIdentifier,
  55. DeviceProfile = DeviceProfile,
  56. AppStoreUrl = AppStoreUrl,
  57. IconUrl = IconUrl
  58. };
  59. }
  60. }