SEARCH

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

You are not logged in.

#5176 2013-04-27 01:26:48

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,186
Website

Re: Conky v1.9 Thread

Rutz wrote:

Okay..It says:

from: can't read /var/mail/BeautifulSoup
/etc/conky/distrowatch.py: 6: address: not found
/etc/conky/distrowatch.py: 7: try:: not found
/etc/conky/distrowatch.py: 8: Syntax error: "(" unexpected

That looks like a python-beautifulsoup problem.  I ran both versions of the scrip with the "original" url and the "30 day ranking" urls and get no error message at all:

The conky:

TEXT
CrunchBang = 19
${execpi 3600 ~/bin/iggykoopa-dw.py}  or  ${execpi 3600 ~/bin/iggykoopa-distrowatch.py}

Run from a terminal:

 26 Apr 13 | 22:08:05 ~
         $ conky -c /media/5/Conky/S11_idw.conky &
[1] 2315
 
 26 Apr 13 | 22:08:09 ~
         $ Conky: forked to background, pid is 2320

Conky: desktop window (264) is root window
Conky: window type - normal
Conky: drawing to created window (0xe00001)
Conky: drawing to double buffer

What I do see is:

CrunchBang = 19
Not Available  or  Not Available

And running the python scripts directly in a terminal:

 26 Apr 13 | 22:14:12 ~
         $ iggykoopa-dw.py
Not Available
 
 26 Apr 13 | 22:14:16 ~
         $ iggykoopa-distrowatch.py
Not Available
 
 26 Apr 13 | 22:14:33 ~
         $ 

I PM'd iggy and will research more.


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

Help fund CrunchBang, donate to the project!

#5177 2013-04-27 01:30:27

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,186
Website

Re: Conky v1.9 Thread

mrpeachy wrote:

color change thermometers for v9000

http://s12.postimg.org/9y6oggvrd/Screenshot_at_2013_04_26_18_33_00.jpg

ragamartix's post a few back caught my interest and I had some free time so i tired incorporating the thermometers into a v9000 template

AWESOME!  I will have to look at that!


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#5178 2013-04-27 01:47:17

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

You should be able to run

python /path/to/iggykoopa-dw.py 

or

python /path/to/python /path/to/iggykoopa-dw.py 

and it will find it

TO the OP, any python script will also need to be executable


VSIDO | Words That Build Or Destroy

We do not run from challenges, they become new innovations within VSIDO!

Offline

#5179 2013-04-27 02:26:08

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,186
Website

Re: Conky v1.9 Thread

VastOne wrote:

You should be able to run

python /path/to/iggykoopa-dw.py 

python /path/to/iggykoopa-dw.py

or

python /path/to/python /path/to/iggykoopa-dw.py 

and it will find it

TO the OP, any python script will also need to be executable

They are in my path: ~/bin

 26 Apr 13 | 23:19:37 ~
         $ $PATH
bash: /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:[i]/home/sector11/bin[/i]: No such file or directory
 
 26 Apr 13 | 23:19:44 ~
         $ 

Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#5180 2013-04-27 02:28:51

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

Try

python ~/bin/iggykoopa-dw.py

or just

~/bin/iggykoopa-dw.py

VSIDO | Words That Build Or Destroy

We do not run from challenges, they become new innovations within VSIDO!

Offline

#5181 2013-04-27 02:54:27

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,186
Website

Re: Conky v1.9 Thread

In my conky:

CrunchBang = 19 ${execpi 3600 ~/bin/iggykoopa-dw.py}  or  ${execpi 3600 ~/bin/iggykoopa-distrowatch.py}
${execpi 3600 python ~/bin/iggykoopa-dw.py}  or  ${execpi 3600 python ~/bin/iggykoopa-distrowatch.py}
${execpi 3600 iggykoopa-dw.py}  or  ${execpi 3600 iggykoopa-distrowatch.py}

produce:
adbzRi8c.jpg

The same result: Not Available that I get in a terminal:

 26 Apr 13 | 23:45:50 ~
         $ iggykoopa-dw.py
Not Available
 
 26 Apr 13 | 23:45:55 ~
         $ iggykoopa-distrowatch.py
Not Available
 
 26 Apr 13 | 23:46:03 ~
         $ ~/bin/iggykoopa-dw.py
Not Available
 
 26 Apr 13 | 23:46:12 ~
         $ ~/bin/iggykoopa-distrowatch.py
Not Available
 
 26 Apr 13 | 23:46:22 ~
         $ python ~/bin/iggykoopa-dw.py
Not Available
 
 26 Apr 13 | 23:46:37 ~
         $ python ~/bin/iggykoopa-distrowatch.py
Not Available
 
 26 Apr 13 | 23:46:55 ~
         $ 

No errors anywhere.


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#5182 2013-04-27 12:55:03

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

@all lua-experts

i created a function to display conky-output within v9000. do u see something to optimize?

just the conky-output: http://ompldr.org/vaThrZQ
here an example: http://ompldr.org/vaThrYg

hint: if u do not want the endings then u can disable them smile

for example:

system({variable="fs_used",device="/home/alexander",del=',',se="no"})

here the complete code:

-- weather v9000 by mrpeachy 01/10/12; released: Feb 29, 2012
-- official update by mrpeachy
-- additional features by lionhead, arclance and dk75
-- last update 27.04.2013
require 'cairo'
require 'imlib2'
local username = os.getenv("USERNAME")
--you can enter your username here in case of errors, 
--enter username in quotes like this username = "yourname"
local username = "alexander"
package.path = '/home/'..username..'/.v9000_config.lua'
require '.v9000_config'

start=1
--INITIALIZE SETTINGS-- need only be run once
settings_table=weather_settings()
--##################################
--######## main function ########### 
function conky_weather()--##########
-- function to convert color into hex-code
function col(c,a)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,a
end--local function

if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
--###UNCOMMENT THE BELOW LINE TO ENABLE CPU DELAY##########################################################
--if updates>5 then--###### YOU WILL ALSO HAVE TO UNCOMMENT THE MATCHING end ON LINE 923 ####################
--#########################################################################################################
local testing=0--this setting is for script testing, if not in testing set to 0
--#########################################################################################################
--############start of timed section#######################################################################
--#########################################################################################################
local timer=(updates %tonumber(settings_table[1]))
if timer==0 or start==1 then--######
start=nil--#######################################
local web=settings_table[2]
local alert_check=settings_table[13]
print ("gathering data with curl")
local f=io.popen("curl --max-time 60 '"..web.."' | sed 's/%//g'")
allweatherdata=f:read("*a")
f:close()
allweatherdata=string.gsub(allweatherdata,"[\n\r]","")
testall=string.find(allweatherdata,">10 Day Forecast&nbsp")
--CHECK FOR WEATHER ALERTS
if testall~=nil and alert_check==1 then
local alert=string.find(allweatherdata,"Severe Weather Alert!")
	if alert~=nil then
	print ("getting weather alerts")
	--get alert web
	local a,b,alertchunk=string.find(allweatherdata,">Local Information</div>(.*)>Severe Weather Alert!<")
	local a,b,alertsite=string.find(alertchunk,"><a href=%p(.*)%p><img src=")
	local f=io.popen("curl --max-time 60 'http://www.intellicast.com"..alertsite.."' | sed 's/%//g'")
	alertdata=f:read("*a")
	f:close()
	alertdata=string.gsub(alertdata,"[\n\r]","")
	alerttest=string.find(alertdata,"%a")
	else
	print ("you have no weather alerts")
	alerttest=0
	end--if alert~=nil
else
print ("not checking for alerts")
alerttest=1
end--if testall and alert check
processall=1
end--of timed data gathering section
--in case curl craps up it should retry until it works
if testall==nil or  alerttest==nil then
print ("curl attempt timed out, trying again")
local web=settings_table[2]
local alert_check=settings_table[13]
local f=io.popen("curl --max-time 60 '"..web.."' | sed 's/%//g'")
allweatherdata=f:read("*a")
f:close()
allweatherdata=string.gsub(allweatherdata,"[\n\r]","")
testall=string.find(allweatherdata,">10 Day Forecast&nbsp")
--CHECK FOR WEATHER ALERTS
if testall~=nil and alert_check==1 then
local alert=string.find(allweatherdata,"Severe Weather Alert!")
	if alert~=nil then
	print ("getting weather alerts")
	--get alert web
	local a,b,alertchunk=string.find(allweatherdata,">Local Information</div>(.*)>Severe Weather Alert!<")
	local a,b,alertsite=string.find(alertchunk,"><a href=%p(.*)%p><img src=")
	local f=io.popen("curl --max-time 60 'http://www.intellicast.com"..alertsite.."' | sed 's/%//g'")
	alertdata=f:read("*a")
	f:close()
	alertdata=string.gsub(alertdata,"[\n\r]","")
	alerttest=string.find(alertdata,"%a")
	else
	print ("you have no weather alerts")
	alerttest=0
	end--if alert~=nil
else
print ("not checking for alerts")
alerttest=1
end--if testall and alert_check
processall=1
end--if testall==nil
--end or curl reruns
--START PROCESSING ###########################################################################
if testall~=nil and alerttest~=nil and processall==1 then
local weathericons=settings_table[3]
local con_short=settings_table[4]
local visibility_unit=settings_table[6]
local wind_mph_unit=settings_table[7]
local wind_km_unit=settings_table[8]
local wind_kts_unit=settings_table[9]
local ceiling_unit=settings_table[10]
local wind_degrees_unit=settings_table[11]
local translate=settings_table[12]
local alert_check=settings_table[13]
--LOAD TRANSLATE TABLES IF TRANSLATE SETTING = 1
	if translate==1 then
	monthshort=settings_table[21]
	monthnames=settings_table[20]
	dayhort=settings_table[19]
	daynames=settings_table[18]
	neswtext=settings_table[14]
	tsuffix=settings_table[15]
	uvindextext=settings_table[16]
	moonphases=settings_table[17]
	additional=settings_table[22]
	else--neswtext,tsuffix,uvindextext,moonphases,daynames,dayshort,monthnames,monthshort

	dayshort={Monday="Mon",Tuesday="Tue",Wednesday="Wed",Thursday="Thu",Friday="Fri",Saturday="Sat",Sunday="Sun"}
	monthshort={January="Jan",February="Feb",March="Mar",April="Apr",May="May",June="Jun",July="Jul",August="Aug",September="Sep",October="Oct",November="Nov",December="Dec"}
	end--end if translate =1
