Problem ze skryptem wy

Tematy związane z oprogramowaniem, instalacją, konfiguracją
majusio
Posty: 15
Rejestracja: 09 grudnia 2007, 15:31

Problem ze skryptem wyświetlającym RSS w conky

Post autor: majusio »

Używam następującego skryptu do wyświetlania RSS w conky

Kod: Zaznacz cały

#
# This script is designed to output story titles for most any RSS Feed.
#
# This script depends on curl.  Please ensure it is installed and in your $PATH
# Gentoo: emerge -av net-misc/curl
# Debian: apt-get install curl
# Homepage: [url]http://curl.haxx.se/[/url]
#
# Usage:
# .conkyrc:	${execi [time] /path/to/script/conky-rss.sh URI LINES TITLENUM}
#	URI = Location of feed, ex. [url]http://www.gentoo.org/rdf/en/glsa-index.rdf[/url]
#	LINES = How many titles to display (default 5)
#	TITLENUM = How many times the title of the feed itself is specified, usually 1 or 2 (default 2)
#
# Usage Example		
#		${execi 300 /home/majusio/.conky-rss.sh [url]http://www.dziennik.pl/?service=Rss[/url] 4 1}

#RSS Setup - Don't change unless you want these values hard-coded!
uri=$1							#URI of RSS Feed
lines=$2						#Number of headlines
titlenum=$3						#Number of extra titles

#Script start
#Require a uri, as a minimum
if [[ "$uri" == "" ]]; then
	echo "No URI specified, cannot continue!" >&2
	echo "Please read script for more information" >&2
else
	#Set defaults if none specified
	if [[ $lines == "" ]]; then lines=5 ; fi
	if [[ $titlenum == "" ]]; then titlenum=2 ; fi

	#The actual work
	curl -s --connect-timeout 30 $uri |\
	sed -e 's/<\/title>/\n/g' |\
	grep -o '<title>.*' |\
	sed -e 's/<title>//' |\
	head -n $(($lines + $titlenum)) |\
	tail -n $(($lines))
fi
a efekt następujący

Obrazek

Może ktoś wie w czym problem i ewentualnie co można zmienić w skrypcie. Dodam, że do momentu kiedy dziennik.pl zmienił adres RSS było wszystko w porządku i wyświetlało się elegancko. To samo stało się z RSS tvn24.pl. O wp.pl czy onecie nie wspomnę bo tam od zawsze jakoś to dziwnie wyglądało w conky.
mlyczek
Junior Member
Posty: 979
Rejestracja: 02 sierpnia 2006, 19:17

Post autor: mlyczek »

majusio pisze:Może ktoś wie w czym problem i ewentualnie co można zmienić w skrypcie.
Problem w tym, że w pliku xml pobranym z serwera są encje, które zastępują określone znaki: tutaj zamiast " masz &quot]. Trzeba by jeszcze te encje pozamieniać na odpowiednie znaki przed wyświetleniem. Nie wiem, czy są na to jakieś funkcje w bashu, może ktoś bardziej z nim obeznany się wypowie, a jak nie, to wiesz pod jakim kątem szukać.
ODPOWIEDZ