From 623467aecb5d560ab89165c9144b973fff036a48 Mon Sep 17 00:00:00 2001 From: CalabashSquash Date: Thu, 12 Sep 2024 21:17:01 +1000 Subject: [PATCH 1/2] feat: Add configuration parameter to specify how long the google news feed should be --- README.md | 1 + config.go | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3568d69..07bd835 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ feeds: - http://www.joelonsoftware.com/rss.xml - https://www.youtube.com/feeds/videos.xml?channel_id=UCHnyfMqiRRG1u-2MsSQLbXA google_news_keywords: George Hotz,ChatGPT,Copenhagen +google_news_length: 5 instapaper: true weather_latitude: 37.77 weather_longitude: 122.41 diff --git a/config.go b/config.go index 5ac1a40..5556b1b 100644 --- a/config.go +++ b/config.go @@ -23,6 +23,7 @@ feeds: - http://www.joelonsoftware.com/rss.xml - https://www.youtube.com/feeds/videos.xml?channel_id=UCHnyfMqiRRG1u-2MsSQLbXA google_news_keywords: George Hotz,ChatGPT,Copenhagen +google_news_length: 5 instapaper: true weather_latitude: 37.77 weather_longitude: 122.41 @@ -151,7 +152,13 @@ func bootstrapConfig() { googleNewsKeywords := url.QueryEscape(viper.Get("google_news_keywords").(string)) if googleNewsKeywords != "" { googleNewsUrl := "https://news.google.com/rss/search?hl=en-US&gl=US&ceid=US%3Aen&oc=11&q=" + strings.Join(strings.Split(googleNewsKeywords, "%2C"), "%20%7C%20") - myFeeds = append(myFeeds, RSS{url: googleNewsUrl, limit: 15}) // #FIXME make it configurable + var googleNewsLength int + if viper.IsSet("google_news_length") { + googleNewsLength = viper.Get("google_news_length").(int) + } else { + googleNewsLength = 15 // limit + } + myFeeds = append(myFeeds, RSS{url: googleNewsUrl, limit: googleNewsLength}) } } From e37bae7efe5525c30bedcd8b2ca5acb1aa7bd9d6 Mon Sep 17 00:00:00 2001 From: CalabashSquash Date: Thu, 12 Sep 2024 21:18:31 +1000 Subject: [PATCH 2/2] Clarify comment --- config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.go b/config.go index 5556b1b..d8d0b4c 100644 --- a/config.go +++ b/config.go @@ -156,7 +156,7 @@ func bootstrapConfig() { if viper.IsSet("google_news_length") { googleNewsLength = viper.Get("google_news_length").(int) } else { - googleNewsLength = 15 // limit + googleNewsLength = 15 // default limit } myFeeds = append(myFeeds, RSS{url: googleNewsUrl, limit: googleNewsLength}) }