--process data tables
--intellicast to conky weather icon conversion
wimage={
wx_65="32",  -- Clear
wx_66="30",  -- Partly Cloudy
wx_67="26",  -- Cloudy
wx_68="32",  -- Clear
wx_69="28",  -- Mostly Cloudy
wx_70="20",  -- Fog
wx_71="32",  -- Clear
wx_72="21",  -- Haze
wx_73="36",  -- Hot
wx_74="14",  -- Light Snow Showers
wx_75="28",  -- Mostly Cloudy
wx_76="18",  -- Sleet
wx_77="14",  -- Light Snow Showers
wx_78="23",  -- Blustery
wx_79="05",  -- Mixed Rain and Snow
wx_80="15",  -- Drifting Snow
wx_81="15",  -- Drifting Snow
wx_82="11",  -- Light Rain
wx_83="16",  -- Snow
wx_84="00",  -- Tornado
wx_85="32",  -- Clear
wx_86="25",  -- N/A
wx_87="09",  -- Drizzle
wx_88="05",  -- Mixed Rain and Snow
wx_89="18",  -- Sleet
wx_90="18",  -- Sleet
wx_91="39",  -- Scattered Showers
wx_92="39",  -- Scattered Showers
wx_93="39",  -- Scattered Showers
wx_94="39",  -- Scattered Showers
wx_95="37",  -- Isolated Thunderstorms
wx_96="37",  -- Isolated Thunderstorms
wx_97="31",  -- Clear
wx_98="29",  -- Partly Cloudy
wx_99="27",  -- Mostly Cloudy
wx_100="47",  -- Isolated Thunderstorms
wx_101="47",  -- Isolated Thunderstorms
wx_102="33",  -- Fair
wx_103="26",  -- Cloudy
wx_104="20",  -- Fog
wx_105="45",  -- Scattered Showers
wx_106="45",  -- Scattered Showers
wx_107="11",  -- Light Rain
wx_108="46",  -- Snow Showers
wx_109="46",  -- Snow Showers
wx_110="06",  -- Mixed Rain and Sleet
wx_111="18",  -- Sleet
wx_112="06",  -- Mixed Rain and Sleet
wx_113="46",  -- Snow Showers
wx_114="46",  -- Snow Showers
wx_115="31",  -- Clear
wx_116="47",  -- Isolated Thunderstorms
}--end w image table
--convert intellicast icons to weather font
wfont={
wx_65="a",
wx_66="c",
wx_67="f",
wx_68="a",
wx_69="d",
wx_70="0",
wx_71="a",
wx_72="9",
wx_73="5",
wx_74="p",
wx_75="d",
wx_76="w",
wx_77="p",
wx_78="6",
wx_79="x",
wx_80="8",
wx_81="8",
wx_82="h",
wx_83="q",
wx_84="m",
wx_85="a",
wx_86="-",
wx_87="h",
wx_88="x",
wx_89="w",
wx_90="w",
wx_91="g",
wx_92="g",
wx_93="g",
wx_94="g",
wx_95="k",
wx_96="k",
wx_97="A",
wx_98="C",
wx_99="D",
wx_100="K",
wx_101="K",
wx_102="B",
wx_103="f",
wx_104="0",
wx_105="G",
wx_106="G",
wx_107="h",
wx_108="O",
wx_109="O",
wx_110="x",
wx_111="w",
wx_112="x",
wx_113="O",
wx_114="O",
wx_115="A",
wx_116="K",
}--end w font table
--conversion day and month tables
moonfontt={
["New"]="@",
["Full"]="=",
["First Quarter"]="T",
["Last Quarter"]="G",
["Waning Gibbous"]="D",
["Waning Crescent"]="J",
["Waxing Crescent"]="Q",
["Waxing Gibbous"]="W",
}--end of moon font table
moonicont={
["New"]=weathericons.."moon_new.png",
["Full"]=weathericons.."moon_full.png",
["First Quarter"]=weathericons.."moon_first_quarter.png",
["Last Quarter"]=weathericons.."moon_last_quarter.png",
["Waning Gibbous"]=weathericons.."moon_waning_gibbous.png",
["Waning Crescent"]=weathericons.."moon_waning_crescent.png",
["Waxing Crescent"]=weathericons.."moon_waxing_crescent.png",
["Waxing Gibbous"]=weathericons.."moon_waxing_gibbous.png",
}--end of moon icon table
windfontt={
S="9",
SSW=":",
SW=";",
WSW="<",
W="=",
WNW=">",
NW="?",
NNW="@",
N="1",
NNE="2",
NE="3",
ENE="4",
E="5",
ESE="6",
SE="7",
SSE="8"
}--end of wind direction font table
--setup tables for forecast weather
forecast_day={}
forecast_day_caps={}
forecast_day_lc={}
forecast_day_short={}
forecast_day_short_caps={}
forecast_day_short_lc={}
forecast_month={}
forecast_month_caps={}
forecast_month_lc={}
forecast_month_short={}
forecast_month_short_caps={}
forecast_month_short_lc={}
forecast_date={}
weather_icon={}
weather_font={}
high_temp={}
low_temp={}
conditions={}
conditions_caps={}
conditions_lc={}
conditions_short={}
conditions_short_caps={}
conditions_short_lc={}
sun_rise={}
sun_rise_lc={}
sun_rise_time={}
sun_rise_24={}
moon_rise={}
moon_rise_lc={}
moon_rise_time={}
moon_rise_24={}
moon_rise_ampm={}
moon_rise_ampm_lc={}
sun_set={}
sun_set_lc={}
sun_set_time={}
sun_set_24={}
moon_set={}
moon_set_lc={}
moon_set_time={}
moon_set_24={}
moon_set_ampm={}
moon_set_ampm_lc={}
humidity={}
precipitation={}
snow={}
cloud_cover={}
moon_phase={}
moon_phase_caps={}
moon_phase_lc={}
moon_font={}
moon_icon={}
wind_mph={}
wind_km={}
wind_kts={}
wind_font={}
wind_icon={}
wind_deg={}
wind_nesw={}
uv_index_num={}
uv_index_txt={}
uv_index_txt_caps={}
uv_index_txt_lc={}
--get forecast chunk --------------------------------------------------------
local a,b,allweather=string.find(allweatherdata,">10 Day Forecast&nbsp(.*)>More from Intellicast</div>")
--extract information into tables
local start=0
local f=1
while f~=nil do
--match forecast day name and date
local s,f,t=string.find(allweather,"<td colspan=\"2\"><strong>([%a,%s%d]*)</strong></td>",start)
	if t~=nil then
	--split name from month and date
	local a,b,day=string.find(t,"(%a*),%s")
	local a,b,month=string.find(t,",%s(%a*)%s")
	local a,b,date=string.find(t,"(%d*)$")
	--set day names, regular, caps, lowercase and short
	table.insert(forecast_day_short,dayshort[day])
	table.insert(forecast_day_short_caps,string.upper(dayshort[day]))
	table.insert(forecast_day_short_lc,string.lower(dayshort[day]))
		if translate==1 then
		day=daynames[day]
		else
		day=day
		end
	table.insert(forecast_day,day)
	table.insert(forecast_day_caps,string.upper(day))
	table.insert(forecast_day_lc,string.lower(day))
	--set month types
	table.insert(forecast_month_short,monthshort[month])
	table.insert(forecast_month_short_caps,string.upper(monthshort[month]))
	table.insert(forecast_month_short_lc,string.lower(monthshort[month]))
		if translate==1 then
		month=monthnames[month]
		else
		month=month
		end
	table.insert(forecast_month,month)
	table.insert(forecast_month_caps,string.upper(month))
	table.insert(forecast_month_lc,string.lower(month))
	--set date
	table.insert(forecast_date,date)
	end--if t~= nil
--intellicast weather icon match
local s,f,t=string.find(allweather,"40_white/(wx_[%d]*).png\"",start)
--convert to conkyweather icon
	if t~=nil then
	table.insert(weather_icon,weathericons..wimage[t]..".png")
	--convert to weather font
	table.insert(weather_font,wfont[t])
	end
--match conditions
local s,f,t=string.find(allweather," /><br />([%a%s%p]*)</td>",start)
	if t~=nil then
	table.insert(conditions,t)
	table.insert(conditions_caps,string.upper(t))
	table.insert(conditions_lc,string.lower(t))
	--set short versions--------------------------------
	local cons=t
        for k,v in pairs(con_short) do
            local cons_length=string.len(cons)
            local match_length=string.len(k)
            if cons_length==match_length then
            cons=string.gsub(cons,k,v)
            end
        end
	----------------------------------------------------
	table.insert(conditions_short,cons)
	table.insert(conditions_short_caps,string.upper(cons))
	table.insert(conditions_short_lc,string.lower(cons))
	end
--match high temp
local s,f,t=string.find(allweather,"\"Hi\">([%p%d]*)&deg",start)
table.insert(high_temp,t)
--match low temp
local s,f,t=string.find(allweather,"\"Lo\">([%p%d]*)&deg",start)
table.insert(low_temp,t)
--match sun rise times
local s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",start)
	if t~=nil then
	--get time only
	local a,b,tm=string.find(t,"([%d%p]*)")
	--get suffix only
	local a,b,suf=string.find(t,"(%u%u)")
--24 hour conversion
table.insert(sun_rise_24,convert24(tm,suf))
		if translate==1 then
		suf=tsuffix[suf]
		else
		suf=suf
		end
	table.insert(sun_rise,tm.." "..suf)
	table.insert(sun_rise_lc,string.lower(tm.." "..suf))
	table.insert(sun_rise_time,tm)
	end
--match sun set times
local s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
	if t~=nil then	
	--get time only
	local a,b,tm=string.find(t,"([%d%p]*)")
	--get suffix only
	local a,b,suf=string.find(t,"(%u%u)")
--24 hour conversion
table.insert(sun_set_24,convert24(tm,suf))
		if translate==1 then
		suf=tsuffix[suf]
		else
		suf=suf
		end
	table.insert(sun_set,tm.." "..suf)
	table.insert(sun_set_lc,string.lower(tm.." "..suf))
	table.insert(sun_set_time,tm)
	end
--moon rise
local s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",f)
	if t~=nil then
	--get time only
	local a,b,tm=string.find(t,"([%d%p]*)")
	--get suffix only
	local a,b,suf=string.find(t,"(%u%u)")
--24 hour conversion
table.insert(moon_rise_24,convert24(tm,suf))
		if translate==1 then
		suf=tsuffix[suf]
		else
		suf=suf
		end
	table.insert(moon_rise,tm.." "..suf)
	table.insert(moon_rise_lc,string.lower(tm.." "..suf))
	table.insert(moon_rise_time,tm)
	table.insert(moon_rise_ampm,suf)
	table.insert(moon_rise_ampm_lc,string.lower(suf))
	end
--moon set
local s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
	if t~=nil then
	--get time only
	local a,b,tm=string.find(t,"([%d%p]*)")
	--get suffix only
	local a,b,suf=string.find(t,"(%u%u)")
--24 hour conversion
table.insert(moon_set_24,convert24(tm,suf))
		if translate==1 then
		suf=tsuffix[suf]
		else
		suf=suf
		end
	table.insert(moon_set,tm.." "..suf)
	table.insert(moon_set_lc,string.lower(tm.." "..suf))
	table.insert(moon_set_time,tm)
	table.insert(moon_set_ampm,suf)
	table.insert(moon_set_ampm_lc,string.lower(suf))
	end
--match uv index
local s,f,tuv=string.find(allweather,"UV Index:</strong>%s*(%d*%s*%([%a%s]*%))%s*<br />",start)
if tuv~=nil then
	--get just number
	local a,b,unm=string.find(tuv,"(%d*)%s*%([%a%s]*%)")
	--get just text
	local a,b,utx=string.find(tuv,"%d*%s*%(([%a%s]*)%)")
	table.insert(uv_index_num,unm)
		if translate==1 then
		utx=uvindextext[utx]
		else
		utx=utx
		end
	table.insert(uv_index_txt,utx)
	table.insert(uv_index_txt_caps,string.upper(utx))
	table.insert(uv_index_txt_lc,string.lower(utx))
	end
--match humidity
local s,f,t=string.find(allweather,"Humidity:</strong> (%d*)<br />",start)
table.insert(humidity,t)
--match ppt
local s,f,t=string.find(allweather,"Precipitation:</strong> (%d*)<br />",start)
table.insert(precipitation,t)
--match snow %
local s,f,t=string.find(allweather,"Snow Probability:</strong>%s*(%d*)<br />",start)
table.insert(snow,t)
--match cloud coverage
local s,f,t=string.find(allweather,"Cloud Coverage:</strong> (%d*)<br />",start)
table.insert(cloud_cover,t)
--match moon phase
local s,f,t=string.find(allweather,"Moon Phase:</strong> ([%a%s]*) <br />",start)
--set moon phase text
	if t~= nil then
	--set moon phase font and icon
	table.insert(moon_font,moonfontt[t])
	table.insert(moon_icon,moonicont[t])
		if translate==1 then
		t=moonphases[t]
		else
		t=t
		end
	table.insert(moon_phase,t)
	table.insert(moon_phase_caps,string.upper(t))
	table.insert(moon_phase_lc,string.lower(t))
	end
