| Author |
Message |
01micko

Joined: 11 Oct 2008 Posts: 7017 Location: qld
|
Posted: Mon 31 Dec 2012, 23:17 Post subject:
|
|
Hello vovchik
To get your weather code (replace zipcode variable) you have to jump through some hoops. You go to the download page for accuweather and get the "Net Weather" as if you were to add it to your website. Agree to their terms and a code box is presented. Scroll to the zipcode part and there is your weather code, replace spaces with %20. Mine is: | Code: | | zipcode='OCN|AU|QLD|GOLD%20COAST|&metric=1' | as it appears in /usr/share/sit/functions, works but is in farenheit. Would likely need to parse the METRIC= option in seaside's script for a choice. Or do the math, either way.
EDIT: no need for math or extra code, just add the "&metric=1" bit further down in the code for celcius.. edited my code and it works. For farenheit, no param or metric=0.
| Description |
|
| Filesize |
9.37 KB |
| Viewed |
636 Time(s) |

|
| Description |
|
| Filesize |
32.38 KB |
| Viewed |
646 Time(s) |

|
_________________ keep the faith .. 
|
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1229 Location: Ukraine
|
Posted: Tue 01 Jan 2013, 06:29 Post subject:
|
|
Dear 01micko,
Happy New Year! You solved the problen in a very clever way. No need to register, but almost, to see the address. I also now get Celcius, which is what I want. Thanks.
With kind regards,
vovchik
|
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 7017 Location: qld
|
Posted: Tue 01 Jan 2013, 07:44 Post subject:
|
|
Hello vovchik
Yes, it is the same weather code as Pwidgets uses, but I didn't know you could append the "metric=" bit to that code, a handy feature.
Once upon a time Accuweather had that code in the URL for a location, but now it is hidden away in the html. I just stumbled upon the "Net Weather" method, kind of an "educated guess". Easy enough I think .
Happy New Year to you too.
_________________ keep the faith .. 
|
|
Back to top
|
|
 |
Geoffrey

Joined: 30 May 2010 Posts: 919 Location: Queensland Australia ɹǝpu∩uʍop
|
Posted: Tue 01 Jan 2013, 10:06 Post subject:
|
|
I had a bit of a play with this weather app, I managed to get it working using yad for the notification.
| Code: | #! /bin/bash
function refresh() {
zipcode='10012' # <<< put zipcode here
loc='http://rss.accuweather.com/rss/liveweather_rss.asp?locCode='"$zipcode"''
wget -O /tmp/tweather $loc
w=`xml-printf '%s\n' /tmp/tweather :/rss/channel/item/description`
i=o
while read line; do
array[$((++i))]=$line
case $i in
1) CURRENT=${line%%<*} CURRENTI=${line#*=} CURRENTI=${CURRENTI/>/} ; wget -O /tmp/currenti ${CURRENTI//\"/} ;;
2) RANGE=${line%%<*} ;;
3) TOMORROW=${line%%<*} ;;
*) ;;
esac
done <<<"$w"
echo "$CURRENT
$RANGE
-------------------------------------------------------------------
Tomorrow: $TOMORROW" >/tmp/tweather-tip
}
export -f refresh
sh -c refresh
line1=`awk 'NR==1' < /tmp/tweather-tip`
line2=`awk 'NR==2' < /tmp/tweather-tip`
line3=`awk 'NR==3' < /tmp/tweather-tip`
line4=`awk 'NR==4' < /tmp/tweather-tip`
exec yad --notification --text="$line1 $line2 $line3 $line4" --image="/tmp/currenti" --command "sh -c refresh" |
_________________ AdobeAIR App Links: HERE
Carolina: Recent Repository Additions
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 832
|
Posted: Tue 01 Jan 2013, 13:04 Post subject:
tweather Subject description: zipcodes |
|
01micko,
I was pleased to see that you found a world solution for Accuweather because I just took a look at Yahoo weather and while they have the same xml path to the "description" tag, the actual content is composed of DATA html markup. Short of stripping out the html code, I'm not sure how sit can display any markup.
Geoffrey,
Yes, nice and Yad is always a good swiss army knife located comfortably between Xdialog and gtkdialog.
vovchik ,
I feel much warmer knowing that you'll be able to tell exactly how cold it is where you are.
A very Happy New Year to all,
s
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Tue 01 Jan 2013, 19:11 Post subject:
|
|
to get markup from rss feeds most people typically grep for the needed tag and then strip the tags out using sed ... I use shell only methods such as:
(just the jist of it - not tested, and I always seem to mix up ## and %%)
| Code: | wget -O - url | while read LINE; do
case "$LINE in" *something*)
CONTENT=${LINE%%* beginning stuff to remove>}
CONTENT=${CONTENT##</end stuff to remove*}
echo $CONTENT >>somefile.svg
;;
esac
done |
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
mavrothal

Joined: 24 Aug 2009 Posts: 1058
|
Posted: Fri 04 Jan 2013, 03:54 Post subject:
|
|
| seaside wrote: |
As the latest sit by default looks for functions in /usr/share/sit/functions, the above script will not refresh. So I moved the refresh function to /usr/share/sit/function*refresh. I also combined sit 1.0, xml-printf (your nicely reduced one) and tweather into an all inclusive pet as attached.
|
Works nicely with JWM tray and also with tint2 that I tried it.
I have this little /root/Startup script (since is will fail with no connection in pace).
| Code: | #!/bin/sh
IFCONFIG="`ifconfig | grep '^[pwe]' | grep -v 'wmaster'`"
while [ "$IFCONFIG" != "" ]; do
sleep 1
ping -c 1 8.8.8.8
if [ $? -eq 0 ];then
break
else
ping -c 1 www.google.com
if [ $? -eq 0 ];then
break
fi
fi
done
tweather |
One "problem" I have is that right-click on the applet will quit it.
How do I avoid this?
Happy New Year.
_________________ Kids all over the world go around with an XO laptop. They deserve one puppy (or many) too 
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 832
|
Posted: Fri 04 Jan 2013, 13:25 Post subject:
|
|
| mavrothal wrote: |
One "problem" I have is that right-click on the applet will quit it.
How do I avoid this?
Happy New Year. |
mavrothal,
Happy New Year to you as well.
You can change this line-
| Code: | | sit /tmp/currenti /tmp/tweather-tip refresh "kill $( </tmp/tweatherpid)" & |
to
| Code: | | sit /tmp/currenti /tmp/tweather-tip refresh & |
That should reassign the right-click to no action.
Nice script for checking if your connection is up.
Regards,
s
|
|
Back to top
|
|
 |
Geoffrey

Joined: 30 May 2010 Posts: 919 Location: Queensland Australia ɹǝpu∩uʍop
|
Posted: Fri 04 Jan 2013, 19:41 Post subject:
|
|
| mavrothal wrote: |
I have this little /root/Startup script (since is will fail with no connection in pace).
| Code: | #!/bin/sh
IFCONFIG="`ifconfig | grep '^[pwe]' | grep -v 'wmaster'`"
while [ "$IFCONFIG" != "" ]; do
sleep 1
ping -c 1 8.8.8.8
if [ $? -eq 0 ];then
break
else
ping -c 1 www.google.com
if [ $? -eq 0 ];then
break
fi
fi
done
tweather |
|
Nice, I was only the other day looking for such a script, I found that cairo-dock with it's weather widget has the same dilemma, I will be using this, thanks.
_________________ AdobeAIR App Links: HERE
Carolina: Recent Repository Additions
|
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1229 Location: Ukraine
|
Posted: Mon 07 Jan 2013, 10:17 Post subject:
Yweather 0.1a - taskbar weather app |
|
Dear guys,
I have coded a taskbar weather app in BaCon - based on Yahoo's weather API - and it is available here: http://www.murga-linux.com/puppy/viewtopic.php?p=676079#676079.
Have fun....
With kind regards,
vovchik
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 832
|
Posted: Mon 07 Jan 2013, 12:40 Post subject:
|
|
technosaurus,
I noticed that Vovchik's Yweather application uses markup in the icon tooltip.
Is it possible for "sit" to do this as well?
Regards,
s
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Tue 08 Jan 2013, 13:00 Post subject:
|
|
you can now,... http://developer.gnome.org/pango/stable/PangoMarkupFormat.html
(just had to change *tooltip_text to *tooltip_markup ... unformatted text still works too, though I didn't check new lines)
I have included the current master branch which should build on Linux, BSD, Mac and Win32/64
the win32 version has lots of downloads but no comments, if anyone is using it let me know its shortcomings so I can improve its cross platform abilities (for example what would be a good path for includefiles? C:\\MinGW...) ... same goes for Mac if anyone has built it... so I can put out another point release.
| Description |
|

Download |
| Filename |
sit-master.tar.gz |
| Filesize |
3.89 KB |
| Downloaded |
70 Time(s) |
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1229 Location: Ukraine
|
Posted: Tue 08 Jan 2013, 13:11 Post subject:
|
|
Dear technosaurus,
Very nice. I like the addition of markup.
With kind regards,
vovchik
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 832
|
Posted: Tue 08 Jan 2013, 17:40 Post subject:
|
|
technosaurus,
You have done it again. Works nicely indeed, thank you.
New lines seem to work just fine.
I really think sit should be part of Puppy, as it is versatile, small, and so easily implements an attractive interface.
Best Regards,
s
|
|
Back to top
|
|
 |
jamesbond
Joined: 26 Feb 2007 Posts: 1531 Location: The Blue Marble
|
Posted: Wed 23 Jan 2013, 22:05 Post subject:
|
|
Patch:
1. Remove default include files path (if this path doesn't exist, execution fails - bad)
2. change popen mode from "r" to "w" - otherwise no output
3. ensure pclose after popen so that we don't get zombie process
4. close pid from g_spawn_async
5 add version numbering so we know which version of sit this is.
6. modify build process so that it is 64-bit compatible (should still work on 32-bit)
7. modify build process so that it tests correctly
| Description |
|

Download |
| Filename |
sit-master-james.patch.gz |
| Filesize |
1.43 KB |
| Downloaded |
53 Time(s) |
_________________ Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
|
|
Back to top
|
|
 |
|