diff --git a/parser.c b/parser.c index 38050e7..d946462 100644 --- a/parser.c +++ b/parser.c @@ -408,7 +408,7 @@ int parser(char *citycode, const char *trans, int metric, int inet, int ctmo) #ifdef WWEATHER //FIXME KEY! and CITYCODE //sprintf (url,"http://api.wunderground.com/api/%s/geolookup/conditions/forecast10day/astronomy/lang:DL/pws:0/q/%s.json",key,citycode); - sprintf (url,"https://api.darksky.net/forecast/%s/%s?lang=%s&units=%s&exclude=hourly,minutely",key,citycode,(metric)?"de":"en",(metric)?"ca":"us"); + sprintf (url,"https://api.darksky.net/forecast/%s/%s?lang=%s&units=%s&exclude=minutely,hourly,flags,alerts",key,citycode,(metric)?"de":"en",(metric)?"ca":"us"); printf("url:%s\n",url); exit_ind=HTTP_downloadFile(url, "/tmp/tuxwettr.tmp", 0, inet, ctmo, 3); @@ -500,14 +500,16 @@ int parser(char *citycode, const char *trans, int metric, int inet, int ctmo) data[tc][cc]='\0'; //printf("tagname[%d] = %s | data = %s\n",tc,tagname,data[tc]); //fix zero precipIntensityMaxTime +#if 0 if(!strcmp(tagname,"precipIntensityMax") && !strcmp(data[tc],"0")) { tc++; strcpy(data[tc], "0"); //printf("tagname[%d] = precipIntensityMaxTime | data = %s\n",tc,data[tc]); } +#endif //fix zero precipType - else if(!strcmp(tagname,"precipProbability") && !strcmp(data[tc],"0")) + if(!strcmp(tagname,"precipProbability") && !strcmp(data[tc],"0")) { tc++; strcpy(data[tc], "0"); @@ -535,7 +537,8 @@ int parser(char *citycode, const char *trans, int metric, int inet, int ctmo) else { //FIXME optional value - if(!strcmp(tagname,"precipAccumulation")) + if(!strcmp(tagname,"precipAccumulation") || + !strcmp(tagname,"nearestStormDistance")) { //printf("tagname[%d] = %s \n",tc, tagname); tagname[0]='\0'; diff --git a/tuxwetter.c b/tuxwetter.c index 43dc4bd..96ec54a 100644 --- a/tuxwetter.c +++ b/tuxwetter.c @@ -45,7 +45,7 @@ #include "gifdecomp.h" #include "icons.h" -#define P_VERSION "4.28" +#define P_VERSION "4.29" #define S_VERSION "" @@ -69,7 +69,8 @@ char CONVERT_LIST[]= CFG_TUXWET "/convert.list"; static char TCF_FILE[128]=""; #define LIST_STEP 10 -#define MAX_FUNCS 2+7 +#define MAX_DAYS 7 +#define MAX_COLUMNS MAX_DAYS + 1 // current day + 7 days #define LCD_CPL 12 #define LCD_RDIST 10 @@ -1311,16 +1312,14 @@ int col2=((preset)?scale2res(380):scale2res(340)); int wxw=ex-sx-((preset)?scale2res(120):scale2res(30)); //box width int wyw=ey-sy-((preset)?scale2res(60):scale2res(20)); //box height -int nc=7; //table columns 10 +int column=MAX_COLUMNS; //table columns int gys=vy; //table space top int gysf=scale2res(34); //table space bottom int gxs=4*OFFSET_MED; //table space left -//int gxw=((wxw-(gxs*2))/nc) * nc; //table width -int gicw=((wxw-(gxs*2))/nc); //table data width -int gxw=gicw*nc; //table width +int gicw=((wxw-(gxs*2))/column); //table data width +int gxw=gicw*column; //table width int gywf=scale2res(100); //table footer height int gyw=wyw-vy-gywf-gysf; //table height -//int gicw=gxw/nc; //table data width int vxs=0,wsx,wsy; int prelate=0; int rcd; @@ -1334,7 +1333,7 @@ char tun[8]="°C",sun[8]="km/h",dun[8]="km",pun[8]="hPa",iun[8]="mm/h", cun[20]; //recalculate wigth gicw += ((gicw%10) > OFFSET_SMALL ? OFFSET_MED-(gicw%10) : -(gicw%10)); //rounded table data width, needing for smoothed curves - gxw=gicw*nc; + gxw=gicw*column; gxs=(wxw-gxw)/2; if (var_screeninfo.xres < 1280) @@ -1505,16 +1504,16 @@ char tun[8]="°C",sun[8]="km/h",dun[8]="km",pun[8]="hPa",iun[8]="mm/h", cun[20]; { if(ix==1) { - int i, tmax[nc], tmin[nc], mint=100, maxt=-100, j, pmin, pmax; - double tstep=1, garr[nc*10], tv1, tv2, tv3; + int i, tmax[column], tmin[column], mint=100, maxt=-100, j, pmin, pmax; + double tstep=1, garr[column*10], tv1, tv2, tv3; RenderBox(wsx, wsy, wxw, wyw, radius, CMC); RenderBox(wsx, wsy, wxw, scale2res(44), radius, CMH); - sprintf(rstr,"%s %d %s",prs_translate("Trend für die kommenden",CONVERT_LIST),nc,prs_translate("Tage",CONVERT_LIST)); + sprintf(rstr,"%s %d %s",prs_translate("Trend für die kommenden",CONVERT_LIST), MAX_DAYS, prs_translate("Tage",CONVERT_LIST)); RenderString(rstr, wsx, wsy+4*OFFSET_MED, wxw, CENTER, FSIZE_BIG, CMHT); RenderLine(gxs,gys,gxs,gys+gyw+gywf,CMCIT); RenderLine(gxs+1,gys,gxs+1,gys+gyw+gywf,CMCIT); - for(i=0; i=MAX_FUNCS) + if(++ix>=funcs.max_entrys) { ix=0; }