--match wind speeds
local s,f,tmph=string.find(allweather,"Wind Speed:</strong> (%d*)Mph",start)
local tmph=tonumber(tmph)
table.insert(wind_mph,tmph)
local s,f,t=string.find(allweather,"Mph%s*%((%d*)Km,",start)
table.insert(wind_km,t)
local s,f,t=string.find(allweather,"Km,%s*(%d*)Kts%)",start)
table.insert(wind_kts,t)
--match wind direction
local s,f,twd=string.find(allweather,"Wind Direction:</strong> ([%d&;%s%(%a%)]*)%s*</div>",start)
	if twd~=nil then
	local a,b,tdeg=string.find(twd,"(%d*)&deg;")
	table.insert(wind_deg,tdeg)
	--match wind font and nesw   
	local a,b,tnesw=string.find(twd,"%((%a*)%)")
	table.insert(wind_font,windfontt[tnesw])
		if tmph>0 and tmph<19 then
		table.insert(wind_icon,weathericons.."green_"..string.lower(tnesw)..".png")
		elseif tmph>18 and tmph<38 then
		table.insert(wind_icon,weathericons.."yellow_"..string.lower(tnesw)..".png")
		elseif tmph>37 and tmph<64 then
		table.insert(wind_icon,weathericons.."orange_"..string.lower(tnesw)..".png")
		elseif tmph>63 then
		table.insert(wind_icon,weathericons.."green_"..string.lower(tnesw)..".png")
		elseif tmph==0 then
		table.insert(wind_icon,weathericons.."no_wind.png")
		end
		if translate==1 then
		tnesw=neswtext[tnesw]
		else
		tnesw=tnesw
		end
	table.insert(wind_nesw,tnesw)
	end
if f==nil then break end
start=f
end--while
--get location
local a,b,wl=string.find(allweatherdata,"<title>%s*Intellicast%s%p%s(.*)</title>")
weather_location=string.gsub(wl," Extended Forecast in",",")
--format now weather
--extract current data
--get now weather chunk
local a,b,nowweather=string.find(allweatherdata,">Current Conditions&nbsp(.*)>View Detailed Observations for the last<br />")
now={}
monthlong={Jan="January",Feb="February",Mar="March",Apr="April",May="May",Jun="June",Jul="July",Aug="August",Sep="September",Oct="October",Nov="November",Dec="December"}
local s,f,tnow=string.find(nowweather,"<div style=\"float:right;color:#666;\">  As of ([%d%p%a%s]*) %(Local Time%)")
local s,f,t=string.find(tnow,"(%d*%p%d*%s%a*) on")
--get time only
local a,b,ntm=string.find(t,"(%d*%p%d*)")
--get suffix only
local a,b,suf=string.find(t,"(%u%u)")
--24 hour conversion
now["time_24"]=convert24(ntm,suf)
if translate==1 then
suf=tsuffix[suf]
else
suf=suf
end
now["time"]=ntm.." "..suf
now["time_lc"]=string.lower(ntm.." "..suf)
now["time_num"]=ntm
now["time_ampm"]=suf
now["time_ampm_lc"]=string.lower(suf)
--get day
local s,f,t=string.find(tnow,"on (%a*)%s%d*")
if translate==1 then
day=daynames[t]
else
day=t
end
now["day"]=day
now["day_caps"]=string.upper(day)
now["day_lc"]=string.lower(day)
--short day names
local ds=dayshort[t]
now["day_short"]=ds
now["day_short_caps"]=string.upper(ds)
now["day_short_lc"]=string.lower(ds)
--get date
local s,f,t=string.find(tnow,"%s(%d%d)%s")
now["date"]=t
--get months
local s,f,t=string.find(tnow,"%d%d%s(%a*)%s%d")
if translate==1 then
mnth=monthlong[t]
now["month_short"]=monthshort[mnth]
now["month_short_caps"]=string.upper(monthshort[mnth])
now["month_short_lc"]=string.lower(monthshort[mnth])
mnth=monthnames[mnth]
else
now["month_short"]=t
now["month_short_caps"]=string.upper(t)
now["month_short_lc"]=string.lower(t)
mnth=monthlong[t]
end
now["month"]=mnth
now["month_caps"]=string.upper(mnth)
now["month_lc"]=string.lower(mnth)
local s,f,t=string.find(tnow,"%a%a%a%s(%d%d%d%d)")
now["year"]=t
local s,f,t=string.find(nowweather,"40_white/(wx_[%d]*)%ppng%p%stitle=%p")
now["weather_icon"]=weathericons..wimage[t]..".png"
now["weather_font"]=wfont[t]
local s,f,t=string.find(nowweather,"class=%pIcon%p /> ([%a%s%p]*)%s*%s*</td>%s*<td class=%pEmpty%p>&nbsp;")
local t=t:gsub("^%s*(.-)%s*$", "%1")
now["conditions"]=t
now["conditions_caps"]=string.upper(t)
now["conditions_lc"]=string.lower(t)
--set short versions------------------------
	local cons=t
        for k,v in pairs(con_short) do
            local cons_length=string.len(cons)
            local match_length=string.len(k)
            if cons_length==match_length then
            cons=string.gsub(cons,k,v)
            end
        end
	now["conditions_short"]=cons
	now["conditions_short_caps"]=string.upper(cons)
	now["conditions_short_lc"]=string.lower(cons)
--------------------------------------------
local s,f,t=string.find(nowweather,"Temperature\">([%p%d]*)&deg")
now["temp"]=t
local s,f,t=string.find(nowweather,">Feels Like: ([%p%d]*)&deg;</a>")
now["feels_like"]=t
local s,f,t=string.find(nowweather,">Wind Chill: </a></td>%s*<td>([%p%d]*)&deg;</td>")
now["wind_chill"]=t
local s,f,t=string.find(nowweather,">Ceiling: </a></td>%s*<td>([%a%d]*)</td>")
if t~="Unl" then
local s,f,t=string.find(t,"([%d%p]*)")
tc=t..ceiling_unit
else
	if translate==1 then unlset=additional.Unl else unlset=t end
tc=unlset
end
now["ceiling"]=tc
now["ceiling_caps"]=string.upper(tc)
now["ceiling_lc"]=string.lower(tc)
--get heat index
local s,f,t=string.find(nowweather,">Heat Index: </a></td>%s*<td>([%p%d]*)&deg;</td>")
now["heat_index"]=t
--get visibility
local s,f,t=string.find(nowweather,">Visibility: </a></td>%s*<td>([%a%d%p]*)</td>")
if t~="Unl" then
local s,f,t=string.find(t,"([%d%p]*)")
tv=t..visibility_unit
else
	if translate==1 then unlset=additional.Unl else unlset=t end
tv=unlset
end
now["visibility"]=tv
now["visibility_caps"]=string.upper(tv)
--get dew point
local s,f,t=string.find(nowweather,">Dew Point: </a></td>%s*<td>([%p%d]*)&deg;</td>")
now["dew_point"]=t
--get wind speed
local s,f,t=string.find(nowweather,">Wind: </a></td>%s*<td>(%d*)mph</td>")
local tmph=tonumber(t)
now["wind_mph"]=t..wind_mph_unit
now["wind_mph_caps"]=string.upper(t..wind_mph_unit)
--convert mph to km and knots
now["wind_km"]=round(tonumber(t)*1.609)..wind_km_unit
now["wind_km_caps"]=string.upper(round(tonumber(t)*1.609)..wind_km_unit)
now["wind_kts"]=round(tonumber(t)*0.869)..wind_kts_unit
now["wind_kts_caps"]=string.upper(round(tonumber(t)*0.869)..wind_kts_unit)
local s,f,t=string.find(nowweather,">Humidity: </a></td>%s*<td>(%d*)</td>")
now["humidity"]=t
--get wind direction ------------------------
local s,f,twd=string.find(nowweather,">Direction: </a></td>%s*<td style=[%p%a]*>([%d&;%s%(%a%)]*)</td>%s*</tr>")
--check for NA
local a,b,t=string.find(twd,"(%a*)")
local tnesw=t
if tnesw~="NA" then
local a,b,t=string.find(twd,"(%d*)&deg;")
now["wind_deg"]=t..wind_degrees_unit
local a,b,tnesw=string.find(twd,"%((%a*)%)")
	if tmph>0 and tmph<19 then
	now["wind_icon"]=weathericons.."green_"..string.lower(tnesw)..".png"
	elseif tmph>18 and tmph<38 then
	now["wind_icon"]=weathericons.."yellow_"..string.lower(tnesw)..".png"
	elseif tmph>37 and tmph<64 then
	now["wind_icon"]=weathericons.."orange_"..string.lower(tnesw)..".png"
	elseif tmph>63 then
	now["wind_icon"]=weathericons.."green_"..string.lower(tnesw)..".png"
	end
now["wind_font"]=windfontt[tnesw]
	if translate==1 then
	tnesw=neswtext[tnesw]
	else
	tnesw=tnesw
	end
now["wind_nesw"]=tnesw		
else
	if translate==1 then naset=additional.NA else naset="NA" end
now["wind_deg"]=naset
now["wind_icon"]=weathericons.."no_wind.png"
now["wind_nesw"]=naset
now["wind_font"]=windfontt["N"]
end
--END WIND DIRECTION #######################################################
--get pressure
local s,f,t=string.find(nowweather,">Pressure: </a></td>%s*<td>([%d%p]*)\"</td>")
now["pressure"]=t
--convert pressures ----------------
now["pressure_mb"]=round(tonumber(t)*33.86)
local s,f,t=string.find(nowweather,">Gusts: </a></td>%s*<td>([%d%a]*)</td>")
if t~="NA" then
local s,f,t=string.find(t,"(%d*)")
tg=t..wind_mph_unit
tgkm=round(tonumber(t)*1.609)..wind_km_unit
tgkts=round(tonumber(t)*0.869)..wind_kts_unit
else
	if translate==1 then naset=additional.NA else naset="NA" end
tg=naset
tgkm=naset
tgkts=naset
end
now["wind_gusts"]=tg
now["wind_gusts_caps"]=string.upper(tg)
now["wind_gusts_km"]=tgkm
now["wind_gusts_km_caps"]=string.upper(tgkm)
now["wind_gusts_kts"]=tgkts
now["wind_gusts_kts_caps"]=string.upper(tgkts)
--get hourly forecast options hour1
--get day 1 bit
local s,f,hfc=string.find(nowweather,"<td class=%pHour%p%sstyle=%ppadding%pleft([%a%d%p%s]*)%pdeg%p</strong>",1)
--get time and conditions
local a,b,tm=string.find(hfc,"<strong>([%d%p]*)[%s%a]*</strong><br",1)
local a,b,suf=string.find(hfc,"<strong>[%d%p%s]*([%a]*)</strong><br",1)
--24 hour conversion
now["fc_hour1_time_24"]=convert24(tm,suf)
		if translate==1 then
		suf=tsuffix[suf]
		else
		suf=suf
		end
now["fc_hour1_time"]=tm
now["fc_hour1_ampm"]=suf
now["fc_hour1_ampm_lc"]=string.lower(suf)
local a,b,t=string.find(hfc,"</strong><br%s/>%s*([%p%s%a]*)%s*</td>%s*<td class=%pHour%p",1)
now["fc_hour1_cond"]=t
now["fc_hour1_cond_lc"]=string.lower(t)
now["fc_hour1_cond_caps"]=string.upper(t)
----------set short versions--------------------------------
	local cons=t
        for k,v in pairs(con_short) do
            local cons_length=string.len(cons)
            local match_length=string.len(k)
            if cons_length==match_length then
            cons=string.gsub(cons,k,v)
            end
        end
	now["fc_hour1_cond_short"]=cons
	now["fc_hour1_cond_short_caps"]=string.upper(cons)
	now["fc_hour1_cond_short_lc"]=string.lower(cons)
