newsboat / newsboat

An RSS/Atom feed reader for text terminals
https://newsboat.org/
MIT License
3.01k stars 215 forks source link

Control the number of unread feeds displayed #2619

Closed lamyergeier closed 10 months ago

lamyergeier commented 11 months ago

Newsboat version (copy the output of newsboat -v or the first line of git show):

Newsboat 2.33.0 System: Linux 6.5.10-300.fc39.x86_64 (x86_64) Compiler: g++ 11.4.0 ncurses: ncurses 6.4.20221231 (compiled with 6.4) libcurl: libcurl/8.5.0 OpenSSL/3.2.0 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.4 libssh2/1.11.0 nghttp2/1.58.0 librtmp/2.3 OpenLDAP/2.6.6 (compiled with 8.3.0) SQLite: 3.44.2 (compiled with 3.43.1) libxml2: compiled with 2.11.5

Config file (copy from ~/.newsboat/config or ~/.config/newsboat/config):

# Refer:
# 0. [voidrice/config at archi3 · LukeSmithxyz/voidrice](https://github.com/LukeSmithxyz/voidrice/blob/archi3/.config/newsboat/config)
# 1. [Newsboat + Bitchute + mpv + youtube-dl](https://megamorphf.github.io/software/tui/video/2018/08/25/newsboat-bitchute-mpv-youtubedl.html)
# 2. [The Newsboat RSS Feedreader](https://newsboat.org/releases/2.19/docs/newsboat.html)
# 3. [~/.newsbeuter/config](http://moparx.com/configs/newsbeuter/)
# 4. [Newsboat - ArchWiki](https://wiki.archlinux.org/index.php/Newsboat#Configuration)
# 5. [How to open newsboat feed in browser - Ask Ubuntu](https://askubuntu.com/questions/1256425/how-to-open-newsboat-feed-in-browser)

# Browser (Set Default browser)
# =======
# Linux
#browser "google-chrome %u"
#browser "firefox %u"
## MacOS
#browser "open -g -a 'Google Chrome' %u"

#browser "open %u"
browser "$BROWSER %u"

# Macro
# =====
macro q mark-all-feeds-read ; quit
macro , open-in-browser
macro w set browser "w3m"; open-in-browser ; set browser "firefox %u"
macro m set browser "Youtube %u"; open-in-browser ; set browser "firefox %u" # Execute Youtube.sh
#macro m set browser "ytfzf %u"; open-in-browser ; set browser "firefox %u" # Execute ytfzf. Cons: No subtitles!
macro m set browser "mpv --no-config --fs --ytdl-raw-options=ignore-config=,sub-langs=[en,en-GB,de],write-subs=,write-auto-subs=,sponsorblock-mark=default,sponsorblock-remove=default -- %u"; open-in-browser ; set browser "firefox %u" # Copied from Youtube.sh
#macro m set browser "mpv --sub-auto=fuzzy --screenshot-format=png --screenshot-template=Image_%F_%wH-%wM-%wS --screenshot-directory=Image --ytdl-format=best --ytdl-raw-options=sub-format=en,write-srt= --ytdl --ontop --no-border --force-window --autofit=960x540 --geometry=-20-50 %u"; open-in-browser ; set browser "firefox %u"
#macro m set browser "mpv %u"; open-in-browser ; set browser "firefox %u"

#macro v set browser "setsid nohup mpv"; open-in-browser ; set browser google-chrome
#macro c set browser "xsel -b <<<" ; open-in-browser ; set browser google-chrome

## Task Spooler
# =============
#macro t set browser "tsp youtube-dl --add-metadata -ic"; open-in-browser ; set browser google-chrome
#macro a set browser "tsp youtube-dl --add-metadata -xic -f bestaudio/best"; open-in-browser ; set browser google-chrome

# Format %<no. of characters><Field Code>
# ======
feedlist-format "%4i %-18T %11U %n %-30t"
articlelist-format "%4i %f %D   %?T?|%-17T|  ?%t"
notify-format "%d new articles (%n unread articles, %f unread feeds)"
podlist-format "%4i [%-5p %%] %-5S %b"
#podlist-format "%4i [%6dMB/%6tMB] [%5p %%] [%7k kb/s] %-20S %u -> %F"

# Feed
# ====
auto-reload yes
reload-time 60
reload-threads 32
download-retries 4
download-timeout 10
prepopulate-query-feeds yes
mark-as-read-on-hover yes
#confirm-mark-all-feeds-read no

# display
# =======
show-read-feeds no
feed-sort-order unreadarticlecount-asc
text-width 80

# navigation
# ==========
goto-next-feed no

# Podcast
#=========
download-path "~/Downloads/Podcast/%h/%n"
podcast-auto-enqueue yes
max-downloads 4
player 'mpv'

