You are not logged in.
Pages: 1
On the conky homepage, theres a screenshot of a guy who has his conky display the Gentoo Security Feed, which I thought was pretty cool. I thought it would be even cooler to have one for the arch linux news feed, so I wrote one based on his. I figured other people might be interested in this, so here ya go:
#!/bin/bash
# Written by Peter Garceau
# Based on the RDF Feed Display Script by Hellf[i]re v0.1
#
# This script is designed for the Arch Linux News Feed.
#
# This script depends on curl.
# pacman -Sy curl
#
# Usage:
# .conkyrc: ${execi [time] /path/to/script/conky-rss.sh}
#
# Usage Example
# ${execi 300 /home/youruser/scripts/conky-rss.sh}
#RSS Setup
URI=http://www.archlinux.org/feeds/news/ #URI of RSS Feed
LINES=4 #Number of headlines
#Environment Setup
EXEC="/usr/bin/curl -s" #Path to curl
#Work Start
$EXEC $URI |
sed -e 's/></>n</g' |
sed -n '/<title>/p' |
sed -e 's/<title>//' |
sed -e 's/^/ /' |
head -n $(($LINES + 1)) |
tail -n $LINES
Offline
i'll give that one a try,
thanks for contributing
Offline
Very cool. Thanks!
Offline
Hm.. doesn't work for me. The setup is straightforward enough.. I got curl in/usr/bin, the script under the right name in the right folder and put my name into the path pointing to the script in the .conkyrc.. I don't think that I overlooked something, but it won't work. Instead of the news I see nothing in the place where I put it into my conky output.
I guess my main problem is that I'm not getting more output from conky.
Offline
chmod +x the script?
James
Offline
D'oh.. yep. Thank you very much.
Offline
Sweeeeet Works like a charm, Good work
"When once you have tasted flight, you will forever walk the earth with your eyes turned skyward, for there you have been, and there you will always long to return."
Offline
I re-invented the wheel because of something in another thread and only thought to check this before posting it, but who says we can't roll more than one way?
Here's a perl script to display the headlines on separate lines. Just pass the script an integer to specify how many, otherwise it will spit them all out.
#!/usr/bin/perl
use warnings;
use strict;
my $news_feed = `curl http://www.archlinux.org/feeds/news/ 2>/dev/null`;
$news_feed =~ s/\n//g;
my @titles = ();
while ($news_feed =~ m/<item>.*?<title>(.*?)<\/title>.*?<\/item>/g)
{
push @titles,$1;
}
my $n = $ARGV[0];
if (defined($n) and $n !~ m/\D/ and $n > 0)
{
@titles = @titles[0..$ARGV[0]-1];
}
print join "\n",@titles;
EDIT
Re-invention of the wheel when mass fabrication already exists... just remembered and checked that conky has rss support built in (tested it unsuccessfully though).
Last edited by Xyne (2008-10-07 11:55:52)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Pages: 1