FeedUtil.cpp 765 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "main.h"
  2. #include "FeedUtil.h"
  3. #include "ChannelCheck.h"
  4. #include "FeedParse.h"
  5. #include "errors.h"
  6. #include "./defaults.h"
  7. int DownloadFeedInformation(Channel &newFeed)
  8. {
  9. ChannelCheck check;
  10. FeedParse downloader(&check, false);
  11. int ret = downloader.DownloadURL(newFeed.url);
  12. if (ret != DOWNLOAD_SUCCESS)
  13. return ret;
  14. if (!check.channel.title || !check.channel.title[0])
  15. return DOWNLOAD_NOTRSS;
  16. newFeed.SetTitle(check.channel.title);
  17. if (check.channel.ttl)
  18. {
  19. newFeed.updateTime = check.channel.ttl * 60;
  20. newFeed.autoUpdate = true;
  21. }
  22. else
  23. {
  24. newFeed.updateTime = ::updateTime;
  25. newFeed.autoUpdate = ::autoUpdate;
  26. }
  27. if (check.channel.url && check.channel.url[0])
  28. newFeed.SetURL(check.channel.url);
  29. return DOWNLOAD_SUCCESS;
  30. }