SubtitleProfile.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using MediaBrowser.Model.Extensions;
  2. using System.Collections.Generic;
  3. using System.Xml.Serialization;
  4. using MediaBrowser.Model.Dlna;
  5. namespace MediaBrowser.Model.Dlna
  6. {
  7. public class SubtitleProfile
  8. {
  9. [XmlAttribute("format")]
  10. public string Format { get; set; }
  11. [XmlAttribute("method")]
  12. public SubtitleDeliveryMethod Method { get; set; }
  13. [XmlAttribute("didlMode")]
  14. public string DidlMode { get; set; }
  15. [XmlAttribute("language")]
  16. public string Language { get; set; }
  17. public List<string> GetLanguages()
  18. {
  19. List<string> list = new List<string>();
  20. foreach (string i in (Language ?? string.Empty).Split(','))
  21. {
  22. if (!string.IsNullOrEmpty(i)) list.Add(i);
  23. }
  24. return list;
  25. }
  26. public bool SupportsLanguage(string subLanguage)
  27. {
  28. if (string.IsNullOrEmpty(Language))
  29. {
  30. return true;
  31. }
  32. if (string.IsNullOrEmpty(subLanguage))
  33. {
  34. subLanguage = "und";
  35. }
  36. List<string> languages = GetLanguages();
  37. return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage);
  38. }
  39. }
  40. }