SubtitleProfile.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 language)
  26. {
  27. if (string.IsNullOrEmpty(language))
  28. {
  29. language = "und";
  30. }
  31. List<string> languages = GetLanguages();
  32. return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, language);
  33. }
  34. }
  35. }