SubtitleProfile.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #nullable disable
  2. using System.Xml.Serialization;
  3. using MediaBrowser.Model.Extensions;
  4. namespace MediaBrowser.Model.Dlna;
  5. /// <summary>
  6. /// A class for subtitle profile information.
  7. /// </summary>
  8. public class SubtitleProfile
  9. {
  10. /// <summary>
  11. /// Gets or sets the format.
  12. /// </summary>
  13. [XmlAttribute("format")]
  14. public string Format { get; set; }
  15. /// <summary>
  16. /// Gets or sets the delivery method.
  17. /// </summary>
  18. [XmlAttribute("method")]
  19. public SubtitleDeliveryMethod Method { get; set; }
  20. /// <summary>
  21. /// Gets or sets the DIDL mode.
  22. /// </summary>
  23. [XmlAttribute("didlMode")]
  24. public string DidlMode { get; set; }
  25. /// <summary>
  26. /// Gets or sets the language.
  27. /// </summary>
  28. [XmlAttribute("language")]
  29. public string Language { get; set; }
  30. /// <summary>
  31. /// Gets or sets the container.
  32. /// </summary>
  33. [XmlAttribute("container")]
  34. public string Container { get; set; }
  35. /// <summary>
  36. /// Checks if a language is supported.
  37. /// </summary>
  38. /// <param name="subLanguage">The language to check for support.</param>
  39. /// <returns><c>true</c> if supported.</returns>
  40. public bool SupportsLanguage(string subLanguage)
  41. {
  42. if (string.IsNullOrEmpty(Language))
  43. {
  44. return true;
  45. }
  46. if (string.IsNullOrEmpty(subLanguage))
  47. {
  48. subLanguage = "und";
  49. }
  50. return ContainerHelper.ContainsContainer(Language, subLanguage);
  51. }
  52. }