# articles ignore: Refer: [Killfiles: Newsboat](https://newsboat.org/releases/2.21/docs/newsboat.html#_killfiles)
# ======================
ignore-article "*" "title =~ \"Sponsor|Advertisement|[sS]horts?\""
ignore-article "*" "title =~ \"अ|आ|इ|ई|उ\""
ignore-article "*" "title =~ \"Modi|Narendra Modi|bjp|Amit Shah|Rahul Gandhi|Sonia Gandhi|Mamata Banerjee|Adani|Ambani\""
ignore-article "*" "title =~ \"Trump|Biden|Trudeau|Canada\""
ignore-article "*" "title =~ \"Brexit|Boris Johnson|Queen Elizabeth|King Charles|Prince Charles|Meghan|Prince Harry\""
ignore-article "*" "title =~ \"North Korea|Kim Jong|Ukraine|Zelenskyy|Jair Bolsonaro|Russia|Putin|Hamas|Gaza|Netanyahu|Bibi|Palestine\""
ignore-article "*" "title =~ \"Xi Jinping|Pakistan|Cpec|Nepal|Bangladesh|Bhutan|Taliban|Afghanistan|Afghan|Kabul|Maldives|Taiwan|Gaza\""
ignore-article "*" "title =~ \"Covid|Coronavirus|Corona|Pandemic|Vaccine|Lockdown\""
ignore-article "*" "title =~ \"Gondi Bulletin|Kashmir|Bachchan|priyanka chopra|cricket|virat kohli\""
ignore-article "*" "title =~ \"amazon|apple|iphone|ipad|macbook|xiaomi|huawei|samsung\""
#ignore-article "*" "title =~ \"cricket|virat kohli|football\""
#ignore-article "*" "title =~ \"\""
ignore-mode "display"

# Bookmark
#=========
bookmark-autopilot yes
bookmark-interactive no
bookmark-cmd "~/opt/bin/NewsboatBookmark"

# Misc
#=====
error-log "~/Documents/.Log/Newsboat.error.log"
confirm-exit no
cleanup-on-quit yes

# Cache
# ========
# keep-articles-days: If set the a number greater than 0, only articles that are were published within the last <n> days are kept, and older articles are deleted. If set to 0 (default value), this option is not active.
# max-items: Set the number of articles to maximally keep per feed. If the number is set to 0, then all articles are kept. [Feeds with many items are slow to open and navigate · Issue #229 · newsboat/newsboat](https://github.com/newsboat/newsboat/issues/229); Newsboat caches the article that it downloads. This means that when you start newsboat again and reload a feed, the old articles can still be read even if they aren’t in the current RSS feeds anymore. Optionally you can configure how many articles shall be preserved by feed so that the article backlog doesn’t grow endlessly (see "max-items" below).
keep-articles-days 365
max-items 10

# Theme
# ========
# Light Solarized color scheme for newsbeuter, based on
# Ethan Schoonover's Solarized.
#
# In order to use this color scheme, you must first configure
# your terminal emulator to use the Solarized palette.
# See <http://ethanschoonover.com/solarized/> for more information.

color background         default   default
color listnormal         default   default
color listnormal_unread  default   default
color listfocus          white     yellow
color listfocus_unread   white     yellow
color info               default   white
color article            default   default

# highlights
highlight article "^(Title):.*$" green default
highlight article "https?://[^ ]+" blue default
highlight article "\\[image\\ [0-9]+\\]" red default

Request

I am trying to overcome my addiction of having to frequently check newsboat. Could you please provide a setting in config that could control how unread feeds are shown with following conditions:

For my case I would like to to see feed only if there are atleast 3 new entries or last entry was more than a week ago (for feeds that are not updated very frequently). I hope that this will decrease the number of results shown in the newsboat and can be very helpful.

dennisschagt commented 11 months ago

I think part of that is already possible using Newsboat's filter language. It is possible to filter the feedlist by the number of unread articles in a feed by using the unread_count attribute in a filter, e.g.:

define-filter "minimal-unread" "unread_count >= 3"
run-on-startup select-filter "minimal-unread"

The second part (filtering on last entry publish date) is probably not possible at this moment. We do have a feeddate attribute but it looks like that is an absolute date. It might make sense for us to implement an attribute for feeds called last_article_age which works similar to the age attribute available on individual articles.

As a side note, the Newsboat documentation has been updated quite a bit since version 2.19 so it might be nice to update the link at 2. to point to the latests version 2.33: https://newsboat.org/releases/2.33/docs/newsboat.html or to a locally installed version. In my case that would be in /usr/share/doc/newsboat/, linked to using file:///usr/share/doc/newsboat/newsboat.html

lamyergeier commented 11 months ago

As a side note, the Newsboat documentation has been updated quite a bit since version 2.19 so it might be nice to update the link at 2. to point to the latests version 2.33: https://newsboat.org/releases/2.33/docs/newsboat.html or to a locally installed version. In my case that would be in /usr/share/doc/newsboat/, linked to using file:///usr/share/doc/newsboat/newsboat.html

May be we could have a url always pointing to latest documentation version: https://newsboat.org/releases/latest/docs/newsboat.html

dennisschagt commented 11 months ago

I've just opened a pull request with an implementation for a "days since most recent article" attribute. If/when that is released, you can use the following config to apply the requested feed filtering:

define-filter "minimal-unread" "unread_count >= 3 or latest_article_age >= 7"
run-on-startup select-filter "minimal-unread"

We are currently in the stabilization period of a release, so merging the PR might be postponed for a while.

May be we could have a url always pointing to latest documentation version: https://newsboat.org/releases/latest/docs/newsboat.html

We have an issue tracking such a request: https://github.com/newsboat/newsboat/issues/2535 I expect that will be implemented sometime, but I don't think I myself have access to the website configuration.