summaryrefslogtreecommitdiff
path: root/src/channel.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/channel.rs')
-rw-r--r--src/channel.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/channel.rs b/src/channel.rs
new file mode 100644
index 0000000..f4d4941
--- /dev/null
+++ b/src/channel.rs
@@ -0,0 +1,34 @@
+use chrono::Utc;
+use rss::Channel;
+
+use crate::config::ChannelConfig;
+
+pub fn make_new_empty_channel(config: ChannelConfig) -> Channel {
+ Channel {
+ title: config.title,
+ link: config.link,
+ description: config.description,
+ language: config.language,
+ copyright: config.copyright,
+ managing_editor: config.managing_editor,
+ webmaster: config.webmaster,
+ pub_date: Some(Utc::now().to_rfc2822()),
+ last_build_date: Some(Utc::now().to_rfc2822()),
+ categories: config.categories,
+ generator: Some(String::from("https://git.joeac.net/rss-aggregator.git")),
+ docs: Some(String::from("https://git.joeac.net/rss-aggregator.git/tree/README.md")),
+ cloud: config.cloud,
+ ttl: config.ttl,
+ image: config.image,
+ text_input: config.text_input,
+ skip_hours: config.skip_hours,
+ skip_days: config.skip_days,
+ items: Vec::new(),
+ extensions: config.extensions,
+ itunes_ext: config.itunes_ext,
+ dublin_core_ext: config.dublin_core_ext,
+ syndication_ext: config.syndication_ext,
+ namespaces: config.namespaces,
+ rating: None,
+ }
+}