blog:use_rss_feeds_with_conky
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| blog:use_rss_feeds_with_conky [2010-06-16 18:58] – brb | blog:use_rss_feeds_with_conky [2010-06-23 08:35] (current) – brb | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| </ | </ | ||
| - | 2. Create a shell script in a folder like ~/bin: | + | 2. Create a shell script in a folder like $HOME/bin: [[:blogfiles:rss_conky.sh]] |
| - | <code bash> | + | |
| - | # | + | |
| - | # RSS Display Script by Bill Woodford (admin@sdesign.us) v1.0 | + | |
| - | # | + | |
| - | # This script is designed to output story titles for most any RSS Feed. | + | |
| - | # | + | |
| - | # This script depends on curl. Please ensure it is installed and in your $PATH | + | |
| - | # Gentoo: emerge -av net-misc/ | + | |
| - | # Debian: apt-get install curl | + | |
| - | # Homepage: http://curl.haxx.se/ | + | |
| - | # | + | |
| - | # Usage: | + | |
| - | # .conkyrc: | + | |
| - | # URI = Location of feed, ex. http:// | + | |
| - | # LINES = How many titles to display (default 5) | + | |
| - | # TITLENUM = How many times the title of the feed itself is specified, usually 1 or 2 (default 2) | + | |
| - | # | + | |
| - | # Usage Example | + | |
| - | # ${execi 300 / | + | |
| - | #RSS Setup - Don't change unless you want these values hard-coded! | + | Ref: http:// |
| - | uri=$1 # | + | |
| - | lines=$2 # | + | |
| - | titlenum=$3 # | + | |
| - | + | ||
| - | #Script start | + | |
| - | #Require a uri, as a minimum | + | |
| - | if [[ " | + | |
| - | echo "No URI specified, cannot continue!" | + | |
| - | echo " | + | |
| - | else | + | |
| - | #Set defaults if none specified | + | |
| - | if [[ $lines == "" | + | |
| - | if [[ $titlenum == "" | + | |
| - | + | ||
| - | #The actual work | + | |
| - | curl -s --connect-timeout 30 $uri |\ | + | |
| - | sed -e ' | + | |
| - | grep -o '< | + | |
| - | sed -e ' | + | |
| - | head -n $(($lines + $titlenum)) |\ | + | |
| - | tail -n $(($lines)) | + | |
| - | fi | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | Ref: | + | |
| - | * http:// | + | |
| {{tag> | {{tag> | ||
blog/use_rss_feeds_with_conky.1276707516.txt.gz · Last modified: 2010-06-16 18:58 by brb
