ClientCapabilitiesDto.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Text.Json.Serialization;
  5. using Jellyfin.Data.Enums;
  6. using Jellyfin.Extensions.Json.Converters;
  7. using MediaBrowser.Model.Dlna;
  8. using MediaBrowser.Model.Session;
  9. namespace Jellyfin.Api.Models.SessionDtos;
  10. /// <summary>
  11. /// Client capabilities dto.
  12. /// </summary>
  13. public class ClientCapabilitiesDto
  14. {
  15. /// <summary>
  16. /// Gets or sets the list of playable media types.
  17. /// </summary>
  18. [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
  19. public IReadOnlyList<MediaType> PlayableMediaTypes { get; set; } = Array.Empty<MediaType>();
  20. /// <summary>
  21. /// Gets or sets the list of supported commands.
  22. /// </summary>
  23. [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
  24. public IReadOnlyList<GeneralCommandType> SupportedCommands { get; set; } = Array.Empty<GeneralCommandType>();
  25. /// <summary>
  26. /// Gets or sets a value indicating whether session supports media control.
  27. /// </summary>
  28. public bool SupportsMediaControl { get; set; }
  29. /// <summary>
  30. /// Gets or sets a value indicating whether session supports a persistent identifier.
  31. /// </summary>
  32. public bool SupportsPersistentIdentifier { get; set; }
  33. /// <summary>
  34. /// Gets or sets the device profile.
  35. /// </summary>
  36. public DeviceProfile? DeviceProfile { get; set; }
  37. /// <summary>
  38. /// Gets or sets the app store url.
  39. /// </summary>
  40. public string? AppStoreUrl { get; set; }
  41. /// <summary>
  42. /// Gets or sets the icon url.
  43. /// </summary>
  44. public string? IconUrl { get; set; }
  45. #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
  46. // TODO: Remove after 10.9
  47. [Obsolete("Unused")]
  48. [DefaultValue(false)]
  49. public bool? SupportsContentUploading { get; set; } = false;
  50. // TODO: Remove after 10.9
  51. [Obsolete("Unused")]
  52. [DefaultValue(false)]
  53. public bool? SupportsSync { get; set; } = false;
  54. #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
  55. /// <summary>
  56. /// Convert the dto to the full <see cref="ClientCapabilities"/> model.
  57. /// </summary>
  58. /// <returns>The converted <see cref="ClientCapabilities"/> model.</returns>
  59. public ClientCapabilities ToClientCapabilities()
  60. {
  61. return new ClientCapabilities
  62. {
  63. PlayableMediaTypes = PlayableMediaTypes,
  64. SupportedCommands = SupportedCommands,
  65. SupportsMediaControl = SupportsMediaControl,
  66. SupportsPersistentIdentifier = SupportsPersistentIdentifier,
  67. DeviceProfile = DeviceProfile,
  68. AppStoreUrl = AppStoreUrl,
  69. IconUrl = IconUrl
  70. };
  71. }
  72. }