Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need to watch a RSS feed from our hudson ci server. Each time a new entry is available i want to play a sound by calling #>play sound.wav.

Does anyone know a tool which can watch a rss-feed and fire a command each time a new entry appears?

I had a look at rsstail but it gets all entries from the feed and not the latest or only the ones that are new since the last lookup.

share|improve this question
    
Maybe you can modify bashpodder.shell? (lincgeek.org/bashpodder) –  Johan Oct 6 '11 at 7:18
    
Are you sure you are using rsstail correctly? Its manpage says thet the default interval of checking for new feeds is 15 minutes and it can be changed by the -i parameter. (Remember that by RSS design, you'll never get the update information instantly, you have to poll.) –  rozcietrzewiacz Oct 6 '11 at 9:18
    
hell yeah. rsstail -i 3 -u example.com/rss.xml -n 0 thats it. Thanks alot! –  martin Oct 7 '11 at 11:37

3 Answers 3

You can try using Newsbeuter which has an option to run an external command (see notify-program in the documentation).

Canto also has some customizable hooks, though the whole configuration system looks a bit more complicated at first glance.

With rsstail + shell you can also invoke external commands. Start off with what you already figured out:

rsstail -i 3 -u example.com/rss.xml -n 0

and pipe the output to a while read loop:

rsstail -i 3 -u example.com/rss.xml -n 0 | while read line
  do
    aplay /some/sound/file.wav
    echo "$line"
  done
share|improve this answer

You could try:

#!/bin/bash
last=""
while true
do
    now="$(curl http://yourdomain/feed.rss 2> /dev/null | grep pubDate | head -1)"
    test "$last" != "$now" && play mysound.wav
    last="$now"
    sleep 1m
done
share|improve this answer
up vote 0 down vote accepted

Thats the solution:

rsstail -i 3 -u example.com/rss.xml -n 0 | while read x ; do play fail.ogg ; done

so each time a new topic is released in the feed, the sound will be played. play is packaged in sox

share|improve this answer
    
I understand that this solves the part about refreshing, but is not (yet) a way to play sound (the main part you asked for). If you solved it as well, please write how. –  rozcietrzewiacz Oct 7 '11 at 12:26
    
your right. just updating ... –  martin Oct 12 '11 at 10:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.