SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#226 2012-01-12 02:15:40

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:
Sector11 wrote:
mrpeachy wrote:

only what i posted here

Hmmmmm no that's yours with centre day of 3 columns a bit lower.  I was looking for the template you did that was my "look-alike"

OK, I'll try and recreate it with v9000 when I get time.  big_smile

i think its the same apart from the layout of the forecast days
those are placed using the forecast repeat method, i had to rearrange them to get the info on my screen
you can move the forecast days position by just setting the top left corner in the script here:

--enter coordinates of top left corner for each day
topx1,topx2,topy=15,175,315
gap=80
top_left_x_coordinate[2],top_left_y_coordinate[2]=topx1,topy
top_left_x_coordinate[3],top_left_y_coordinate[3]=topx2,topy
top_left_x_coordinate[4],top_left_y_coordinate[4]=topx1+80,topy+(gap/2)
top_left_x_coordinate[5],top_left_y_coordinate[5]=topx1,topy+gap
top_left_x_coordinate[6],top_left_y_coordinate[6]=topx2,topy+gap
top_left_x_coordinate[7],top_left_y_coordinate[7]=topx1+80,topy+(gap/2)+gap
top_left_x_coordinate[8],top_left_y_coordinate[8]=topx1,topy+gap+gap
top_left_x_coordinate[9],top_left_y_coordinate[9]=topx2,topy+gap+gap

Yea, that's what I need to figure out ... big_smile

AND I have another layout in mind too.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

Help fund CrunchBang, donate to the project!

#227 2012-01-12 02:43:28

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

here is something i thought i would try
having the weather_display function saves as a seperate file to the main processing script
and it works

PART 6 - how to work with a separate display script and main script
NOTE - if you read this post before i edited it then i had explained how a previous method for importing the display function was not working correctly.
i have gotten around the problem of the conky not updating when the display script is edited and have updated the information below


1. seperate out the 2 scripts
go to the bottom of the existing lua script, weatheragain9000.lua (or whatever you saved it as)
and delete the existing weather_display function (or better yet, select the function, cut and paste it into a blank document)

