lurker-san posted an entry describes how we can make GNU screen indicate the count of unread entries on livedoor Reader on its hardstatus line. It's interesting.
Well, I think lurker-san's approach might provoke too much frequent access to LDR's API.
screen.info says:
Command: backtick ID LIFESPAN AUTOREFRESH COMMAND [ARGS]
(snip)
The specified LIFESPAN is the number of seconds the output is considered valid. After this time, the command is run again if a corresponding string escape is encountered.
How about the problem? I'm not sure that I've understood what the document describes...
So then, I'll show you another solution. typester told me it. See for the Bloglines version: .
Meanwhile, screen.info says:
If both the LIFESPAN and the AUTOREFRESH parameters are zero, the backtick program is expected to stay in the background and generate output once in a while. In this case, the command is executed right away and screen stores the last line of output. If a new line gets printed screen will automatically refresh the hardstatus or the captions.
I'll apply this feature to this one.
First, after setting your user name on livedoor Reader as "USERNAME", save the code below as a file named "ldrcheckunread", and locate it on the path your system can find it.
#!/bin/sh
USERNAME='user name'
INTERVAL=600
while true;
do
echo "updating..."
STATUS=''
RESPONSE=`curl -s http://rpc.reader.livedoor.com/notify?user=$USERNAME | tr -d '|'`
expr "$RESPONSE" + 1 > /dev/null 2>&1
if [ $? -lt 2 ]; then
STATUS=$RESPONSE
else
STATUS='Error!'
fi
echo "LDR($STATUS)"
sleep $INTERVAL
done
Second, add a snippet like below to your .screenrc file. What kind of the settings suits for your system depends on your like, so edit it as you like.
backtick 0 0 0 ldr_check_unread
hardstatus alwayslastline "%H[%02c]: %` %-w%{=b bw}%n %t%{-}%+w"
Finally, you'll see the thing like below on your terminal.

Let's enjoy the comfortable life with GNU screen and livedoor Reader!