--get weather icon and font
local a,b,t=string.find(hfc,"32_white/(wx_[%d]*)%ppng%p%stitle=%p",1)
now["fc_hour1_wicon"]=weathericons..wimage[t]..".png"
now["fc_hour1_wfont"]=wfont[t]
--get temperature
local a,b,t=string.find(hfc,"><strong>([%p%d]*)&deg;</strong></td>",1)
now["fc_hour1_temp"]=t
--end of hour1 data gathering--repeat 2 more times
--get hourly forecast options hour2--------------------
local start=tonumber(b)
--get time and conditions
local a,b,tm=string.find(hfc,"<strong>([%d%p]*)[%s%a]*</strong><br",start)
local a,b,suf=string.find(hfc,"<strong>[%d%p%s]*([%a]*)</strong><br",start)
--24 hour conversion
now["fc_hour2_time_24"]=convert24(tm,suf)
		if translate==1 then
		suf=tsuffix[suf]
		else
		suf=suf
		end
now["fc_hour2_time"]=tm
now["fc_hour2_ampm"]=suf
now["fc_hour2_ampm_lc"]=string.lower(suf)
local a,b,t=string.find(hfc,"</strong><br%s/>%s*([%a%s%p]*)%s*</td>%s*<td class=%pHour%p",start)
now["fc_hour2_cond"]=t
now["fc_hour2_cond_lc"]=string.lower(t)
now["fc_hour2_cond_caps"]=string.upper(t)
----------set short versions--------------------------------
	local cons=t
        for k,v in pairs(con_short) do
            local cons_length=string.len(cons)
            local match_length=string.len(k)
            if cons_length==match_length then
            cons=string.gsub(cons,k,v)
            end
        end
	now["fc_hour2_cond_short"]=cons
	now["fc_hour2_cond_short_caps"]=string.upper(cons)
	now["fc_hour2_cond_short_lc"]=string.lower(cons)
--get weather icon and font
local a,b,t=string.find(hfc,"32_white/(wx_[%d]*)%ppng%p%stitle=%p",start)
now["fc_hour2_wicon"]=weathericons..wimage[t]..".png"
now["fc_hour2_wfont"]=wfont[t]
--get temperature
local a,b,t=string.find(hfc,"><strong>([%p%d]*)&deg;</strong></td>",start)
now["fc_hour2_temp"]=t
--end of hour2 data gathering--repeat 1 more times
local start=tonumber(b)
--get time and conditions
local a,b,tm=string.find(hfc,"<strong>([%d%p]*)[%s%a]*</strong><br",start)
local a,b,suf=string.find(hfc,"<strong>[%d%p%s]*([%a]*)</strong><br",start)
--24 hour conversion
now["fc_hour3_time_24"]=convert24(tm,suf)
		if translate==1 then
		suf=tsuffix[suf]
		else
		suf=suf
		end
now["fc_hour3_time"]=tm
now["fc_hour3_ampm"]=suf
now["fc_hour3_ampm_lc"]=string.lower(suf)
local a,b,t=string.find(hfc,"</strong><br%s/>%s*([%a%s%p]*)%s*</td>%s*<td class=%pHour%p",start)
now["fc_hour3_cond"]=t
now["fc_hour3_cond_lc"]=string.lower(t)
now["fc_hour3_cond_caps"]=string.upper(t)
----------set short versions--------------------------------
	local cons=t
        for k,v in pairs(con_short) do
            local cons_length=string.len(cons)
            local match_length=string.len(k)
            if cons_length==match_length then
            cons=string.gsub(cons,k,v)
            end
        end
	now["fc_hour3_cond_short"]=cons
	now["fc_hour3_cond_short_caps"]=string.upper(cons)
	now["fc_hour3_cond_short_lc"]=string.lower(cons)
--get weather icon and font
local a,b,t=string.find(hfc,"32_white/(wx_[%d]*)%ppng%p%stitle=%p",start)
now["fc_hour3_wicon"]=weathericons..wimage[t]..".png"
now["fc_hour3_wfont"]=wfont[t]
--get temperature
local a,b,t=string.find(hfc,"><strong>([%p%d]*)",start)
now["fc_hour3_temp"]=t
--end of hour3 data gathering--finished for all hours
--ALERTS###############################################################
if alert_check==1 then
--set tables
alert_type={}
alert_issued={}
if alerttest~=0 then
alert_icon=weathericons.."icon_alert_1.gif"
--extract information into tables
local start=0
local f=1
while f~=nil do
local s,f,t=string.find(alertdata,"><strong class='Alert'>([%a%s]*)</strong><br/>",start)
	if t~=nil then
	table.insert(alert_type,string.upper(t))
	end--if t~=nil
local s,f,t=string.find(alertdata,"<br />([%d%a%s:]*)<br /><br />",start)
	if t~=nil then
	table.insert(alert_issued,t)
	end--if t~=nil
if f==nil then break end
start=f
alert_number=#alert_type
end--while
else
alert_icon=weathericons.."icon_alert_0.gif"
table.insert(alert_type,"NO ALERTS")
table.insert(alert_issued,"")
alert_number=0
end--alerttest~=nil
else
alert_type={}
alert_issued={}
alert_icon=weathericons.."icon_alert_0.gif"
table.insert(alert_type,"alerts turned off")
table.insert(alert_issued,"")
alert_number=0
end--if alert check
-- end of data processing
if testing==0 then
processall=0
print ("processing complete")
elseif testing==1 then
processall=1
end--if testing ==0
end--of data processing section
if processall==0 or testing==1 then
_G.weather_script()
end
--#########################################################################################################
--###UNCOMMENT THE BELOW LINE TO ENABLE CPU DELAY##########################################################
--end--####### end of if updates>5 #############################
--#########################################################################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

function round(num)
	local idp=tonumber(settings_table[5])
	local mult = 10^(idp or 0)
	return math.floor(num * mult + 0.5) / mult
end--of round function

function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end--string split


function xout(txj)
c=nil
c=(txj.c or default_color)
a=nil
a=(txj.a or default_alpha)
f=nil
f=(txj.f or default_font)
fs=nil
fs=(txj.fs or default_font_size)
x=nil
x=(txj.x or 0)
y=nil
y=(txj.y or 0)
txt=nil
txt=(txj.txt or "set txt")
j=nil
j=(txj.j or "l")
local cs=txj.cs     or default_size         or "normal_c"
local format=txj.format					or default_format			or "normal"
local ul=txj.ul     or default_ul         or "no"
local shaded=txj.shaded				or default_shaded		or "no"
------------------
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fs)
local text=string.gsub(txt," ","_")
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local wx=extents.width
if j=="l" then
cairo_move_to (cr,x,y)
adx=wx
elseif j=="c" then
cairo_move_to (cr,x-(wx/2),y)
adx=wx/2
elseif j=="r" then
cairo_move_to (cr,x-wx,y)
adx=0
end
------------------------------------------------------------------------
cairo_select_font_face (cr, f, font_slant(format),font_weight(format));
------------------------------------------------------------------------
if cs=="big_c" then
txt=string.upper(txt)
elseif cs=="small_c" then
txt=string.lower(txt)
elseif cs=="normal_c" then
txt=txt
end
------------------------------------------------------------------------
	if ul=="yes" then
		lw=1
		lc=CAIRO_LINE_CAP_BUTT
		cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE)
		----------------------------
		startx=x
		endx=startx+wx
		starty=y+5
		endy=y+5
		----------------------------
		cairo_set_line_width (cr,lw)
		cairo_set_line_cap  (cr, lc)
		cairo_set_source_rgba (cr,col(c,a))
		cairo_show_text (cr,txt)
		cairo_move_to (cr,x,starty)
		cairo_line_to (cr,x+wx,endy)
		cairo_stroke (cr)
		cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT) 
	elseif ul == "no" then
		txt=txt
	end -- if
	-----------------------------------------------------
	if shaded == "yes" then
		sc=0x000000
		sa=1
		cairo_move_to (cr,(x + 1),(y + 1))
		cairo_set_source_rgba (cr,col(sc,sa))
		cairo_show_text (cr,txt)
		cairo_stroke (cr)
	elseif shaded=="no" then
	txt=txt
	end
	----------------------------------------------------
cairo_move_to (cr,(x),(y))
cairo_set_source_rgba (cr,col(c,a))
cairo_show_text (cr,txt)
cairo_stroke (cr)
nextx=nil
nextx=adx+x
return nextx
end--function xout

-- all following functions are working stand-alone
-- they can be copied because they do not have any dependance to work

function out(txj) -- function to output text
	local extents=cairo_text_extents_t:create()
	tolua.takeownership(extents)
	local c=txj.c						or default_color		or 0xffffff
	local a=txj.a						or default_alpha		or 1
	local f=txj.f						or default_font			or "mono"
	local fs=txj.fs						or default_font_size	or 12
	local x=txj.x						or 100
	local y=txj.y						or 100
	local txt=txj.txt					or "set txt"
	local face=txj.face					or default_face			or "normal"
	local size=txj.size     			or default_size         or "normal_c"
	--------------------------------------------------------------------
	local hj=txj.hj						or default_hj			or "l"
	--local vj=txj.vj						or default_vj			or "n"
	--------------------------------------------------------------------
	local shaded=txj.shaded				or default_shaded		or "no"
	local shade_color=txj.shade_color	or default_shade_color	or 0x000000
	local shade_alpha=txj.shade_alpha	or default_shade_alpha	or 1
	--------------------------------------------------------------------
	local underline=txj.underline     	or default_underline    or "no"
	local line_color=txj.line_color    	or   default_line_color or   c
	local line_space=txj.line_space    	or default_line_space   or  5
	local line_width=txj.line_width     or default_line_width   or  1
	--------------------------------------------------------------------
	local number=txj.number  or 8
	local radius=txj.radius or 1.75
	local blurred=txj.blurred or no
	local blurred_color=txj.blurred_color or c
	local blurred_alpha=txj.blurred_alpha or 1
	--------------------------------------------------------------------
	local border=txj.border
	local bc=txj.bc or 0x000000
	local ba=txj.ba or 1
	local bw=txj.bw or 1
	----------------------
	cairo_select_font_face (cr, f, font_slant(face),font_weight(face));
	----------------------
	if size=="big_c" then
	txt=string.upper(txt) -- converts letter into capitals
	elseif size=="small_c" then
	txt=string.lower(txt) -- converts letter into lower case
	elseif size=="normal_c" then
	txt=txt
	end
	----------------------
	cairo_set_font_size (cr, fs)
	cairo_text_extents(cr,txt,extents)
	local wx=extents.x_advance -- measure spaces too
	local wd=extents.width
	local hy=extents.height
	local bx=extents.x_bearing
	local by=extents.y_bearing+hy
	local tx=x
	local ty=y
	--set horizontal alignment
	if hj=="l" then
		x=x-bx
	elseif hj=="c" then
		x=x-((wx-bx)/2)-bx
	elseif hj=="r" then
		x=x-wx
	end
	-- set shade
	if shaded == "yes" then
		cairo_move_to (cr,(x + 1),(y + 1))
		cairo_set_source_rgba (cr,col(shade_color,shade_alpha))
		cairo_show_text (cr,txt)
		cairo_stroke (cr)
	end -- if
	-------------------------------------------------
	cairo_move_to (cr,x,y)
	cairo_set_source_rgba (cr,col(c,a))
	cairo_show_text (cr,txt)
	cairo_stroke (cr)
	--------------------------------------------------
	if border=="yes" then
	-- draw border (line around text)
    cairo_select_font_face (cr, f, font_slant(face),font_weight(face));
	cairo_set_font_size (cr, fs);
	cairo_move_to (cr, x, y);
	cairo_text_path (cr,txt);
	cairo_set_source_rgba (cr,col(c,a));
	cairo_fill_preserve (cr);
	cairo_set_source_rgba (cr,col(bc,ba));
	cairo_set_line_width (cr, bw);
	cairo_stroke (cr);
	end

	-- #################################################################
	-- ## decrease alpha if u want to use a small size #################
	-- ## for example fs=12,blurred="yes",ba=0.1 #######################
	-- #################################################################
	if blurred=="yes" then
	 radi=radius
	 inum=number
	 horiz=x
	 verti=y
	
	 for i=1,inum do
	 deg=360/inum
	 text_arc=((2*math.pi/inum)*i)
	 txs=0+radi*(math.sin(text_arc))
	 tys=0-radi*(math.cos(text_arc))
	 -------------------------------------------------------------------
	 cairo_select_font_face (cr, f, font_slant(face),font_weight(face));
	 -------------------------------------------------------------------
	 cairo_set_font_size (cr, fs);
	 cairo_set_source_rgba (cr, col(blurred_color,blurred_alpha));
	 cairo_move_to (cr, txs+horiz, tys+verti);
	 cairo_show_text (cr, txt)
     end
	 
	elseif blurred=="no" then
	 txt=txt
	end
	--------------------------------------------------
	if underline=="yes" then
		line_cap=CAIRO_LINE_CAP_BUTT
		cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE)
		----------------------------------------------
		startx=x
		endx=startx+wd
		starty=y+line_space
		endy=y+line_space
		-- draw line beyond text ---------------------
		cairo_set_line_width (cr,line_width)
		cairo_set_line_cap  (cr, line_cap)
		cairo_set_source_rgba (cr,col(line_color,a))
		cairo_move_to (cr,x,starty)
		cairo_line_to (cr,x+wd,endy)
		cairo_stroke (cr)
		cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT) --# reset antialiasing so we don't screw up other code
	elseif underline == "no" then
	txt=txt
	end