whichever way ypu go, you want to end up with 2 files,
the current lua script minus the weather_display function (i'll refer to this as the main script)
the last line of the main script will look like this (updated)

end--function image ##################################################################

and a second file that consists of ONLY the weather display function.  both files should be saved as .lua scripts

whatever you want to call them.lua

(i'll refer to this second script as the display script)

2.  edit the display script and make the following changes
where the script says

weather_display()

it should instead read (updated)

_G.weather_script = function()

for example
weather_display.lua

_G.weather_script = function()--###############################################
--these tables hold the top left coordinates for each repeat as set lower, do not edit ######
top_left_x_coordinate={}--################################################################
top_left_y_coordinate={}--################################################################
--##################################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE -- 
out({c=0xffffff,a=1,f="mono",fs=12,x=100,y=100,txt="Hello World"})
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE --
--##################################################################
end--of weather_display function do not edit this line ###############

ADDITIONALLY
you can move your default settings for fonts, colors etc from the setup part of the main function to the display script so the display script would look like this

_G.weather_script = function()--###############################################
--these tables hold the top left coordinates for each repeat as set lower, do not edit ######
top_left_x_coordinate={}--################################################################
top_left_y_coordinate={}--################################################################
--######################################################
--SET DEFAULTS--SET DEFAULTS--SET DEFAULTS--SET DEFAULTS
default_font="mono"--font must be in quotes
default_font_size=12
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--##################################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE -- 
out({c=0xffffff,a=1,f="mono",fs=12,x=100,y=100,txt="Hello World"})
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE --
--##################################################################
end--of weather_display function do not edit this line ###############

3.  edit the main function and make these changes updated
in the current dropbox script there is a setting n the setup section of the script towards the top
line 50 should be this

local display_script=0 -- set 1 for seperate display script, 0 to enter at bottom

edit that setting as needed


4. edit the conkyrc
the lua setup from the conkyrc should look something like this

lua_load ~/Dropbox/Public/weatheragain9000.lua
lua_draw_hook_pre weather

you just have to add another lua_load line pointing to the display script

lua_load ~/lua/v9000.lua
lua_load ~/Dropbox/Public/weatheragain9000.lua
lua_draw_hook_pre weather

fire it up and now you can edit the display script and the changes will be shown immediately

NOTE
this is a new way of operating a lua script that i have not tried before and while it is looking very promising and everything is working as expected, this method could be considered in the testing phase
but feel free to use it, the big advantage is that you can go and edit ypur display script without ever having to touch the main script

Last edited by mrpeachy (2012-01-14 02:58:45)

Offline

#228 2012-01-12 02:45:29

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

Sector11 wrote:

Yea, that's what I need to figure out ... big_smile

AND I have another layout in mind too.

you dont have to use equations and calculations to set the coordinates, good old numbers directly work just as well smile

if you want any help then just ask!

Offline

#229 2012-01-12 04:02:45

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

re using a seperate weather display script
while i think this is a good thing to try out
for now any updates or bug fixes will retain the existing format and functionality

if you want to separate the scripts just follow the instructions
big_smile

in addition to the benefit of not having to open the main function another benefit is that you could have multiple scripts
display1.lua
display2.lua
display3.lua

each containing a different setup

then you could switch between them by calling the one you want via lua_load in the conkyrc

Last edited by mrpeachy (2012-01-12 04:07:37)

Offline

#230 2012-01-12 05:45:15

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

i thought that it wasnt all that helpful to have the script come with a default output of "Hello World" so now you get a small default weather display
screenshot6d703538a9edd68026547ce541a10a45.png
i have also been overlooking the need to provide the additional files that people will need
here is the script as usual
http://dl.dropbox.com/u/19008369/weathe … lua.tar.gz
here are the additional files you need
http://dl.dropbox.com/u/19008369/additi … les.tar.gz

ill update the first section of howto

ALSO
i have edited the first post with links to the v9000 howto's so thats an easy way to find them!

Last edited by mrpeachy (2012-01-12 06:00:48)

Offline

#231 2012-01-12 07:12:05

handy
Member
Registered: 2011-12-31
Posts: 34

Re: weather in conky (LUA scripts) updated 12/26/13!

This is not weather related so please tell me to take it elsewhere if it is inappropriate?

I just noticed that whilst using a torrent & having (at the time of this writing) downloaded well over 4GB of data, my conky says Total Down: 65.9MiB (& counting, so it is alive).

This is the line from the conkyrc:

Total Down: ${alignr}${totaldown eth0} 

Does anyone have any ideas about that?


[edit:] I just had an ah ha experience. Which makes me feel somewhat embarrassed.

I'm using a torrent slave, so what is being counted on this machine has little (if anything) to do with that 4+GB that has been downloaded.

Sorry to have wasted your time, though by the time you get to reading this it may just be worth it for the chuckle... wink

Last edited by handy (2012-01-12 07:18:15)

Offline

#232 2012-01-12 11:38:29

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: weather in conky (LUA scripts) updated 12/26/13!

handy wrote:

This is not weather related so please tell me to take it elsewhere if it is inappropriate?

I just noticed that whilst using a torrent & having (at the time of this writing) downloaded well over 4GB of data, my conky says Total Down: 65.9MiB (& counting, so it is alive).

This is the line from the conkyrc:

Total Down: ${alignr}${totaldown eth0} 

Does anyone have any ideas about that?


[edit:] I just had an ah ha experience. Which makes me feel somewhat embarrassed.

I'm using a torrent slave, so what is being counted on this machine has little (if anything) to do with that 4+GB that has been downloaded.

Sorry to have wasted your time, though by the time you get to reading this it may just be worth it for the chuckle... wink

Glad you figured it out.  We all have moments of cranial flatulation (aka brain farts) like that. big_smile

This post would have been more appropriate in the Conky Monster Thread.

Offline

#233 2012-01-12 18:26:46

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

intellicast has given me another unexpected output
visibility: 1.7mi

i hadnt anticipated the decimal point so the script gives an error for line 459

fixed in the dropbox link here
http://dl.dropbox.com/u/19008369/weathe … lua.tar.gz

also made a couple of other minor changes/fixes and made the implementation of seperate display and main script easier by adding a setting to the script in the setup section

Last edited by mrpeachy (2012-01-12 19:02:50)

Offline

#234 2012-01-12 20:36:51

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

bugs are cropping up today it seems
for current weather i am getting the conditions from this line

<img src="http://images.intellicast.com/App_Images/40_white/wx_83.png" title="Overcast" alt="Overcast" class="Icon" /> Moderate Snow

previously the text was taken from
title="Overcast"
however what should be seen is "Moderate Snow"
so i've modified the search and match command and fixed this bug

Offline

#235 2012-01-12 23:53:55

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

ive been playing around with weather to kill some time
a short function to rotate text and came up with this

screenshot7196cfb3f5ff29192ec4ad4b002a40fd.png

Last edited by mrpeachy (2012-01-13 00:00:45)

Offline

#236 2012-01-12 23:58:24

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

screenshot822cb8a1e54b89d669b474bc582dfe58.png

Been busy with other things today ... have to say that looks nice and as practical as a sore neck reading it.  big_smile

But ... that said ... it's a programming marvel!


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#237 2012-01-13 00:01:56

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

Sector11 wrote:

Been busy with other things today ... have to say that looks nice and as practical as a sore neck reading it.  big_smile

But ... that said ... it's a programming marvel!

eye candy over practicality! big_smile
just noticed that i hadnt set my days up...so edited my image

Last edited by mrpeachy (2012-01-13 00:03:34)

Offline

#238 2012-01-13 12:26:21

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: weather in conky (LUA scripts) updated 12/26/13!

I'm using the v9000 and your tutorial.  How can I get the sun set/rise time without the am/pm?

I tried to edit lines 300 and 306 in v9000 but I get errors from the lines that I call the times..

line 300 - s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",start)
line 306 - s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)

Last edited by ackernan (2012-01-13 12:27:17)

Offline

#239 2012-01-13 14:44:11

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

ackernan wrote:

I'm using the v9000 and your tutorial.  How can I get the sun set/rise time without the am/pm?

I tried to edit lines 300 and 306 in v9000 but I get errors from the lines that I call the times..

line 300 - s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",start)
line 306 - s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)

