SeriesXmlParser.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Xml;
  3. using MediaBrowser.Controller.Xml;
  4. using MediaBrowser.Model.Entities;
  5. using MediaBrowser.TV.Entities;
  6. namespace MediaBrowser.TV.Metadata
  7. {
  8. public class SeriesXmlParser : BaseItemXmlParser<Series>
  9. {
  10. protected override void FetchDataFromXmlNode(XmlReader reader, Series item)
  11. {
  12. switch (reader.Name)
  13. {
  14. case "id":
  15. string id = reader.ReadString();
  16. if (!string.IsNullOrWhiteSpace(id))
  17. {
  18. item.SetProviderId(MetadataProviders.Tvdb, id);
  19. }
  20. break;
  21. case "Airs_DayOfWeek":
  22. {
  23. string day = reader.ReadString();
  24. if (!string.IsNullOrWhiteSpace(day))
  25. {
  26. if (day.Equals("Daily", StringComparison.OrdinalIgnoreCase))
  27. {
  28. item.AirDays = new DayOfWeek[] {
  29. DayOfWeek.Sunday,
  30. DayOfWeek.Monday,
  31. DayOfWeek.Tuesday,
  32. DayOfWeek.Wednesday,
  33. DayOfWeek.Thursday,
  34. DayOfWeek.Friday,
  35. DayOfWeek.Saturday
  36. };
  37. }
  38. else
  39. {
  40. item.AirDays = new DayOfWeek[] {
  41. (DayOfWeek)Enum.Parse(typeof(DayOfWeek), day, true)
  42. };
  43. }
  44. }
  45. break;
  46. }
  47. case "Airs_Time":
  48. item.AirTime = reader.ReadString();
  49. break;
  50. case "SeriesName":
  51. item.Name = reader.ReadString();
  52. break;
  53. case "Status":
  54. item.Status = reader.ReadString();
  55. break;
  56. default:
  57. base.FetchDataFromXmlNode(reader, item);
  58. break;
  59. }
  60. }
  61. }
  62. }