My favorites | Sign in
Project Home Downloads Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# RSS Display Script by Andrey Zakharov (admin@vaultsoft.ru) v0.1
#
# This script is designed to output story BODIES for most any RSS Feed.
#
# This script depends on wget, xsltproc, sed. Please ensure it is installed and in your $PATH
# Debian: apt-get install wget xsltproc sed
#
# Usage:
# .conkyrc: ${execpi [time] /path/to/script/conky-rss.sh URI LIMIT}
# URI = Location of feed, ex. http://bash.org.ru/rss/
# LINES = How many items to display (default 5)
#
# Usage Example
# ${execi 300 /home/youruser/scripts/conky-rss.sh http://www.foxnews.com/xmlfeed/rss/0,4313,1,00.rss 4}

# TODO quotes with quote symbols - respect LOCALE
rssxslt=`dirname $0`/rss.xslt
cat > $rssxslt <<XML
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" indent="no"/>
<xsl:param name = "limit" select = "20" />
<xsl:template match="rss"><xsl:apply-templates select = "channel" /></xsl:template>

<xsl:template match="channel"><xsl:text>\${color1}</xsl:text><xsl:value-of select="description/text()" />\${color}
<xsl:text>
</xsl:text>
<xsl:apply-templates select = "item[ position() &lt; \$limit ]" />
</xsl:template>

<xsl:template match="item">
<xsl:value-of select="description/text()" />
<xsl:text> \${color1}\${hr 1}\${color}

</xsl:text>
</xsl:template>
</xsl:stylesheet>
XML
#RSS Setup - Don't change unless you want these values hard-coded!
uri=$1 # URI of RSS Feed
lines=${2:-5} # Number of headlines
titlenum=${3:-2} # Number of extra titles
timeout=50 # Timeout for wget in secs
#
#Script start
#Require a uri, as a minimum
if [ -z "$uri" ]; then
echo "No URI specified, cannot continue!" >&2
echo "Please read script for more information" >&2
else
#The actual work
wget --timeout=$timeout --quiet --output-document - $uri |\
# iconv --from-code cp1251 --to-code UTF-8 |\
xsltproc --nonet --novalid --param limit $( expr 1 + $lines ) $rssxslt - |\
sed 's!<br/\?>!\n!g
s!&quot\;!"!g
s!&lt\;!<!g
s!&gt\;!>!g
s!&amp\;!\&!g
'
fi

Change log

r30 by aazaharov81 on May 7, 2010   Diff
Changed conkies
Added vaultsoft.ru theme
Go to: 
Project members, sign in to write a code review

Older revisions

r18 by aazaharov81 on Mar 27, 2010   Diff
Added sensors collector script
Updated my own
r12 by aazaharov81 on Mar 21, 2010   Diff
Added first bunch of my own scripts
All revisions of this file

File info

Size: 2143 bytes, 62 lines

File properties

svn:executable
*
Powered by Google Project Hosting