Rev 8586 | Rev 8735 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8586 | Rev 8589 | ||
---|---|---|---|
Line 43... | Line 43... | ||
43 | 43 | ||
44 | #define API "api.openweathermap.org/data/2.5/weather?q=%s&appid=%s&units=%s&lang=%s" |
44 | #define API "api.openweathermap.org/data/2.5/weather?q=%s&appid=%s&units=%s&lang=%s" |
Line 45... | Line 45... | ||
45 | #define IMAGE_URL "openweathermap.org/img/w/%s.png" |
45 | #define IMAGE_URL "openweathermap.org/img/w/%s.png" |
- | 46 | ||
Line 46... | Line 47... | ||
46 | 47 | Image *blend=NULL; |
|
47 | Image *blend=NULL; |
48 | const char *config_name = "/sys/Settings/weather.json"; |
Line 48... | Line 49... | ||
48 | 49 | ||
Line 226... | Line 227... | ||
226 | end_draw(); |
227 | end_draw(); |
227 | } |
228 | } |
Line 228... | Line 229... | ||
228 | 229 | ||
229 | void get_config(char **City, char **Token, char **Units) // Загружаем конфиг |
230 | void get_config(char **City, char **Token, char **Units) // Загружаем конфиг |
230 | { |
231 | { |
231 | FILE *config_j = fopen("/sys/Settings/weather.json", "rb"); |
232 | FILE *config_j = fopen(config_name, "rb"); |
232 | if(config_j==NULL){ |
233 | if(config_j==NULL){ |
233 | notify_show("'Configuration file not found!' -E"); |
234 | notify_show("'Configuration file not found!' -E"); |
234 | exit(0); |
235 | exit(0); |
235 | } |
236 | } |
236 | size_t size = _ksys_get_filesize("weather.json"); // Получаем размер файла |
237 | size_t size = _ksys_get_filesize((char*)config_name); // Получаем размер файла |
237 | char *config_buff = safe_malloc(size+1); |
238 | char *config_buff = safe_malloc(size+1); |
238 | if(size != fread(config_buff, sizeof(char), size, config_j)){ |
239 | if(size != fread(config_buff, sizeof(char), size, config_j)){ |
239 | notify_show("'The configuration file was not fully read!' -E"); |
240 | notify_show("'The configuration file was not fully read!' -E"); |
240 | exit(0); |
241 | exit(0); |