User Tools

Site Tools


blog:use_rss_feeds_with_conky

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
blog:use_rss_feeds_with_conky [2010-06-16 18:58] brbblog:use_rss_feeds_with_conky [2010-06-23 08:35] (current) brb
Line 5: Line 5:
 1. Add this line to your .conkyrc, adapting the path of the script and the http://... for your rss feed. 1. Add this line to your .conkyrc, adapting the path of the script and the http://... for your rss feed.
 <code bash> <code bash>
-${execi 180 /home/brb/bin/conky-rss.sh http://www.nzz.ch/feeds/recent/ 4 2 | ascii2uni -a D} +${execi 300 /home/brb/bin/conky-rss.sh http://www.nzz.ch/feeds/recent/ 4 2 | ascii2uni -a D} 
 </code> </code>
  
-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> +
-#!/bin/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 +
-# Gentooemerge -av net-misc/curl +
-# Debianapt-get install curl +
-# Homepage: http://curl.haxx.se/ +
-+
-# Usage: +
-# .conkyrc: ${execi [time/path/to/script/conky-rss.sh URI LINES TITLENUM} +
-# URI = Location of feed, ex. http://www.gentoo.org/rdf/en/glsa-index.rdf +
-# 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 /home/youruser/scripts/conky-rss.sh http://www.foxnews.com/xmlfeed/rss/0,4313,1,00.rss 4 2}+
  
-#RSS Setup - Don't change unless you want these values hard-coded! +Ref: http://ubuntuforums.org/showthread.php?t=1358302
-uri=$1 #URI of RSS Feed +
-lines=$2 #Number of headlines +
-titlenum=$3 #Number of extra titles +
- +
-#Script start +
-#Require a uri, as a minimum +
-if [[ "$uri" == "" ]]; then +
- echo "No URI specified, cannot continue!" >&+
- echo "Please read script for more information" >&+
-else +
- #Set defaults if none specified +
- if [[ $lines == "" ]]; then lines=5 ; fi +
- if [[ $titlenum == "" ]]; then titlenum=2 ; fi +
- +
- #The actual work +
- curl -s --connect-timeout 30 $uri |\ +
- sed -e 's/<\/title>/\n/g' |\ +
- grep -o '<title>.*' |\ +
- sed -e 's/<title>//' |\ +
- head -n $(($lines + $titlenum)) |\ +
- tail -n $(($lines)) +
-fi +
- +
-</code> +
- +
-Ref: +
-  * http://ubuntuforums.org/showthread.php?t=1358302+
 {{tag>ubuntu linux rss conky}} {{tag>ubuntu linux rss conky}}
  
blog/use_rss_feeds_with_conky.1276707489.txt.gz · Last modified: 2010-06-16 18:58 by brb