You are not logged in.

#1 2006-07-13 19:30:20

barebones
Member
Registered: 2006-04-30
Posts: 235

Arch News For conky

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

#2 2006-07-15 19:38:45

Kern
Member
From: UK
Registered: 2005-02-09
Posts: 464

Re: Arch News For conky

i'll give that one a try,
thanks for contributing  smile

Offline

#3 2006-07-15 22:40:01

japetto
Member
From: Chicago, IL US
Registered: 2006-07-02
Posts: 183

Re: Arch News For conky

Very cool.  Thanks!

Offline

#4 2006-07-17 10:16:55

onearm
Member
From: Anywhere but here
Registered: 2006-07-06
Posts: 359
Website

Re: Arch News For conky

Works very well, thanks!


To get something done, a committee should consist of no more than three persons, two of them absent.
--
My Github

Offline

#5 2006-12-17 09:40:54

Zoranthus
Member
From: muc
Registered: 2006-11-22
Posts: 166

Re: Arch News For conky

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

#6 2006-12-17 11:21:17

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Arch News For conky

chmod +x the script?

James

Offline

#7 2006-12-17 11:28:58

Zoranthus
Member
From: muc
Registered: 2006-11-22
Posts: 166

Re: Arch News For conky

D'oh.. yep. Thank you very much. smile

Offline

#8 2006-12-17 13:45:14

bones
Member
From: Brisbane
Registered: 2006-03-24
Posts: 322
Website

Re: Arch News For conky

Sweeeeet big_smile  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

#9 2008-10-07 11:47:09

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Arch News For conky

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB