aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_wire/FeedUtil.cpp
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Library/ml_wire/FeedUtil.cpp
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Plugins/Library/ml_wire/FeedUtil.cpp')
-rw-r--r--Src/Plugins/Library/ml_wire/FeedUtil.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/Src/Plugins/Library/ml_wire/FeedUtil.cpp b/Src/Plugins/Library/ml_wire/FeedUtil.cpp
new file mode 100644
index 00000000..bf5b5ae8
--- /dev/null
+++ b/Src/Plugins/Library/ml_wire/FeedUtil.cpp
@@ -0,0 +1,37 @@
+#include "main.h"
+#include "FeedUtil.h"
+#include "ChannelCheck.h"
+#include "FeedParse.h"
+#include "errors.h"
+#include "./defaults.h"
+
+
+int DownloadFeedInformation(Channel &newFeed)
+{
+ ChannelCheck check;
+ FeedParse downloader(&check, false);
+
+ int ret = downloader.DownloadURL(newFeed.url);
+ if (ret != DOWNLOAD_SUCCESS)
+ return ret;
+
+ if (!check.channel.title || !check.channel.title[0])
+ return DOWNLOAD_NOTRSS;
+
+ newFeed.SetTitle(check.channel.title);
+ if (check.channel.ttl)
+ {
+ newFeed.updateTime = check.channel.ttl * 60;
+ newFeed.autoUpdate = true;
+ }
+ else
+ {
+ newFeed.updateTime = ::updateTime;
+ newFeed.autoUpdate = ::autoUpdate;
+ }
+
+ if (check.channel.url && check.channel.url[0])
+ newFeed.SetURL(check.channel.url);
+
+ return DOWNLOAD_SUCCESS;
+} \ No newline at end of file