From 76321af421f0c1261ff7ee081db82852e75b92d7 Mon Sep 17 00:00:00 2001 From: GetAway Date: Fri, 16 Jun 2017 23:05:36 +0200 Subject: [PATCH] V3.08; port most of new Api from FlatTV; lot of fixes --- build.sh | 2 +- convert.list | 1 + gfx.c | 2 +- parser.c | 137 +++++++++--- parser.h | 111 +++++----- tuxwetter.c | 551 ++++++++++++++++++++++++++++--------------------- tuxwetter.h | 8 + tuxwetter.mcfg | 10 +- 8 files changed, 492 insertions(+), 330 deletions(-) diff --git a/build.sh b/build.sh index 5e467ac..dc378a8 100644 --- a/build.sh +++ b/build.sh @@ -1 +1 @@ -arm-cx2450x-linux-gnueabi-gcc -g -o tuxwetter tuxwetter.c gfx.c io.c text.c parser.c php.c http.c jpeg.c fb_display.c resize.c pngw.c gif.c -L$PREFIX/lib -I$PREFIX/include -I$PREFIX/include/freetype2 -O2 -lfreetype -lcurl -lz -ljpeg -lpng -lungif -DWWEATHER gifdecomp.c +arm-cx2450x-linux-gnueabi-gcc -g -o tuxwetter tuxwetter.c gfx.c io.c text.c parser.c php.c http.c jpeg.c fb_display.c resize.c pngw.c gif.c -L$PREFIX/lib -I$PREFIX/include -I$PREFIX/include/freetype2 -O2 -lfreetype -lcrypto -lssl -lcurl -lz -ljpeg -lpng -lgif -DWWEATHER gifdecomp.c diff --git a/convert.list b/convert.list index 68aeb42..d34e21f 100644 --- a/convert.list +++ b/convert.list @@ -290,6 +290,7 @@ Wind:| windstill| von| mit| +sichtbar| Sonnenaufgang:| Sonnenuntergang:| Bewölkung:| diff --git a/gfx.c b/gfx.c index 3a1bb3f..81a2ba4 100644 --- a/gfx.c +++ b/gfx.c @@ -4,7 +4,7 @@ #include "tuxwetter.h" #include "gfx.h" -typedef struct { unsigned char width_lo; unsigned char width_hi; unsigned char height_lo; unsigned char height_hi; unsigned char transp; } IconHeader; +//typedef struct { unsigned char width_lo; unsigned char width_hi; unsigned char height_lo; unsigned char height_hi; unsigned char transp; } IconHeader; char circle[] = { diff --git a/parser.c b/parser.c index 82b64b1..fbdd2c9 100644 --- a/parser.c +++ b/parser.c @@ -17,7 +17,7 @@ Interne Variablen Bitte nicht direkt aufrufen!!! */ #ifdef WWEATHER -# define MAXITEM 200 +# define MAXITEM 1000 # define MAXMEM 300 #else # define MAXITEM 1000 @@ -199,6 +199,31 @@ int z; return (strlen(out)==0); } +#ifdef WWEATHER +int prs_get_val2 (int i, int what, int nacht, char *out) +{ + int z; + + strcpy(out,data[(what & ~TRANSLATION)+(i*PRE_STEP2)+(nacht*NIGHT_STEP2)]); + if(what & TRANSLATION) + { + for(z=0;z<=ptc;z++) + { + if (strcasecmp(out,conveng[z])==0) + { + strcpy (out,convger[z]); + return 0; + } + } + if(sscanf(out,"%d",&z)!=1) + { + prs_check_missing(out); + } + } + return (strlen(out)==0); +} +#endif + int prs_get_dbl (int i, int what, int nacht, char *out) { int ret=1; @@ -312,12 +337,11 @@ int parser(char *citycode, const char *trans, int metric, int inet, int ctmo) FILE *wxfile=NULL; char url[512]; char debug[505]; - + #ifdef WWEATHER + char tagname[512]; + int getold=0, skip=1, tag=0, tcc=0; extern char key[]; - int d_flag=0; //data flag ">DATA<" - int D_flag=0; //data flag "[DATA]" - int l_flag=0; //do not change to upper case (URL) #else int day_data=PRE_DAY; int previews=9; @@ -338,7 +362,7 @@ int parser(char *citycode, const char *trans, int metric, int inet, int ctmo) exit_ind=system(url); sleep(1); */ - sprintf (url,"http://api.worldweatheronline.com/free/v1/weather.ashx?q=%s&format=xml&num_of_days=%d&includeLocation=yes&key=%s",citycode,num_of_days,key); + sprintf (url,"http://api.wunderground.com/api/%s/geolookup/conditions/forecast10day/astronomy/lang:DL/pws:0/q/%s.json",key,citycode); exit_ind=HTTP_downloadFile(url, "/tmp/tuxwettr.tmp", 0, inet, ctmo, 3); if(exit_ind != 0) @@ -357,17 +381,19 @@ int parser(char *citycode, const char *trans, int metric, int inet, int ctmo) } else { + fgets(debug,5,wxfile); + fgets(debug,5,wxfile); fgets(debug,50,wxfile); //printf("%s\n",debug); - if((debug[45] != 'r')||(debug[46] != 'e')||(debug[47] != 'q')) + if((debug[3] != 'r')||(debug[4] != 'e')||(debug[5] != 's')) { fclose(wxfile); return exit_ind; } - else + else { // starting position forcast - bc = NA; + bc = NA; strcpy(data[bc],"N/A"); bc++; @@ -375,37 +401,80 @@ int parser(char *citycode, const char *trans, int metric, int inet, int ctmo) while (!feof(wxfile)) { gettemp=fgetc(wxfile); - if (gettemp == '<' || gettemp == ']') rec = 0; - if (gettemp == ':') l_flag = 1; - if (rec == 1) + if(rec==0 && tag==0 && gettemp=='"') { - if(!l_flag) - data[bc][cc] = toupper(gettemp); - else - data[bc][cc] = gettemp; - //printf("#2 data[%d][%d] = %c(%d)\n",bc,cc,gettemp,gettemp); - cc++; - d_flag=1; - if(cc == MAXMEM-1) rec = 0; + tag=1; } - if (gettemp == '>' || gettemp == '[') rec = 1; - if (gettemp == '[' && !D_flag) + if(tag==1 && gettemp!='"' && gettemp!=':') { - rec = 0; - D_flag = 1; + tagname[tcc]=gettemp; + tcc++; } - if ((gettemp == '<' || gettemp == ']') && d_flag) + if(getold=='"' && gettemp==':') { - data[bc][cc] = '\0'; - //printf("data[%d][%d] = %s\n",bc,cc,data[bc]); - if (cc == ACT_UPTIME) days_count++; - bc++; - cc = 0; - rec = 0; - d_flag = 0; - D_flag = 0; - l_flag = 0; + tagname[tcc]='\0'; + tag=0; + rec=1; + + if(!strcmp(tagname,"current_observation")) + { + skip=0; + } + else if(!strcmp(tagname,"error")) + { + return exit_ind; + } + + getold=gettemp; + continue; } + + if(gettemp=='\n') + { + if(!strcmp(tagname,"")) { + continue; + } + + //remove last "," + if(data[bc][cc-1]==',') { + + cc--; + } + + data[bc][cc]='\0'; + //printf("[%s%d]%s = %s\n",(skip==1?"skip ":""),bc,tagname,data[bc]); + + if(skip==1) { + data[bc][0]='\0'; + tagname[0]='\0'; + } + else { + tagname[0]='\0'; + bc++; + } + + rec=0; + cc=0; + tag=0; + tcc=0; + } + + if(rec==1 && gettemp!='"') + { + if(getold==':' && gettemp==' ') + continue; + + data[bc][cc]=gettemp; + //printf("#2 data[%d][%d] = %c(%d)\n",bc,cc,gettemp,gettemp); + cc++; + + if(cc==MAXMEM-1) + { + printf("data MAXMEM\n"); + return exit_ind; + } + } + getold=gettemp; } } } diff --git a/parser.h b/parser.h index 74f1583..2d5061d 100644 --- a/parser.h +++ b/parser.h @@ -28,59 +28,73 @@ #include //#define WWEATHER -#define MISS_FILE "/var/plugins/tuxwet/missing_translations.txt" #define TRANSLATION 0x8000 #ifdef WWEATHER -# define NA 0 -# define PRE_STEP 14 -# define NIGHT_STEP 13 +# define NA 0 + //offset simpleforecast +# define PRE_STEP 61 +# define NIGHT_STEP 3 + //offset forecast +# define PRE_STEP2 14 +# define NIGHT_STEP2 7 -// atual Values -# define ACT_CITY 3 -# define ACT_LAT 6 -# define ACT_LON 7 -# define ACT_SUNR NA -# define ACT_SUNS NA -# define ACT_UPTIME 10 -# define ACT_OBST NA -# define ACT_TEMPC 11 -# define ACT_TEMPF 12 -# define ACT_FTEMPC NA -# define ACT_FTEMPF NA -# define ACT_ICON 14 -# define ACT_COND 15 | TRANSLATION -# define ACT_PRESS 23 -# define ACT_PRTEND NA -# define ACT_WSPEEDM 16 -# define ACT_WSPEEDK 17 -# define ACT_WINDD 19 | TRANSLATION -# define ACT_HMID 21 -# define ACT_VIS 22 -# define ACT_UVIND NA -# define ACT_UVTEXT NA -# define ACT_DEWP NA -# define ACT_MOON NA -# define ACT_CLOUDC 24 -# define ACT_PRECIPMM 20 + // atual Values +# define ACT_CITY 7 +# define ACT_OBST 21 +# define ACT_LAT 16 +# define ACT_LON 17 +# define ACT_UPTIME 31 +# define ACT_LOCALTIME 33 +# define ACT_TEMP_F 40 +# define ACT_TEMP_C 41 +# define ACT_FTEMP_F 63 +# define ACT_FTEMP_C 64 +# define ACT_ICON 75 +# define ACT_COND 38 //| TRANSLATION +# define ACT_HMID 42 +# define ACT_WINDD 44 | TRANSLATION +# define ACT_WSPEED_M 46 +# define ACT_WSPEED_K 48 +# define ACT_PRESS_MB 50 +# define ACT_PRESS_IN 51 +# define ACT_DEWP_F 54 +# define ACT_DEWP_C 55 +# define ACT_PRECIP_MM 72 +# define ACT_PRECIP_IN 73 +# define ACT_VIS_MI 65 +# define ACT_VIS_KM 66 +# define ACT_CLOUDC NA +# define ACT_SUNR 845 +# define ACT_SUNR_MM 846 +# define ACT_SUNS 848 +# define ACT_SUNS_MM 849 +# define ACT_PRTEND 52 +# define ACT_UVIND NA +# define ACT_UVTEXT NA +# define ACT_MOON_VIS 837 +# define ACT_MOON 839 | TRANSLATION -// Preview Values -# define PRE_DAY 25 -# define PRE_TEMPHC 26 -# define PRE_TEMPHF 27 -# define PRE_TEMPLC 28 -# define PRE_TEMPLF 29 -# define PRE_SUNR NA -# define PRE_SUNS NA -# define PRE_ICON 36 -# define PRE_COND 37 | TRANSLATION -# define PRE_WSPEEDM 30 -# define PRE_WSPEEDK 31 -# define PRE_WINDD 32 | TRANSLATION -# define PRE_BT NA -# define PRE_PPCP NA -# define PRE_HMID NA -# define PRE_PRECIPMM 38 + // Preview Values +# define PRE_DAY_SIG 239 +# define PRE_DAY 240 +# define PRE_TEMPH_F 246 +# define PRE_TEMPH_C 247 +# define PRE_TEMPL_F 249 +# define PRE_TEMPL_C 250 +# define PRE_SNOW_IN 266 | TRANSLATION +# define PRE_SNOW_MM 267 | TRANSLATION +# define PRE_WSPEED 281 +# define PRE_WINDD 282 | TRANSLATION +# define PRE_ICON 253 +# define PRE_COND 88 +# define PRE_COND_M 89 +# define PRE_PRECIPMM 261 | TRANSLATION +# define PRE_SUNR NA +# define PRE_SUNS NA +# define PRE_BT NA +# define PRE_PPCP 90 +# define PRE_HMID 284 #else # define PRE_STEP 32 # define NIGHT_STEP 13 @@ -139,6 +153,7 @@ void prs_get_act_dtime(int what, char *out); int prs_get_day (int, char *, int); int prs_get_days_count(void); int prs_get_val (int i, int what, int nacht, char *out); +int prs_get_val2 (int i, int what, int nacht, char *out); int prs_get_dbl (int i, int what, int nacht, char *out); int prs_get_time(int i, int what, char *out, int metric); int prs_get_dtime(int i, int what, char *out, int metric); diff --git a/tuxwetter.c b/tuxwetter.c index f0ebf9e..b35bd5e 100644 --- a/tuxwetter.c +++ b/tuxwetter.c @@ -43,20 +43,15 @@ #include "resize.h" #include "gifdecomp.h" -#define P_VERSION "3.07" +#define P_VERSION "3.08" #define S_VERSION "" -#ifndef HAVE_DREAMBOX_HARDWARE -#define CONFIGDIR "/var/tuxbox/config/tuxwetter" -#define START_PIC CONFIGDIR "/startbild.jpg" -#else -#define CONFIGDIR "/var/bin/tuxwet" -#endif + char CONVERT_LIST[]= CONFIGDIR "/convert.list"; #define CFG_FILE CONFIGDIR "/tuxwetter.conf" #define MCF_FILE CONFIGDIR "/tuxwetter.mcfg" //#define TIME_FILE CONFIGDIR "/swisstime" -//#define MISS_FILE CONFIGDIR "/missing_translations.txt" +#define START_PIC CONFIGDIR "/startbild.jpg" #define NCF_FILE "/var/tuxbox/config/neutrino.conf" #define ECF_FILE "/var/tuxbox/config/enigma/config" #define BMP_FILE "tuxwettr.bmp" @@ -71,13 +66,13 @@ char CONVERT_LIST[]= CONFIGDIR "/convert.list"; static char TCF_FILE[128]=""; #define LIST_STEP 10 -#define MAX_FUNCS 7 +#define MAX_FUNCS 2+10 #define LCD_CPL 12 #define LCD_RDIST 10 // Forward defines int pic_on_data(char *name, int xstart, int ystart, int xsize, int ysize, int wait, int single, int center, int rahmen); -char par[32]="", key[32]=""; +char par[32]={0}, key[32]={0}; void TrimString(char *strg); // Color table stuff @@ -131,13 +126,13 @@ void ShowInfo(MENU *m); // Misc const char NOMEM[]="Tuxwetter \n"; unsigned char *lfb = 0, *lbb = 0; -int intype=0, show_icons=0, gmodeon=0, ctmo=0, metric=1, loadalways=0, radius=0, num_of_days=5; +int intype=0, show_icons=0, gmodeon=0, ctmo=0, metric=1, loadalways=0, radius=0; char city_code[30] = ""; char city_name[50] = ""; unsigned int alpha=0x0202; int show_splash=0; -char lastpicture[BUFSIZE]=""; -char nstr[BUFSIZE]=""; +char lastpicture[BUFSIZE]={0}; +char nstr[BUFSIZE]={0}; char *trstr; char *htmstr; unsigned char *proxyadress=NULL, *proxyuserpwd=NULL; @@ -224,7 +219,7 @@ FILE *fh; int Read_Neutrino_Cfg(char *entry) { FILE *nfh; -char tstr [512], *cfptr=NULL; +char tstr[512]={0}, *cfptr=NULL; int rv=-1,styp=0; if((((nfh=fopen(NCF_FILE,"r"))!=NULL)&&(styp=1)) || ((((nfh=fopen(ECF_FILE,"r"))!=NULL))&&(styp=2))) @@ -333,22 +328,11 @@ int ReadConf(char *iscmd) { sscanf(cptr+1,"%d",&loadalways); } - if(strstr(line_buffer,"7-Days") == line_buffer) - { - int dtmp=0; - sscanf(cptr+1,"%d",&dtmp); - if (dtmp == 1) - num_of_days=7; - } -#ifdef WWEATHER - if(strstr(line_buffer,"API-Key") == line_buffer) -#else if(strstr(line_buffer,"PartnerID") == line_buffer) { strncpy(par,cptr+1,sizeof(par)-1); } - if(strstr(line_buffer,"licenseKey") == line_buffer) -#endif + if(strstr(line_buffer,"LicenseKey") == line_buffer) { strncpy(key,cptr+1,sizeof(key)-1); } @@ -370,11 +354,62 @@ int ReadConf(char *iscmd) return 1; } +int PaintWideString(int dy/*linespace*/, const char *string, int sx, int sy, int maxwidth, int layout, int size, int color) +{ + char vstr[512]={0},tstr[512]={0}; + int tc = 0; + + char* txt= (char*) string; + + while (*txt!=0) + { + if ( (*txt==' ') || (*txt=='-') || (*txt=='.') ) + { + tstr[tc]= *txt; + tstr[tc+1]= '\0'; + tc=-1; + + int tl = GetStringLen(sx, tstr, size); + int vl = GetStringLen(sx, vstr, size); + + if((vl+tl) < maxwidth) + { //add to line + strcat(vstr,tstr); + tstr[0]= '\0'; + } + else + { //new line + TrimString(vstr); + RenderString(vstr, sx, sy, maxwidth, layout, size, color); + sy+=dy; + + vstr[0]= '\0'; + strcat(vstr,tstr); + tstr[0]= '\0'; + } + } + else + { + tstr[tc]= *txt; + } + txt++; + tc++; + } + + tstr[tc]= '\0'; + strcat(vstr,tstr); + + TrimString(vstr); + RenderString(vstr, sx, sy, maxwidth, layout, size, color); + + return(sy); +} + int Transform_Entry(char *src, char *trg) { int tret=-1,fcnt,fpos,tval,ferr,tsub; int noprint,rndval,loctime=0; -char /*pstr[512],nstr[512],dstr[50],*/fstr[5],*cptr,*tptr,*aptr; +char /*pstr[512]={0},nstr[512]={0},dstr[50]={0},*/fstr[5]={0},*cptr,*tptr,*aptr; time_t stime; struct tm *tltime; @@ -1084,7 +1119,7 @@ void ShowInfo(MENU *m) { double scrollbar_len, scrollbar_ofs, scrollbar_cor; int loop, index=m->act_entry,tind=m->act_entry, sbw=(m->num_entrys > LIST_STEP)?14:0; - char tstr[BUFSIZE], *tptr; + char tstr[BUFSIZE]={0}, *tptr=NULL; int moffs=35, roffs=8, ixw=400, iyw=(m->num_entrys < LIST_STEP)?((m->num_entrys+1)*30+moffs):375, dy, my, mh, toffs, soffs=4, isx, isy; mh=iyw-moffs-roffs-(radius?4:0); @@ -1196,14 +1231,6 @@ int res; city_code[0]=0; return 1; } - if (num_of_days > prs_get_days_count()) - { - char tstr[64]; - sprintf(tstr,"%d-%s", num_of_days, prs_translate("Tage Vorschau nicht möglich", CONVERT_LIST)); - ShowMessage(tstr, 1); - city_code[0]=0; - return 1; - } } else { @@ -1230,28 +1257,40 @@ void show_data(int index) int itmp; #endif -char vstr[512],v2str[512],rstr[512],tstr[512],icon[60]; +char vstr[512]={0},v2str[512]={0},rstr[512]={0},tstr[512]={0},icon[60]={0}; int col1=40, vy=70; int col2=((preset)?340:300); int wxw=ex-sx-((preset)?120:30); //box width int wyw=ey-sy-((preset)?50:40); //box height +int nc=10; //table columns int gys=vy; //table space top int gysf=34; //table space bottom int gxs=40; //table space left -int gxw=((wxw-(gxs*2))/num_of_days) * num_of_days; //table width +//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 gywf=100; //table footer height int gyw=wyw-vy-gywf-gysf; //table height -int gicw=gxw/num_of_days; //table data width +//int gicw=gxw/nc; //table data width int vxs=0,wsx,wsy; int prelate=0; int rcd; int HMED=((preset)?22:20); int dy=26; //linespace +int slim=0; //using 720x576 time_t atime; struct tm *sltime; -char tun[2]="C",sun[5]="km/h",dun[6]="km",pun[5]="mbar",iun[7]="mm", cun[20]; +char tun[2]="C",sun[5]="km/h",dun[6]="km",pun[5]="hPa",iun[7]="mm", cun[20]; + + //recalculate wigth + gicw += ((gicw%10) > 5 ? 10-(gicw%10) : -(gicw%10)); //rounded table data width, needing for smoothed curves + gxw=gicw*nc; + gxs=(wxw-gxw)/2; + + if (var_screeninfo.xres < 1280) + slim=1; clear_screen(); @@ -1283,8 +1322,8 @@ char tun[2]="C",sun[5]="km/h",dun[6]="km",pun[5]="mbar",iun[7]="mm", cun[20]; sprintf(tun,"F"); // Fahrenheit sprintf(sun,"mph"); // miles per hour sprintf(dun,"miles"); - sprintf(pun,"mb"); // millibar - sprintf(iun,"inches"); + sprintf(pun,"inch"); // millibar + sprintf(iun,"inch"); *cun=0; // Uhrzeit } if(index==-99) @@ -1416,18 +1455,21 @@ char tun[2]="C",sun[5]="km/h",dun[6]="km",pun[5]="mbar",iun[7]="mm", cun[20]; { if(index==1) { - int i, tmax[7], tmin[7], mint=100, maxt=-100, j, pmin, pmax; - double tstep=1, garr[70], tv1, tv2, tv3; + int i, tmax[nc], tmin[nc], mint=100, maxt=-100, j, pmin, pmax; + double tstep=1, garr[nc*10], tv1, tv2, tv3; RenderBox(wsx, wsy, wxw, wyw, radius, CMC); RenderBox(wsx, wsy, wxw, 44, radius, CMH); - sprintf(rstr,"%s",prs_translate("Trend für die kommende Woche",CONVERT_LIST)); + sprintf(rstr,"%s %d %s",prs_translate("Trend für die kommende Woche",CONVERT_LIST),nc,prs_translate("Tage",CONVERT_LIST)); RenderString(rstr, wsx, wsy+34, 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\n"); - fclose(tfh); - return -1; - } -#else + if(fh_gif_getsize(ICON_FILE, &x1, &y1, xsize, ysize)) { printf("Tuxwetter \n"); - fclose(tfh); return -1; } -#endif + if((buffer=(unsigned char *) malloc(x1*y1*4))==NULL) { printf(NOMEM); - fclose(tfh); return -1; } -#ifdef WWEATHER - if(!(rv=fh_png_load(ICON_FILE, buffer, x1, y1))) -#else - if(!(rv=fh_gif_load(ICON_FILE, buffer, x1, y1))) -#endif + + if(!(rv=fh_gif_load(ICON_FILE, (char *)buffer, x1, y1))) { scale_pic(&buffer,x1,y1,xstart,ystart,xsize,ysize,&imx,&imy,&dxp,&dyp,&dxo,&dyo,center); if (rahmen >0) @@ -2500,7 +2575,6 @@ unsigned char *tbuf=lfb; } free(buffer); - fclose(tfh); lfb=tbuf; } return (rv)?-1:0; @@ -2831,7 +2905,7 @@ void read_neutrino_osd_conf(int *ex,int *sx,int *ey, int *sy) { const char *filename="/var/tuxbox/config/neutrino.conf"; const char spres[][4]={"","crt","lcd"}; - char sstr[4][32]; + char sstr[4][32]={0}; int pres=-1, resolution=-1, loop, *sptr[4]={ex, sx, ey, sy}; char *buffer; size_t len; @@ -2886,8 +2960,8 @@ int main (int argc, char **argv) { int index=0,cindex=0,tv,rce,ferr=0,tret=-1; int mainloop=1,wloop=1, dloop=1; -char rstr[BUFSIZE], *rptr; -char tstr[BUFSIZE]; +char rstr[BUFSIZE]={0}, *rptr=NULL; +char tstr[BUFSIZE]={0}; FILE *tfh; LISTENTRY epl={NULL, 0, TYP_TXTPLAIN, TYP_TXTPLAIN, 0, 0, 0}; PLISTENTRY pl=&epl; @@ -3418,7 +3492,7 @@ PLISTENTRY pl=&epl; if(cindex!=-98) { - strncpy(lastpicture,line_buffer,BUFSIZE); + strncpy(lastpicture,line_buffer,BUFSIZE-1); index=menu.act_entry; switch(tret) @@ -3490,16 +3564,14 @@ PLISTENTRY pl=&epl; while(dloop>0); close_jpg_gif_png(); break; - + case TYP_CITY: if(!prs_get_city()) { - - sprintf(tstr," "); - + //sprintf(tstr," "); Clear_List(&funcs, 1); funcs.act_entry=0; - + sprintf(tstr,"%s %s",prs_translate("Wetterdaten für",CONVERT_LIST),city_name); if(funcs.headertxt[0]) { @@ -3507,8 +3579,7 @@ PLISTENTRY pl=&epl; } funcs.headertxt[0]=strdup(tstr); - int num_of_funcs = (num_of_days==7) ? MAX_FUNCS+2 : MAX_FUNCS; - for(index=0; index=num_of_funcs) + if(++index>=MAX_FUNCS) { - index=0; + index=0; } break; diff --git a/tuxwetter.h b/tuxwetter.h index 0467124..a787669 100644 --- a/tuxwetter.h +++ b/tuxwetter.h @@ -23,6 +23,13 @@ #include FT_CACHE_H #include FT_CACHE_SMALL_BITMAPS_H +#ifndef HAVE_DREAMBOX_HARDWARE +#define CONFIGDIR "/var/tuxbox/config/tuxwetter" +#else +#define CONFIGDIR "/var/bin/tuxwet" +#endif +#define MISS_FILE CONFIGDIR "/missing_translations.txt" + //#define WWEATHER #define BUFSIZE 4095 @@ -127,6 +134,7 @@ extern unsigned sc[8], tc[8]; extern int instance; int get_instance(void); void put_instance(int pval); +int PaintWideString(int dy, const char *string, int sx, int sy, int maxwidth, int layout, int size, int color); #define FB_DEVICE "/dev/fb/0" diff --git a/tuxwetter.mcfg b/tuxwetter.mcfg index 40ef1a7..fb82465 100644 --- a/tuxwetter.mcfg +++ b/tuxwetter.mcfg @@ -3,12 +3,10 @@ Metric=1 # InetConnection=ISDN/ANALOG fuer langsamere Verbindungen zur Konfiguration von Timeoutzeiten InetConnection=DSL ConnectTimeout=5 -# Account bei weather.com Bei worldweatheronline.com wird der LicenseKey als ACode verwendet -#PartnerID=1005530704 -#LicenseKey=a9c95f7636ad307b -#LicenseKey=A2550021575 -LicenseKey=32z7znf5z7bwm2nednkyevb7 +# Account bei wunderground.com Bei www.wunderground.com wird der LicenseKey als ACode verwendet +#PartnerID= +LicenseKey= # SplashScreen=1/0 Startbildschirm anzeigen / nicht anzeigen SplashScreen=0 # ShowIcons=1/0 Wetter-Icons für Textanzeige downloaden / nicht downloaden -ShowIcons=1 \ No newline at end of file +ShowIcons=1 -- 2.39.5