antiX-forum Forum Index antiX-forum
Forum for users of antiX linux. "Mean and Lean"
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Welcome
Welcome to antiX-forum.

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, join our community today!

RSS in Conky

 
Post new topic   Reply to topic    antiX-forum Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
Jerry



Joined: 12 Sep 2007
Posts: 129

PostPosted: Tue May 13, 2008 4:05 pm    Post subject: RSS in Conky Reply with quote

Along the line of practical items, I have adapted this script to display the current top item on CNN.com in Conky. (It requires the installation of curl from the repos.) My procedure (be sure to change my username "jb" to your own):

1) Open up Leafpad and paste in this code:
Code:
# RSS Feed Display Script by Hellf[i]re v0.1
#
# This script is designed for most any RSS Feed. As some feeds may not be
# completely compliant, it may need a bit of tweaking
#
# This script depends on curl.
# Gentoo: emerge -av net-misc/curl
# Debian: apt-get install curl
# Homepage: http://curl.haxx.se/
#
# Usage:
# .conkyrc: ${execi [time] /path/to/script/conky-rss.sh}
#
# Usage Example
# ${execi 300 /home/youruser/scripts/conky-rss.sh}

#RSS Setup
URI=http://rss.cnn.com/rss/cnn_topstories.rss #URI of RSS Feed
LINES=1 #Number of headlines

#Environment Setup
EXEC="/usr/bin/curl -s" #Path to curl

#Work Start
$EXEC $URI | grep title |\
sed -e :a -e 's/<[^>]*>//g;/</N' |\
sed -e 's/[ \t]*//' |\
sed -e 's/\(.*\)/ \1/' |\
sed -e 's/\.//' |\
sed -e 's/\"//' |\
sed -e 's/\"//' |\
head -n $(($LINES + 2)) |\
tail -n $(($LINES))

Change LINES= to as many feeds as you would like displayed.
2) save as conky-rss_CNN.sh in /home/jb/scripts , then right-click --> Permissions and click Yes to make it executable
3) paste the following at the bottom of conkyrc (colors personal):
Code:
${color white}News:
 ${color green}${execi 300 /home/jb/scripts/conky-rss_CNN.sh}

Then save the file.
4) click Menu --> WM's --> Conky on/off twice to activate new config

NOTES: 1) You can add other feeds by creating additional copies of the script and changing the URL and the name. 2) Not all feeds work for me, especially those ending in xml such as from the BBC--maybe somebody can solve that?
Back to top
View user's profile Send private message
JawsThemeSwimming428



Joined: 17 Mar 2008
Posts: 86

PostPosted: Tue May 13, 2008 11:45 pm    Post subject: Reply with quote

Thanks, I plan to try that later tonight. Nice job.
Back to top
View user's profile Send private message
JawsThemeSwimming428



Joined: 17 Mar 2008
Posts: 86

PostPosted: Wed May 14, 2008 4:23 am    Post subject: Reply with quote

OK, not sure why it doesn't work with feeds ending in .xml but I am getting the same result as you. At first it wasn't working but then I realized I hadn't installed curl. After installing curl everything worked fine. The only question I have is how do I allow the headline to take up more than one line in conky? For example, right now it says "Philadelphia's municipal WiFi n" and then it cuts it off because there is a character or line limit. I want it to show the entire title of the article. Thanks !
Back to top
View user's profile Send private message
Jerry



Joined: 12 Sep 2007
Posts: 129

PostPosted: Wed May 14, 2008 1:21 pm    Post subject: Reply with quote

I found that you can get a certain increase in width by changing this entry in your conkyrc file:
Code:
maximum_width 300

But numbers greater than that seem to have no further effect. Something else must be limiting it, haven't figured out what yet.
Back to top
View user's profile Send private message
JawsThemeSwimming428



Joined: 17 Mar 2008
Posts: 86

PostPosted: Wed May 14, 2008 5:18 pm    Post subject: Reply with quote

Alright thanks. I will play around a little bit and let you know if I figure it out.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    antiX-forum Forum Index -> Tips and Tricks All times are GMT + 3 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Community Chest


Powered by phpBB
Hosted by FreeForums.org