rss_check.sh 613 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. ## This is my (demuredemeanor) polybar script for checking unread RSS count.
  3. ## This script checks newsboat's cache and gets a count of unread messages.
  4. ## Possible locations. Prioritise 'oldschool' location.
  5. RSS_PATH1="${HOME}/.newsboat/cache.db"
  6. RSS_PATH2="${HOME}/.local/share/newsboat/cache.db"
  7. ## Check unread count
  8. if [ -s "${RSS_PATH1}" ]; then
  9. STATUS="$(sqlite3 ${RSS_PATH1} 'select sum(unread) from rss_item')"
  10. elif [ -s "${RSS_PATH2}" ]; then
  11. STATUS="$(sqlite3 ${RSS_PATH2} 'select sum(unread) from rss_item')"
  12. else
  13. STATUS="Missing"
  14. fi
  15. ## Return results
  16. echo "${STATUS}"