how is it going?  everything making sense i hope smile

right now you would have to go editing the main body of the script
i made the decision to "hard code" the am pm onto the sun and moon times

however it will be easy to go and make some changes and update the list of data options to seperate the times from the am/pm's

wont be done till later today as im will be out for a while

Offline

#240 2012-01-13 15:10:23

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

how is it going?  everything making sense i hope smile

right now you would have to go editing the main body of the script
i made the decision to "hard code" the am pm onto the sun and moon times

however it will be easy to go and make some changes and update the list of data options to seperate the times from the am/pm's

wont be done till later today as im will be out for a while

It's all going well.  Thanks for the excellent tutorial.  The am/pm thing is minor.  Thanks for the help.

Offline

#241 2012-01-13 18:08:44

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

well i have access to a computer after all so here is an update
http://dl.dropbox.com/u/19008369/weathe … lua.tar.gz
new data options

sun_rise[n] --> 6:15 AM
sun_rise_lc[n] --> 6:15 am
sun_rise_time[n] --> 6:15
moon_rise[n] --> 11.44 PM
moon_rise_lc[n] --> 11:44 pm
moon_rise_time[n] --> 11:44
moon_rise_ampm[n] --> PM
moon_rise_ampm_lc[n] --> pm
sun_set[n] --> 5:28 PM
sun_set_lc[n] --> 5:28 pm
sun_set_time[n] --> 5:28
moon_set[n] --> 3:18 AM
moon_set_lc[n] --> 3:18 am
moon_set_time[n] --> 3:18
moon_set_ampm[n] --> AM
moon_set_ampm_lc[n] --> am

ive edited the howto to reflect the changes
it really is quite easy to add additional options, so if you have a request let me know!

I am going to look into getting the hourly (next 3 hours) "today's forecast" that you see at the top of the intellicast page set up as options also
the only snag about that is that it used icons from a directory called "32_white" while the main images are from "40_white"

and while it would be nice to assume that

/32_white/wx_65.png

means and looks like

/40_white/wx_65.png

there is no guarantee that they match up

Last edited by mrpeachy (2012-01-13 18:11:53)

Offline

#242 2012-01-13 18:30:39

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

well i have access to a computer after all so here is an update
http://dl.dropbox.com/u/19008369/weathe … lua.tar.gz
new data options

sun_rise[n] --> 6:15 AM
sun_rise_lc[n] --> 6:15 am
sun_rise_time[n] --> 6:15
....

Thanks for the update, it works perfectly except my weather images disappeared.

** Nevermind, I forgot to change where my weather images are kept. roll

Last edited by ackernan (2012-01-13 18:41:07)

Offline

#243 2012-01-13 22:26:23

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,727

Re: weather in conky (LUA scripts) updated 12/26/13!

Sorry Gentleman but I have a Lua question..

How would I call this in Lua?

{execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //' | sort -u | cut -c1-60}

I'm trying to do all my text in Lua... if possible.

I mean no disrespect MrPeachy if I should have started a new thread with this question.

Last edited by falldown (2012-01-13 22:36:20)

Offline

#244 2012-01-13 22:54:23

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

falldown wrote:

Sorry Gentleman but I have a Lua question..

How would I call this in Lua?

{execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //' | sort -u | cut -c1-60}

I'm trying to do all my text in Lua... if possible.

I mean no disrespect MrPeachy if I should have started a new thread with this question.

i check the conky thread regularly
so go ahead and post any general lua question there
ill copy your question and answer it over there smile

Offline

#245 2012-01-14 00:42:53

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

another update with more data options

screenshot1029de81ff3dc8e41afba2bd8aa09632.png

options are for the next 3 hour weather today forecast

now["fc_hour1_time"] --> 8 (hour only, number only)
now["fc_hour1_ampm"] --> PM (either AM or PM in caps)
now["fc_hour1_ampm_lc"] --> pm (am or pm in lower case)
now["fc_hour1_cond"] --> P Cloudy (the shortened version of wether direct from intellicast)
now["fc_hour1_cond_lc"] --> p cloudy
now["fc_hour1_cond_caps"] --> P CLOUDY
now["fc_hour1_wicon"] --> outputs the full path to the weather icon for use with the image() function
now["fc_hour1_wfont"] --> outputs the character for the weather font
now["fc_hour1_temp"] --> outputs forecast temp (number only)

there are 3 hours in the forecast, simply replace "hour1" with "hour2" or "hour3" depends on which hour you want

ill upadate section1 also
you can get the script there also, via the first post

Last edited by mrpeachy (2012-01-14 01:12:43)

Offline

#246 2012-01-14 02:27:03

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

another update with more data options

screenshot1029de81ff3dc8e41afba2bd8aa09632.png

...

The lua script keeps growing! big_smile

Offline

#247 2012-01-14 02:53:48

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

ackernan wrote:

The lua script keeps growing! big_smile

now that the script is running reliably, i can think about adding functionality
although any new additions will be just that, and will not affect the way the existing script function
backwards compatibility!

so you can take your weather_display setup and plug it into the newest update and it will still work as you expect

also that is now all the information that intellicast has to offer
at least as much as i am going to process
they do have those short text westher summaries, but i dont find them very useful
they also have weather alerts which could be useful but is blank most of the time

i was thinking of putting in a modified version of the bg drawing code which can then be set up in the weather_display section

been playing with the idea and made this
screenshot-1306.png

im not sure how much value there is it, you could achieve a similar result by just calling multiple instances of ${lua draw_bg settings) below text in conkyrc and get a similar result
draw_bg cant draw outlines however

not sure if bg will make it to dropbox smile

EDIT
@ ackernan
I haven't yet said
"well done!"
on your conky
looks good and thanks for trying out (and kudos for succeeding with) my script

Last edited by mrpeachy (2012-01-14 03:11:38)

Offline

#248 2012-01-14 11:19:42

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

@ ackernan
I haven't yet said
"well done!"
on your conky
looks good and thanks for trying out (and kudos for succeeding with) my script

Thanks & your welcome.  Thanks again for the tutorial, it helped a lot with the display. big_smile

The moon phases will change and the words under the moon icon will change in length.  How can I have the moon phase words always be centered on the icon?  Here's what I'm using now.

out({c=0xffffff,a=1,f="Moon phases",fs=32,x=230,y=560,txt=moon_font[1]})
out({c=0xffffff,a=1,f="santana-black",fs=11,x=195,y=580,txt=moon_phase[1]})

Screenshot_2.jpg

Last edited by ackernan (2012-01-14 11:34:10)

Offline

#249 2012-01-14 15:50:30

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

ackernan wrote:

The moon phases will change and the words under the moon icon will change in length.  How can I have the moon phase words always be centered on the icon?  Here's what I'm using now.

out({c=0xffffff,a=1,f="Moon phases",fs=32,x=230,y=560,txt=moon_font[1]})
out({c=0xffffff,a=1,f="santana-black",fs=11,x=195,y=580,txt=moon_phase[1]})

at the moment it would require some additional scripting
ive been thinking about writing some variations on the out() function
a function xout() that writes output just like out but also measures the length of the text so you can follow it up with text that will move as the first entry changes

it would be quite easy to write a variation jout() for example that has additional justify settings, set left, middle or right and then the x,y coordinates you set in the function used accordingly

i'll update dropbox soon

Offline

Help fund CrunchBang, donate to the project!

#250 2012-01-14 16:38:59

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

at the moment it would require some additional scripting
ive been thinking about writing some variations on the out() function
a function xout() that writes output just like out but also measures the length of the text so you can follow it up with text that will move as the first entry changes

it would be quite easy to write a variation jout() for example that has additional justify settings, set left, middle or right and then the x,y coordinates you set in the function used accordingly

i'll update dropbox soon

okey doke, thanks.  Looking forward to the update.

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo