SubtitleProfile.cs 1.2 KB

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