end--of function out 

function font_slant(value)
	local face=nil
	face=value
 	if face=="normal" then
	fs=CAIRO_FONT_SLANT_NORMAL
    elseif face=="bold" then
	fs=CAIRO_FONT_SLANT_NORMAL
	elseif face=="italic" then
	fs=CAIRO_FONT_SLANT_ITALIC
    elseif face=="bolditalic" then
    fs=CAIRO_FONT_SLANT_ITALIC
	elseif face=="oblique" then 
    fs=CAIRO_FONT_SLANT_OBLIQUE
	end
	    
	return fs
end

function font_weight(value)
	local face=nil
	face=value
 	if face=="normal" then
	fw=CAIRO_FONT_WEIGHT_NORMAL
    elseif face=="bold" then
	fw=CAIRO_FONT_WEIGHT_BOLD
	elseif face=="italic" then
	fw=CAIRO_FONT_WEIGHT_NORMAL
    elseif face=="bolditalic" then
    fw=CAIRO_FONT_WEIGHT_BOLD
	elseif face=="oblique" then 
    fw=CAIRO_FONT_WEIGHT_NORMAL
	end
	    
	return fw
end



-- #####################################################################
-- ## convert 12h-format into 24h-format ###############################
-- #####################################################################

function convert24(tm,suf)
local tmlen=string.len(tm) -- calculate the length of a string
local colon=string.find(tm,":") -- find character within a string
	if colon~=nil then
	tmhr=string.sub(tm,1,colon-1)
	tmmn=string.sub(tm,colon+1,tmlen)
	else
	tmhr=tm
	tmmn=""
	end
if suf=="PM" and tonumber(tmhr)~=12 then
tmhr=tmhr+12
elseif suf=="PM" and tonumber(tmhr)==12  then
tmhr=12
elseif suf=="AM" and tonumber(tmhr)<10 then
tmhr="0"..tmhr
elseif suf=="AM" and tonumber(tmhr)>=10 and tonumber(tmhr)~=12 then
tmhr=tmhr
elseif suf=="AM" and tonumber(tmhr)==12 then
tmhr="00"
end
if colon~=nil then
return tmhr..":"..tmmn
else
return tmhr
end--if colon~=nil
end--of function

-- #####################################################################
-- ## END OF ORIGINAL SCRIPT ###########################################
-- #####################################################################

function m2n(mn)
--[[
function converts the name of the month into numbers
tonumber -> change type of a value (into a number)
]]--
------------------------------------------------------------------------
local m2n_input=nil
local m2n_input=mn.input or 0
local m2n_input=string.lower(m2n_input) -- convert text into lowercase to match the 'table-entries'
local m2n_lang=nil
local m2n_lang=mn.l or "en"
local month_to_num={} -- initalize table (array)
local output=nil
------------------------------------------------------------------------
if m2n_lang=="de" then
 month_to_num={"januar","februar","märz","april","mai","juni","juli","august","september","oktober","november","dezember"}
elseif m2n_lang=="it" then
 month_to_num={"gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"}
elseif m2n_lang=="en" then
 month_to_num={"january","february","march","april","may","june","juli","august","september","octobre","november","december"}
end
------------------------------------------------------------------------
for i,v in ipairs(month_to_num) do
    if tostring(m2n_input)==tostring(v) then
       if tonumber(i)<=9 then
	   output="0"..tonumber(i)
	   elseif tonumber(i)>=10 then
	   output=tonumber(i)
	   end
	end
end--of loop
return output
end--of function


-- #####################################################################
-- ## display external and local images ################################
-- #####################################################################

function image(im) -- display local images
	local x = nil
	local y = nil
	local w = nil	
	local h = nil
	x =im.x or 0
	y =im.y or 0
	w =im.w or default_image_width -- default width is defined within the template
	h =im.h or default_image_height -- default height is defined within the template
	local file = nil
	file = tostring(im.file)
	if file == nil then print("set image file") end 
	local show = imlib_load_image(file)
	if show == nil then return end --# if show == nil then 
	imlib_context_set_image(show)
	local WIDTH = nil
	if tonumber(w) == 0 then 
		WIDTH = imlib_image_get_width() 
	else
		WIDTH = tonumber(w)
	end -- if
	local HEIGHT = nil
	if tonumber(h) == 0 then HEIGHT = imlib_image_get_height() else HEIGHT = tonumber(h) end --# if tonumber(h) == 0 then 
	local scaled = imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), WIDTH, HEIGHT)
	imlib_free_image_and_decache()
	imlib_context_set_image(scaled)
	imlib_render_image_on_drawable(x, y)
	imlib_free_image_and_decache()
	show = nil
	WIDTH = nil
	HEIGHT = nil
	x = nil
	y = nil
	w = nil
	h = nil
	file = nil
	scaled = nil
end --# function

function extern(wb) -- display external images (i.a. webcams)

	local img_nw=nil
	local img_x=nil
	local img_y=nil
	local s=nil
	local j=nil
	local img_w=nil
	local img_h=nil
	local imgwidth=nil
	local imgheight=nil
	local imgt=nil
	local imgw=nil
	local imgh=nil
	--------------------------------------------------------------------
	img_x=wb.posx or 0 -- horizontal postion
	img_y=wb.posy or 0 -- vertical position
	img_w=wb.imgw -- image width
	img_h=wb.imgh -- image height
	j=wb.j or "l" -- justification
	scaled=wb.scaled or "no" -- scale image or use default value
	scale_size=wb.scale_size or 200 -- set scaled width or use default value
	
	img_nw=wb.imghdd or "external_img.jpg" -- set name of the image
	s=wb.imgurl -- url of the external image (webcam etc.)
	img_file='/home/'..username.."/"..img_nw -- define storage location
	img_intervall=wb.imgiv or 60 -- set intervall
	
	-- grab external image from url and save it to hdd
	local updates = tonumber(conky_parse('${updates}'))
	if (math.mod(updates, img_intervall) == 0) then
		os.execute("wget  -q -O "..img_file..' "'..s..'"')
	end
	-- print error message when no image is defined
	if img_file==nil then print("set image file") end
	--------------------------------------------------------------------
	if scaled=="yes" then
		local show = imlib_load_image(img_file)
		if show == nil then return 	end
		imlib_context_set_image(show) -- display defined image if image file exists
		imgwidth= imlib_image_get_width() -- get image width
		imgheight=imlib_image_get_height() -- get image height
		imgw=scale_size
		imgh=(imgw*imgheight)/imgwidth
		imlib_free_image_and_decache() -- remove from cache
	else
		imgw=img_w
		imgh=img_h
	end
	-- set alignment ---------------------------------------------------
	if j=="l" then -- justify left
	 img_x=img_x
	elseif j=="r" then -- justify right
	 img_x=img_x-imgw
	end
	--------------------------------------------------------------------
	image({x=img_x,y=img_y,w=imgw,h=imgh,file=img_file}) -- load image, function image() must exist
end--of function


-- #####################################################################
-- ## functions to modify conky-output #################################
-- #####################################################################

function os_capture(cmd, raw) -- parse shell in lua
	local f = assert(io.popen(cmd, 'r'))
	local s = assert(f:read('*a'))
	f:close()
	if raw then return s end
	s = string.gsub(s, '^%s+', '')
	s = string.gsub(s, '%s+$', '')
	s = string.gsub(s, '[\n\r]+', ' ')
	return s
end

function add_decimal(input,sign) 

if string.find(input,"%a")==nil then -- only add decimal place when value is a number
        if string.find(input,"%p")==nil then        
        input=input..sign..'0' -- add decimal place, i.e. 5,0
        end
end

return input
end

function chgDel(value,del) 
--[[
change format of numbers
adds decimal separator (thousands separator), changes delimiter
string.gsub - replace string, in example string.gsub(tostring(rest),"%.",del)
]]--

local ausgang=nil
local ersteZahl=nil
local rest=nil
local outputNumber=nil

ausgang=string.gsub(value, "(%d*\.*%d+).*", "%1") -- remove ending
ausgang=tonumber(ausgang)

