Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 24 Oct 2014, 06:26
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
simple icon tray
Post new topic   Reply to topic View previous topic :: View next topic
Page 7 of 8 [116 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, 8 Next
Author Message
01micko


Joined: 11 Oct 2008
Posts: 7835
Location: qld

PostPosted: 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.
capture29320.png
 Description   
 Filesize   9.37 KB
 Viewed   1079 Time(s)

capture29320.png

capture29633.png
 Description   
 Filesize   32.38 KB
 Viewed   1103 Time(s)

capture29633.png


_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: 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
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7835
Location: qld

PostPosted: 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 Smile .

Happy New Year to you too.

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
Geoffrey


Joined: 30 May 2010
Posts: 1432
Location: Queensland Australia ɹǝpu∩uʍop

PostPosted: 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"

_________________
Carolina: Recent Repository Additions
Create strikethrough text HERE
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: 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. Very Happy

A very Happy New Year to all,
s
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: 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

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 1698

PostPosted: 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 Very Happy
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: 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
View user's profile Send private message 
Geoffrey


Joined: 30 May 2010
Posts: 1432
Location: Queensland Australia ɹǝpu∩uʍop

PostPosted: 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.

_________________
Carolina: Recent Repository Additions
Create strikethrough text HERE
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: 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
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: 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? Question

Regards,
s
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: 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.
sit-master.tar.gz
Description 
gz

 Download 
Filename  sit-master.tar.gz 
Filesize  3.89 KB 
Downloaded  267 Time(s) 

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: 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
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: 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
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2230
Location: The Blue Marble

PostPosted: 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
sit-master-james.patch.gz
Description 
gz

 Download 
Filename  sit-master-james.patch.gz 
Filesize  1.43 KB 
Downloaded  251 Time(s) 

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 7 of 8 [116 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, 8 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0970s ][ Queries: 13 (0.0068s) ][ GZIP on ]