You are not logged in.

#1 2011-02-01 17:44:05

MystKid
Member
Registered: 2011-01-24
Posts: 55

Weather Conky

hello guyts i have been trying to get weather from conky but i keep getting invalid partner code. my location is "gorizia italy" and this are my scripts codes:

LOCID=$ITXX0121

# s=standard units, m=metric units
UNITS=m

# where this script and the XSLT lives
RUNDIR=/home/nico-arch/Scripts

# there's probably other stuff besides CURL that will work for this, but i haven't 
# tried any others. 
# you can get curl at http://curl.haxx.se/
CURLCMD=/usr/bin/curl

# get it at http://xmlsoft.org/XSLT/
XSLTCMD=/usr/bin/xsltproc

# you probably don't need to modify anything below this point....

# CURL url. Use cc=* for current forecast or dayf=10 to get a multi-day forecast
CURLURL="http://xoap.weather.com/weather/local/$LOCID?cc=*&unit=$UNITS&dayf=2"

# The XSLT to use when translating the response from weather.com
# You can modify this xslt to your liking 
XSLT=$RUNDIR/weather.xslt 

#filter (if you want to convert stuff to lower-case or upper case or something)
#FILTER="|gawk '{print(tolower(\$0));}'"


#####
eval "$CURLCMD \"$CURLURL\" 2>/dev/null| $XSLTCMD $XSLT - $FILTER"

this is in my conkyrc. i tryed many ways for the location but none of them worked so far

${execi 1800 /home/nico-arch/Scripts/weather.sh ITXX0121}

this is my weather.xslt

<!-- 

 This XSLT is used to translate an XML response from the weather.com
 XML API. 

 You can format this file to your liking. Two things you may feel 
 like doing:

    1) Modify the layout of the fields or static text already defined
    2) Add other fields from the XML response file that aren't referenced in this
       XSLT. You can grab a full list by just doing a: 
           wget "http://xoap.weather.com/weather/local/$LOCID?cc=*&unit=$UNITS" 
           (change $LOCID and $UNITS to suit your needs)
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > 
    <xsl:output method="text" disable-output-escaping="yes"/>
    <xsl:template match="weather">
        <xsl:apply-templates select="cc"/>
        <xsl:apply-templates select="dayf/day[@d='1']"/>
    </xsl:template>
 
    
    <xsl:template match="cc">

<xsl:text>  Temperature: </xsl:text><xsl:value-of select="tmp"/><xsl:value-of select="/weather/head/ut"/>
<xsl:if test="tmp != flik">
<xsl:text>
  Feels Like: </xsl:text><xsl:value-of select="flik"/><xsl:value-of select="/weather/head/ut"/>
</xsl:if>
<xsl:text>
  Conditions: </xsl:text><xsl:value-of select="t"/>
<xsl:text>
  Wind: </xsl:text>
<xsl:choose>
    <xsl:when test="wind/s = 'calm'"><xsl:text>0</xsl:text></xsl:when>
    <xsl:otherwise><xsl:value-of select="wind/s"/></xsl:otherwise>
</xsl:choose>
<xsl:value-of select="/weather/head/us"/> 
<xsl:choose>
    <xsl:when test="wind/s = 'calm'"><xsl:text>(0mph)</xsl:text></xsl:when>
    <xsl:otherwise><xsl:text> (</xsl:text><xsl:value-of select="round(wind/s * 0.6214)"/><xsl:text>mph)</xsl:text></xsl:otherwise>
</xsl:choose>
<xsl:text> (</xsl:text><xsl:value-of select="wind/t"/>
<xsl:text>)</xsl:text>
    </xsl:template>

    <xsl:template match="dayf/day[@d='1']">
<xsl:text>
  Tomorrow: </xsl:text><xsl:value-of select="low"/><xsl:value-of select="/weather/head/ut"/>
<xsl:text> to </xsl:text><xsl:value-of select="hi"/><xsl:value-of select="/weather/head/ut"/>
<xsl:text>, </xsl:text><xsl:value-of select="part[@p='d']/t"/>
<xsl:text>
  </xsl:text><xsl:value-of select="/weather/swa/a/t"/>
<xsl:text>
</xsl:text>
    </xsl:template>
</xsl:stylesheet>

Last edited by MystKid (2011-02-01 18:13:45)

Offline

#2 2011-02-03 20:34:32

andrewthomas
Member
Registered: 2010-05-08
Posts: 52

Re: Weather Conky

What does your .conkyForecast.config look like?


If this helped you, please take the time to rate the value of this post:
http://rate.affero.net/andrewthomas/

Offline

Board footer

Powered by FluxBB