-- still calculate when 'ausgang' is empty (doesn't exist)
-- enter this to avoid error messages in the terminal
if not ausgang then ausgang=0; end 

 if ((ausgang >= 10000) and (ausgang <= 99999.99)) then ----------------
       ersteZahl=string.sub(ausgang,1,2)
       rest=string.sub(ausgang,3,string.len(ausgang))
       
       if del=="," then
       outputNumber=ersteZahl..'.'..string.gsub(tostring(rest),"%.",",")
	   else
	   outputNumber=ersteZahl..','..string.gsub(tostring(rest),"%,",".")
       end
       
 elseif ((ausgang>=1000) and (ausgang <9999.99)) then ------------------
       ersteZahl=string.sub(ausgang,1,1)
       rest=string.sub(ausgang,2,string.len(ausgang))
       
	   if del=="," then
       outputNumber=ersteZahl..'.'..string.gsub(tostring(rest),"%.",del)
	   elseif del=="." then
	   outputNumber=ersteZahl..','..rest
       end
       
 elseif ausgang<999 then  ----------------------------------------------
	   if del=="," then
       outputNumber=string.gsub(tostring(ausgang),"%.",',')
	   elseif del=="." then
	   outputNumber=ausgang
       end
       
 elseif ausgang >=100000 then ------------------------------------------
	   
       ersteZahl=string.sub(ausgang,1,3)
       rest=string.sub(ausgang,4,string.len(ausgang))
       
	   if del=="," then
       outputNumber=ersteZahl..'.'..string.gsub(tostring(rest),"%.",del)
	   elseif del=="." then
	   outputNumber=ersteZahl..','..rest
       end
       -----------------------------------------------------------------
 end

return outputNumber

end -- of function


function parse(value,delimiter,ending)
--[[
changes ending, in example 5GiB into 5,0 gb
string.find -> find string within another string
short_units -> setting within .conkyrc
]]-- 
	local ms=nil
	local txt=nil
	value = value:gsub(" ","") --# remove spaces to account for inconsistencies in the inclusion of spaces in the output of different conky objects.
	
	if value==nil then value=0 end
	
	---- short_units no ------------------------------------------------
	if ((string.find(value, "iB") == nil) and (string.find(value, "B") ~= nil)) then
		jn=value:gsub("B","") -- only number
		jn=chgDel(jn,delimiter) -- chg format of the number
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." byte" end
	elseif string.find(value, 'KiB') ~= nil then
		jn=value:gsub("KiB","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." kb" end
	elseif string.find(value, 'MiB') ~= nil then
		jn=value:gsub("MiB","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." mb" end
	elseif string.find(value, 'GiB') ~= nil then
		jn=value:gsub("GiB","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." gb" end
	elseif string.find(value, "TiB") ~= nil then
		jn=value:gsub("TiB","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." tb" end
	---- short_units yes -----------------------------------------------
	elseif ((string.find(value, "iB") == nil) and (string.find(value, "B") ~= nil)) then
		jn=value:gsub("B","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." byte" end
	elseif string.find(value, "K") ~= nil then
		jn=value:gsub("K","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." kb" end
	elseif string.find(value, "M") ~= nil then
		jn=value:gsub("M","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." mb" end
	elseif string.find(value, "G") ~= nil then
		jn=value:gsub("G","") 
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." gb" end
	elseif string.find(value, "T") ~= nil then
		jn=value:gsub("T","")
		jn=chgDel(jn,delimiter)
		if ending=="no" then ms=add_decimal(jn,delimiter) else ms=add_decimal(jn,delimiter).." tb" end
	else
		ms=value:gsub(" ","")
	end

	return ms
end -- of function


function system(cd)
-- you can call the function like this (example)
-- system({variable="totaldown",device="wlan0",del=',',se="no"})
-- conky_parse -> parse external variable from conky

local conky_order=nil
local variable=nil
local device=nil
local del=nil
local cs = nil
local ms = nil
local tf = nil
local txt=nil
local se=nil
------------------------------------------------------------------------
local todayVnstat=nil
local weekVnstat=nil
local monthVnstat=nil
------------------------------------------------------------------------
variable=cd.variable
device=cd.device or ''
del=cd.del or '.' -- delimiter
tf=cd.tf or '24' -- time format
se=cd.se or "yes" -- show ending

conky_order=conky_parse("${"..variable..' '..device.."}")
adv=parse(conky_order,del,se)

	if string.find(variable,"cpu") ~= nil then
		if se=="no" then ms=conky_order else ms=conky_order.." %" end
	elseif string.find(variable,"uptime") ~= nil or string.find(variable,"user_number") ~= nil then
		ms=conky_order
	elseif ((string.find(variable, "perc") ~= nil) or (string.find(variable, "percent") ~= nil)) then
		if se=="no" then ms=conky_order else ms=conky_order.." %" end
	--------------------------------------------------------------------
	elseif ((string.find(variable,"freq") ~= nil) and (string.find(variable,"_g") == nil)) then
		jn=chgDel(adv,del)
		if se=="no" then ms=add_decimal(jn,del) else ms=add_decimal(jn,del).." mhz" end
	elseif ((string.find(variable,"freq") ~= nil) and (string.find(variable,"_g") ~= nil)) then
		jn=chgDel(adv,del)
		if se=="no" then ms=add_decimal(jn,del) else ms=add_decimal(jn,del).." ghz" end
	--------------------------------------------------------------------
	elseif string.find(variable,"addr") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..conky_order.."${else}offline${endif}")
	elseif string.find(variable,"wireless_bitrate") ~= nil then
		txt=conky_order:gsub("Mb/s","") -- find and remove ending
		txt=txt:gsub(" ","") -- remove spaces
		ms=conky_parse("${if_up "..device.."}"..add_decimal(txt,del).." mb/s".."${else}offline${endif}")
	elseif string.find(variable,"wireless_essid") ~= nil or string.find(variable,"wireless_mode") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..conky_order.."${else}offline${endif}")
	elseif string.find(variable,"wireless_link_qual") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..adv.." %".."${else}offline${endif}")
	elseif string.find(variable,"upspeedf") ~= nil or string.find(variable,"downspeedf") ~= nil then
		jn=chgDel(adv,del) -- chg format
		jn=add_decimal(jn,del)
		ms=conky_parse("${if_up "..device.."}"..jn.." kb/s".."${else}offline${endif}")

	elseif string.find(variable,"battery") ~= nil then
		ms=conky_order
	--------------------------------------------------------------------
	elseif string.find(variable,"prozessor") ~= nil or string.find(variable,"processor") ~= nil then
		cmd=[[cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq]]
		ms=os_capture(cmd, raw) -- excecute function (see above)
	elseif string.find(variable,"download") ~= nil and string.find(variable,"heute") ~= nil then
		cmd=[[vnstat -i wlan0 | grep "today" | awk '{print $2 $3}']]
		todayVnstat=os_capture(cmd, raw)
		ms=conky_parse("${if_up "..device.."}"..parse(todayVnstat,del,se).."${else}offline${endif}")
	elseif string.find(variable,"download") ~= nil and string.find(variable,"woche") ~= nil then
		cmd=[[vnstat -i wlan0 -w | grep "current week" | awk '{print $3 $4}']]
		weekVnstat=os_capture(cmd, raw)
		ms=conky_parse("${if_up "..device.."}"..parse(weekVnstat,del,se).."${else}offline${endif}")
	elseif string.find(variable,"download") ~= nil and string.find(variable,"monat") ~= nil then
		cmd=[[vnstat -i wlan0 -m | mawk '$0 ~ "'`date +"%b.+%y"`'" {print $3, $4}']]
		monthVnstat = os_capture(cmd, raw)
		ms=conky_parse("${if_up "..device.."}"..parse(monthVnstat,del,se).."${else}offline${endif}")
	--------------------------------------------------------------------
	elseif string.find(variable,"up") == nil and string.find(variable,"time") ~= nil then
		if tf == "24" then
			if se=="no" then ms=adv else ms=adv.." uhr" end	
		elseif tf == "12" then
		ms=convert12(conky_order,tf) end 
	else
	--------------------------------------------------------------------
		if string.find(device,"wlan") ~= nil or string.find(device,"eth") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..adv.."${else}offline${endif}")
		elseif string.find(device,"media") ~= nil then
		ms=conky_parse("${if_mounted "..device.."}"..add_decimal(adv,del).."${else}not plugged in${endif}")
		else 
		ms=adv 
		end 
	--------------------------------------------------------------------
	end

	return ms -- return value to display it
end -- of function


function convert12(value,format) 
--[[ 
convert 24h-format into 12h-format, for example 16:00 -> 4:00 pm
string.sub - returns part of a string, i.e. string.sub(value,1,2)
]]--
local stunden=nil
local minuten=nil
local zeit=nil
local sekunden=nil

local stunden=string.sub(value,1,2) -- hours
local stunden=tonumber(stunden) -- convert hours into numbers
local minuten=string.sub(value,4,5) -- minutes
local sekunden=string.sub(value,7,8) -- seconds

-- still calculate if string doesn't exists
if not sekunden then sekunden=''; end

if stunden > 12 and stunden < 24 then
	if sekunden ~= '' then
	zeit=(stunden-12)..':'..minuten..':'..sekunden..' pm'
	elseif sekunden == '' then
	zeit=(stunden-12)..':'..minuten..' pm'
	end
elseif stunden < 12 then
	if sekunden ~= '' then
	zeit=stunden..':'..minuten..':'..sekunden..' am'
	elseif sekunden == '' then
	zeit=stunden..':'..minuten..' am'
	end
elseif stunden == 12 then
	if sekunden ~= '' then
	zeit=stunden..':'..minuten..':'..sekunden..' pm'
	elseif sekunden == '' then
	zeit=stunden..':'..minuten..' pm'
	end
elseif stunden == 24 or stunden == 0 then
	if sekunden ~= '' then
	zeit=(stunden-12)..':'..minuten..':'..sekunden..' am'
	elseif sekunden == '' then
	zeit=(stunden-12)..':'..minuten..' am'
	end
end

return zeit

end

function draw_bar(db) -- improved bars by mrpeachy (2010)

local var=nil
local dev=nil
local width=nil
local height=nil
local across=nil
local down=nil
local bgc=nil
local bga=nil
local inc=nil
local ina=nil
local lc=nil
local la=nil
local lw=nil
local rotate=nil
local justify=nil
------------------------------------------------------------------------
var=db.var
dev=db.dev or ""
width=db.w
height=db.h
across=db.x
down=db.y
bgc=db.bgc -- background color
bga=db.bga or 1
inc=db.indc -- indicator color
ina=db.inda or 1
lc=db.lc -- line color
la=db.la or 1
lw=db.lw
rotate=db.r or 0
justify=db.j or "l"

--indicator calculation
if not dev then dev=''; end

conum=conky_parse("${"..var..' '..dev.."}")
conum=tonumber(conum)

local inum=(((width-lw)/100)*(conum or 0))

if justify=="r" then
across=across-width
elseif justify=="l" then
across=across
end

--background bar
cairo_translate (cr, (across+(lw/2)), (down+(lw/2))) 
cairo_rotate (cr, rotate*math.pi/180)
cairo_set_source_rgba (cr, col(bgc, bga));
cairo_rectangle (cr, 0, 0, (width-lw), (height-lw))
cairo_fill (cr)
cairo_rotate (cr, (rotate*-1)*math.pi/180)
cairo_translate (cr, -1*(across+(lw/2)), -1*(down+(lw/2))) 
--indicator bar
cairo_translate (cr, (across+(lw/2)), (down+(lw/2))) 
cairo_rotate (cr, rotate*math.pi/180)
cairo_set_source_rgba (cr, col(inc,ina));
cairo_rectangle (cr, 0, 0, inum, (height-lw))
cairo_fill (cr)
cairo_rotate (cr, (rotate*-1)*math.pi/180)
cairo_translate (cr, -1*(across+(lw/2)), -1*(down+(lw/2))) 
--boundary line
cairo_translate (cr, (across+(lw/2)), (down+(lw/2))) 
cairo_rotate (cr, rotate*math.pi/180)
cairo_set_line_width (cr, lw);
cairo_set_source_rgba (cr, col(lc,la));
cairo_rectangle (cr, -lw/2, -lw/2, width, height)
cairo_stroke (cr)
cairo_rotate (cr, (rotate*-1)*math.pi/180)
cairo_translate (cr, -1*(across+(lw/2)), -1*(down+(lw/2))) 
end


-- #####################################################################
-- ## end of functions to modify conky-output ##########################
-- #####################################################################




-- #####################################################################
-- ## gimmicks #########################################################
-- #####################################################################

function get_image() -- grab url of the 'image of the day' by the nasa 
	local uri='http://www.nasa.gov/rss/image_of_the_day.rss' -- address of rss-file 
	local f = assert(io.popen('curl -s '..uri, 'r')) -- get content of the rss-file
	local s = assert(f:read('*a'))
	f:close()
	s, f = string.gsub(s, ".*image\/jpeg.*(http://.*\.jpg).*", "%1")
	return s
end


function potw_uri() --  grab url of the 'picture of the week' by hubble 
	local uri = 'http://feeds.feedburner.com/hubble_potw?format=xml'
	local f = assert(io.popen('curl -s '..uri, 'r'))
	local s = assert(f:read('*a'))
	f:close()
	local b = nil
	local e = nil
	b,e,s = string.find(s,'(http://www%.spacetelescope%.org/static/archives/images/news/potw%d-.%.jpg)')
	return(s)
end

--END OF SCRIPT

is it better to say 'offline' or 'no wifi' when u can not get into the internet (when there is no connection).

Last edited by lionhead (2013-04-27 13:05:04)

Offline

#5183 2013-04-27 14:08:51

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,186
Website

Re: Conky v1.9 Thread

Rutz wrote:

Hey Guys.

I tried to use this script:

http://crunchbang.org/forums/viewtopic. … 7271#p7271

But it didn't work...can you help me?

${voffset 4}${font PizzaDude Bullets:size=14}${font}   Distrowatch Ranking: ${execi 3600 /etc/conky/iggykoopa-distrowatch.py}
This just in from iggykoopa:

Distrowatch changed the layout of their page. If you replace the line that says "rankings = soup.find....." with the following it'll work again:

rankings = soup.find(text= "H.P.D*").parent.parent.parent.find(text= "CrunchBang").parent.parent.parent.find("th", {"class" : "phr1"}).string

if it breaks again let me know. If you want to post the fix in the original thread that's fine.

Thank you iggykoopa - For more see this: Index » CrunchBang Talk » Distrowatch » Post #24 - my version of iggykoopa's script, there are two, and results.


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#5184 2013-04-27 14:32:48

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,186
Website

Re: Conky v1.9 Thread

Not a LUA expert - not even a novice - but one suggestion:

Where you use:  "not plugged in" you could use: n/a or N/A , it requires less space.

lionhead wrote:

is it better to say 'offline' or 'no wifi' when u can not get into the internet (when there is no connection).

Same with this.  n/a = Not Available fits and keeps responses to various variables uniform.
You may be sitting some place, sidewalk café, "roaming for a connection", until you do get one the net is not available but you still have wifi ... just a thought.


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#5185 2013-04-27 16:00:36

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

Re: Conky v1.9 Thread

@ lionhead - re optimizing
I personally hate reading through other peoples code  devil
particularly long scripts as different people have all sorts of different ways of doing things (particularly those who don't have any formal programming training such as you and I).

Before I would even have a chance of optimizing anything I would have to understand what was going on and why a particular piece of code was written as it was.

All I would be able to do is to tell you how I would do it wink 
but that kind of thing would take a long time

When I am working on optimizing a script the important things to look for are
1 am i using the same piece of code in more than 1 place and if yes, could I then make that code a function
2 have i localized my variables and worked to minimize potential memory leaks
3 can i simplify lengthy if statements and other loops.  With loops do I have only the essentials inside the loop?

just come back to the script after a while and then you will spot areas to improve upon, particularly keep working on scripts and improving your lua skills.  Then when you look back at older scripts you think "yuck!  I could have used 10 lines to do the same that those 50 are doing" big_smile

Last edited by mrpeachy (2013-04-27 16:04:14)

Offline

#5186 2013-04-27 16:15:19

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

i thought about adding small function (i.e. where i use if_up). i will clean up my code and then i will post it. i hope that it looks better (not confusing, unclear).

everything already works but i must clean up a bit smile

Last edited by lionhead (2013-04-27 16:16:47)

Offline

#5187 2013-04-27 18:20:55

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,186
Website

Re: Conky v1.9 Thread

@ mrpeachy

Well said

LUA, bash, C+, C++,  Basic, python, perl, old DOS Batch files ... and the list goes on...

That post could be a "Forward" to any book on those subjects.


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#5188 2013-04-27 19:39:25

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 260

Re: Conky v1.9 Thread

mrpeachy wrote:

color change thermometers for v9000

http://s12.postimg.org/9y6oggvrd/Screenshot_at_2013_04_26_18_33_00.jpg

ragamartix's post a few back caught my interest and I had some free time so i tired incorporating the thermometers into a v9000 template

put this at the bottom of the template, outside of the weather function (after the final end)

function get_color(ctab)
--by mrpeachy 04/2013
local function color(col)
return {((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, 1}
end
local ncol=#ctab
local val=ctab[1]
local lownum=(ctab[2])[1]
local lowcol=color((ctab[2])[2])
local highnum=(ctab[ncol])[1]
local highcol=color((ctab[ncol])[2])
if val<=lownum then 
color=lowcol
elseif val>=highnum then
color=highcol
else
	for i=2,ncol do
	entry1=ctab[i]
	entry2=ctab[i+1] or ctab[i]
	lower=entry1[1]
	upper=entry2[1]
		if val>=lower and val<=upper then
		nentry=i
		end
	end
ctop=color((ctab[nentry+1] or nentry)[2])
ntop=(ctab[nentry+1] or nentry)[1]
clow=color((ctab[nentry])[2])
nlow=(ctab[nentry])[1]
i1=ntop-nlow
i2=val-nlow
c1=clow[1]+((ctop[1]-clow[1])*i2/i1)
c2=clow[2]+((ctop[2]-clow[2])*i2/i1)
c3=clow[3]+((ctop[3]-clow[3])*i2/i1)
c4=clow[4]+((ctop[4]-clow[4])*i2/i1)
color={c1,c2,c3,c4}
end
ctab=nil
return color
end--function
--#############################################################################################################################################################
function thermometer(therm)
--by mrpeachy 04/2013
local mx=therm.x or 0
local my=therm.y or 0
local tcol=therm.tcol
local temp=therm.val or 0
local label=therm.label or nil
local scale=therm.scale or 1
local units=therm.units or "F"
local font=therm.f or "Mono"
local fsize=therm.fs or "10"
local lines=therm.lines or 1
local numbers=therm.numbers or 1
therm=nil
--by mrpeachy 2011
if units=="F" then height=150 elseif units=="C" then height=160 end
local mx=mx*(1/scale)
local my=my*(1/scale)
cairo_scale (cr,scale,scale)
cairo_set_line_width (cr,1)
cairo_set_source_rgba (cr,1,1,1,1)
--graphics outer
--bottom circle
r_outer=25
local lang_outer=335
local rang_outer=0+(360-lang_outer)
local h_outer=height-4--maybe make this a percentage?###########
cairo_arc (cr,mx,my,r_outer,(math.pi/180)*(rang_outer-90),(math.pi/180)*(lang_outer-90))
--coordinates,left line
local arc=(math.pi/180)*lang_outer
local lxo=0+r_outer*(math.sin(arc))
local lyo=0-r_outer*(math.cos(arc))
cairo_line_to (cr,mx+lxo,my+lyo-h_outer)
--coordinates,left line
local arc=(math.pi/180)*rang_outer
local rxo=0+r_outer*(math.sin(arc))
local ryo=0-r_outer*(math.cos(arc))
--top circle
cairo_arc (cr,mx+lxo+((rxo-lxo)/2),my+lyo-h_outer,(rxo-lxo)/2,(math.pi/180)*(270-90),(math.pi/180)*(90-90))
--right line
cairo_line_to (cr,mx+lxo+((rxo-lxo)),my+lyo)
cairo_stroke (cr)
----------------------------------------------
--graphics inner
--####################################################
if units=="F" then
cairo_set_source_rgba (cr,tcol[1],tcol[2],tcol[3],tcol[4])
--bottom circle
r_inner=r_outer-6
local lang_inner=lang_outer+9
local rang_inner=0+(360-lang_inner)
local h_inner=temp+30
cairo_arc (cr,mx,my,r_inner,(math.pi/180)*(rang_inner-90),(math.pi/180)*(lang_inner-90))
--coordinates,left line
local arc=(math.pi/180)*lang_inner
lxi=0+r_inner*(math.sin(arc))
local lyi=0-r_inner*(math.cos(arc))
cairo_line_to (cr,mx+lxi,my+lyi-h_inner)
--coordinates,left line
local arc=(math.pi/180)*rang_inner
rxi=0+r_inner*(math.sin(arc))
local ryi=0-r_inner*(math.cos(arc))
--top circle
cairo_arc (cr,mx+lxi+((rxi-lxi)/2),my+lyi-h_inner,(rxi-lxi)/2,(math.pi/180)*(270-90),(math.pi/180)*(90-90))
--right line
cairo_line_to (cr,mx+lxi+((rxi-lxi)),my+lyi)
cairo_fill (cr)
----------------------------
if lines==1 then
--scale lines
cairo_set_line_width (cr,1)
cairo_set_source_rgba (cr,1,1,1,0.5)
local grad=10
local lnn=15
local lnx=mx+lxo
local lnw=(rxo-lxo)
	for i=1,lnn do
	lny=my-r_inner-(10+((i-1)*grad))-((rxi-lxi)/2)
		if i==lnn then
		lnx=lnx+2
		lnw=lnw-4
		end
	cairo_move_to (cr,lnx,lny)
	cairo_rel_line_to (cr,lnw,0)
	cairo_stroke (cr)
	end
end--if lines
if numbers==1 then
--numbers
cairo_set_source_rgba (cr,1,1,1,1)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
local grad=20
local lnn=8
local lnx=mx+lxo+(rxo-lxo)+4
num={-20,"0°"..units,20,40,60,80,100,120}
for i=1,lnn do
lny=my-r_inner-(10+((i-1)*grad))-((rxi-lxi)/2)+(fsize/3)
cairo_move_to (cr,lnx,lny)
cairo_show_text (cr,num[i])
cairo_stroke (cr)
end
end--if label
end--if units=F
--#################################################
if units=="C" then
cairo_set_source_rgba (cr,tcol[1],tcol[2],tcol[3],tcol[4])
--cairo_set_source_rgba (cr,0,1,1,1)
--bottom circle
r_inner=r_outer-6
local lang_inner=lang_outer+9
local rang_inner=0+(360-lang_inner)
local h_inner=(temp*2)+60
cairo_arc (cr,mx,my,r_inner,(math.pi/180)*(rang_inner-90),(math.pi/180)*(lang_inner-90))
--coordinates,left line
local arc=(math.pi/180)*lang_inner
lxi=0+r_inner*(math.sin(arc))
local lyi=0-r_inner*(math.cos(arc))
cairo_line_to (cr,mx+lxi,my+lyi-h_inner)
--coordinates,left line
local arc=(math.pi/180)*rang_inner
rxi=0+r_inner*(math.sin(arc))
local ryi=0-r_inner*(math.cos(arc))
--top circle
cairo_arc (cr,mx+lxi+((rxi-lxi)/2),my+lyi-h_inner,(rxi-lxi)/2,(math.pi/180)*(270-90),(math.pi/180)*(90-90))
--right line
cairo_line_to (cr,mx+lxi+((rxi-lxi)),my+lyi)
cairo_fill (cr)
----------------------------
if lines==1 then
--scale lines
cairo_set_line_width (cr,1)
cairo_set_source_rgba (cr,1,1,1,0.5)
local grad=10
local lnn=17
local lnx=mx+lxo
local lnw=(rxo-lxo)
	for i=1,lnn do
	lny=my-r_inner-(((i-1)*grad))-((rxi-lxi)/2)
		if i==lnn then
		lnx=lnx+2
		lnw=lnw-4
		end
	cairo_move_to (cr,lnx,lny)
	cairo_rel_line_to (cr,lnw,0)
	cairo_stroke (cr)
	end
end--if lines
if numbers==1 then
--numbers
cairo_set_source_rgba (cr,1,1,1,1)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
local grad=20
local lnn=9
local lnx=mx+lxo+(rxo-lxo)+4
num={-30,-20,-10,"0°"..units,10,20,30,40,50}
for i=1,lnn do
lny=my-r_inner-(((i-1)*grad))-((rxi-lxi)/2)+(fsize/3)
cairo_move_to (cr,lnx,lny)
cairo_show_text (cr,num[i])
cairo_stroke (cr)
end
end--if label=none
end--if units=C
--#################################################
--label
if label~=nil then
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
local lbx=mx+lxo-5
local lby=my-r_inner-10-((rxi-lxi)/2)
cairo_move_to (cr,lbx,lby)
cairo_rotate (cr,(math.pi/180)*(-90))
cairo_show_text (cr,label)
cairo_stroke (cr)
cairo_rotate (cr,(math.pi/180)*(90))
--temperature readout
cairo_set_source_rgba (cr,0,0,0,1)
local text=temp.."°"..units
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,mx-(width/2),my+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end--if label
------------------------------------
cairo_scale (cr,1/scale,1/scale)
end--thermometer function
--#################################################################################################

then use in the template like this

--########################################################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
--########################################################################################
--THERMOMETER--THERMOMETER--THERMOMETER--THERMOMETER--THERMOMETER--THERMOMETER--THERMOMETER--THERMOMETER
--[[
set a string named val to the valyue you want to display first, then use that string in the following 2 functions
use tonumber so that the output is a number
--]]
val=tonumber(now["temp"])
--val=tonumber(os.date("%S"))-10
--[[
get_color settings - this calculates the color of the thermometer inside
settings are inside ({ and }) and seperated by commas
	val needs to always be the first things set.  following val sub tables containing a number and a hex color are set
	sub tables set between { and } with the 2 values separated by a comma
	each sub table {},{} must be seperated from another sub table using a comma
the first number is the number at which the thermometer is that color
eg...  {0,0x00ff00} means that at value 0 the thermometer would be green
by setting multiple colors you can have the thermometer change according to a gradient
{0,0x00ff00},{100,0xff0000} would be green a 0, red at 100 and a gracient between the two colors at values in between

the get_color function outputs a lua formatted table containing the rgba color
tcol=get_color({}) stores that color in the tcol variable which is then used in the drawing function below
--]]
tcol=get_color({val,{20,0x00ffff},{40,0x00ff00},{60,0xffff00},{80,0xff7f00},{110,0xff0000}})
--[[
thermometer settings - this draws the thermometer
settings are inside ({ and }) and seperated by commas
x=x position (center of thermometer circle)
y=y position
lines=1 or 0 , 1 for scale lines, 0 for no scale lines
f=font (font name in quotes)
fs=font size
label=text to display on side, must be in brackets.  Do not set or set label=nil for no label
scale=size of thermometer, this affects all sizes including font size
units="C" or "F" 
val=val, leave this as it is, val is set above
tcol=tcol, leave this as it is to get the correct color change, tcol is set above
--]]
thermometer ({x=100,y=300,numbers=1,lines=1,f="sans",fs=12,label=weather_location,scale=1.5,units="F",tcol=tcol,val=val})

--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################

still could do with some optimizing, but it is working for me smile

something new is the ability to set multiple color change points... this thermometer is sky blue up to 20 then transitions from blue to green from 20 to 40, green to yellow from 40 to 60, yellow to orange from 60 to 80 and then orange to red between 80 and 110 then stays red for anything over

Thanks a lot !
I was not there for few days... I will try it in the begining of this week (I need time... sometimes difficult to find); many things might be possible now.... with our immaginations.
smile

Offline

#5189 2013-04-27 20:05:13

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

@mrpeachy

the temperature-script doesn't calc right: http://imgbox.com/abjqqdni

Offline

#5190 2013-04-27 20:24:07

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

Re: Conky v1.9 Thread

^it displays whatever number you give it...
check the number you are sending the thermometer using print

print (now["temp"])

or whichever setting you are using

Last edited by mrpeachy (2013-04-27 20:26:50)

Offline

#5191 2013-04-27 20:36:48

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

the setting 'units' only changes the shown letter but doesn't calculate/converts the temperature from fahrenheit to celsius.

Offline

#5192 2013-04-27 22:13:16

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

Re: Conky v1.9 Thread

lionhead wrote:

the setting 'units' only changes the shown letter but doesn't calculate/converts the temperature from fahrenheit to celsius.

correct, it doesn't calculate between the two units
but it does change the scale and adjust the size of the thermometer to show a probable range of temperatures

here is a comparison
Screenshot_at_2013_04_27_18_17_29.jpg

and i think it is done so that the same temperature in F and C (eg 32F = 0C) make the thermometer the same height
but i would have to check to see if that was actually true smile

Last edited by mrpeachy (2013-04-27 23:24:20)

Offline

#5193 2013-04-28 07:42:30

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

actually the thermometer is ok.  it would be nicer (and would look better) if it would calculate even the unit but it's ok for now smile

i make some tweaks for a better look but the rest is ok.

@mrpeachy

why don't u offer a 'non-v9000-version'? u only need two different values:

function grab(wert)

upd=tonumber(conky_parse("${updates}"))
intv=100
timer=(upd % intv)
if timer==0 or conky_start==1 then
used_table={}
local loc_code="GMXX0156"
local adr="http://www.intellicast.com/Local/Forecast.aspx?location="..loc_code
local grab_file = io.popen("curl "..adr)
grab_out=grab_file:read("*a")
grab_file:close()
conky_start=nil
end

local grab_text = nil
local s = nil
local f = nil

if wert=='temp' then
 s,f,grab_text=string.find(grab_out,"Temperature\">([%p%d]*)&deg")
elseif wert=="location" then
 s,f,grab_text=string.gsub(grab_out," Extended Forecast in",",")
end

return grab_text

end

where:

val=grab("temp")

Last edited by lionhead (2013-04-28 09:18:45)

Offline

#5194 2013-04-28 15:27:21

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 260

Re: Conky v1.9 Thread

@mr peachy
Thanks to incorporate this function. Is it possible to add thermos for each day forecast (like high and low temp of the day) ?
What is the value for thermo day 1, day 2, day 3....etc to add here ? :

thermometer ({x=100,y=50,numbers=1,lines=1,f="sans",fs=12,label=weather_location,scale=0.5,units="C",tcol=tcol,val=val})

ad a [x] local function ? [

local temp=tonumber(day[x].low)

Last edited by ragamatrix (2013-04-28 17:13:49)

Offline

#5195 2013-04-28 17:17:57

ichase
#! CrunchBanger
Registered: 2011-03-16
Posts: 146

Re: Conky v1.9 Thread

Finally got the bargraph_small.lua incorporated into my existing info conky.  Took awhile to figure out why I kept getting a nil value error but it was my fault when I added the additional bargraphs, I forgot to add a }, at the end.  Opps  big_smile
Here it is:
901909251460150.jpg   7ee90a251461422.jpg

Also added an additional bar at the bottom to show the space on sdc1  big_smile

Last edited by ichase (2013-04-28 17:20:54)

Offline

#5196 2013-04-28 18:26:30

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

Re: Conky v1.9 Thread

ragamatrix wrote:

@mr peachy
Thanks to incorporate this function. Is it possible to add thermos for each day forecast (like high and low temp of the day) ?
What is the value for thermo day 1, day 2, day 3....etc to add here ? :

thermometer ({x=100,y=50,numbers=1,lines=1,f="sans",fs=12,label=weather_location,scale=0.5,units="C",tcol=tcol,val=val})

ad a [x] local function ? [

local temp=tonumber(day[x].low)

yes, you would set your values up and then use them in the thermometer

val=high_temp[1]
tcol=get_color({val,{0,0x00ffff},{10,0x00ff00},{20,0xffff00},{30,0xff7f00},{40,0xff0000}})
thermometer ({x=100.5,y=300,numbers=0,lines=0,f="sans",fs=12,label=weather_location,scale=1,units="C",tcol=tcol,val=val})

val=low_temp[1]
tcol=get_color({val,{0,0x00ffff},{10,0x00ff00},{20,0xffff00},{30,0xff7f00},{40,0xff0000}})
thermometer ({x=200.5,y=300,numbers=0,lines=0,f="sans",fs=12,label=weather_location,scale=1,units="C",tcol=tcol,val=val})

val=high_temp[2]
tcol=get_color({val,{0,0x00ffff},{10,0x00ff00},{20,0xffff00},{30,0xff7f00},{40,0xff0000}})
thermometer ({x=300.5,y=300,numbers=0,lines=0,f="sans",fs=12,label=weather_location,scale=1,units="C",tcol=tcol,val=val})

val=low_temp[2]
tcol=get_color({val,{0,0x00ffff},{10,0x00ff00},{20,0xffff00},{30,0xff7f00},{40,0xff0000}})
thermometer ({x=400,y=300,numbers=0,lines=0,f="sans",fs=12,label=weather_location,scale=1,units="C",tcol=tcol,val=val})

etc

@lionhead - all you have to do is cut and paste the 2 functions, get_color and thermometer and paste them into whatever script you want to use them in

Last edited by mrpeachy (2013-04-28 18:26:59)

Offline

#5197 2013-04-28 19:01:50

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,186
Website

Re: Conky v1.9 Thread

ichase wrote:

Finally got the bargraph_small.lua incorporated into my existing info conky.  Took awhile to figure out why I kept getting a nil value error but it was my fault when I added the additional bargraphs, I forgot to add a }, at the end.  Opps  big_smile

Very nice!!!!!

BTW: Oops! is allowed, it creates a learning curve!  big_smile
Looks good ...buuuuuuuut; where's the horizontal weather conky?  monkey


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#5198 2013-04-28 19:22:40

ichase
#! CrunchBanger
Registered: 2011-03-16
Posts: 146

Re: Conky v1.9 Thread

It's still alive and well, just working on the fonts and colors a bit.  smile  The next thing I want to incorporate is lua rings.  big_smile
AE - Always Evolving  wink

Offline

#5199 2013-04-29 05:10:46

jbolted
New Member
Registered: 2013-04-29
Posts: 3

Re: Conky v1.9 Thread

smile Hi, I did a seonsor probe in the command line and got this

$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +47.0°C  (high = +74.0°C, crit = +100.0°C)
Core 1:       +39.0°C  (high = +74.0°C, crit = +100.0°C)
Core 2:       +42.0°C  (high = +74.0°C, crit = +100.0°C)
Core 3:       +42.0°C  (high = +74.0°C, crit = +100.0°C)

it8718-isa-0290
Adapter: ISA adapter
in0:          +1.10 V  (min =  +0.00 V, max =  +4.08 V)
in1:          +1.95 V  (min =  +0.00 V, max =  +4.08 V)
in2:          +3.41 V  (min =  +0.00 V, max =  +4.08 V)
+5V:          +3.04 V  (min =  +0.00 V, max =  +4.08 V)
in4:          +0.29 V  (min =  +0.00 V, max =  +4.08 V)
in5:          +0.10 V  (min =  +0.00 V, max =  +4.08 V)
in6:          +0.13 V  (min =  +0.00 V, max =  +4.08 V)
in7:          +3.18 V  (min =  +0.00 V, max =  +4.08 V)
Vbat:         +3.30 V 
fan1:        1303 RPM  (min =   10 RPM)
fan2:           0 RPM  (min =    0 RPM)
fan3:        1896 RPM  (min =   10 RPM)
fan4:        1110 RPM  (min =   10 RPM)
temp1:        +39.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermistor
temp2:        +37.0°C  (low  = +127.0°C, high = +70.0°C)  sensor = thermal diode
temp3:         -4.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermistor
intrusion0:  ALARM

I have an intel core2quad cpuQ8400. a Gigabyte EP45-UD3P motherboard.
I don't seem to be getting the correct terminology for my script in conky. I have tried numerous samples, only to delete them out becuase they didn't work. Yes I did restart conky to make sure the changes to the script were registered with the rc file. Can some kind sould please tell me the correct coding in conky to get my core temps?

Thanks you very much in advance...

jbolted

PS Here is what I got so far: conkyshot429.png

Last edited by jbolted (2013-04-29 05:16:53)


Gigabyte EP45-UD3P Rev 1.6 FE BIOS
Intel Q8400 2.66GHz, GSkill DDr2 800MHz
NVidia GPU GTX650 1 Gib Ram
Linux Mint Maya

Offline

Help fund CrunchBang, donate to the project!

#5200 2013-04-29 06:21:01

Dobbie03
Resident Metaller
From: New Zealand
Registered: 2009-08-15
Posts: 1,575

Re: Conky v1.9 Thread

Does anyone know how to get a graph for ram and cpu usage that isn't a bar graph, sort of like this one in my screenshot:

http://fav.me/d63axzi

EDIT: Disregard, I worked it out, loadgraph is what I wanted
big_smile

Last edited by Dobbie03 (2013-04-29 06:30:09)

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.

Debian Logo