X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/1cb9165e95db75354b5681b7749fcdf9133afd5a..d4e2146496297471ce06c92f149787e972e9c176:/Command/WeatherCommand.php?ds=inline diff --git a/Command/WeatherCommand.php b/Command/WeatherCommand.php index 00f922c..4b3ea40 100644 --- a/Command/WeatherCommand.php +++ b/Command/WeatherCommand.php @@ -33,9 +33,11 @@ class WeatherCommand extends DoctrineCommand { //Hourly uri 'hourly' => [ 75001 => 'https://www.accuweather.com/en/fr/paris-01-louvre/75001/hourly-weather-forecast/179142_pc?day=', + 75004 => 'https://www.accuweather.com/en/fr/paris-04-hotel-de-ville/75004/hourly-weather-forecast/179145_pc?day=', 75005 => 'https://www.accuweather.com/en/fr/paris-05-pantheon/75005/hourly-weather-forecast/179146_pc?day=', 75007 => 'https://www.accuweather.com/en/fr/paris-07-palais-bourbon/75007/hourly-weather-forecast/179148_pc?day=', 75009 => 'https://www.accuweather.com/en/fr/paris-09-opera/75009/hourly-weather-forecast/179150_pc?day=', + 75013 => 'https://www.accuweather.com/en/fr/paris-13-gobelins/75013/hourly-weather-forecast/179154_pc?day=', 75015 => 'https://www.accuweather.com/en/fr/paris-15-vaugirard/75015/hourly-weather-forecast/179156_pc?day=', 75019 => 'https://www.accuweather.com/en/fr/paris-19-buttes-chaumont/75019/hourly-weather-forecast/179160_pc?day=', 75116 => 'https://www.accuweather.com/en/fr/paris-16-passy/75116/hourly-weather-forecast/179246_pc?day=' @@ -43,9 +45,11 @@ class WeatherCommand extends DoctrineCommand { //Daily uri 'daily' => [ 75001 => 'https://www.accuweather.com/en/fr/paris-01-louvre/75001/daily-weather-forecast/179142_pc', + 75004 => 'https://www.accuweather.com/en/fr/paris-04-hotel-de-ville/75004/daily-weather-forecast/179145_pc', 75005 => 'https://www.accuweather.com/en/fr/paris-05-pantheon/75005/daily-weather-forecast/179146_pc', 75007 => 'https://www.accuweather.com/en/fr/paris-07-palais-bourbon/75007/daily-weather-forecast/179148_pc', 75009 => 'https://www.accuweather.com/en/fr/paris-09-opera/75009/daily-weather-forecast/179150_pc', + 75013 => 'https://www.accuweather.com/en/fr/paris-13-gobelins/75013/daily-weather-forecast/179154_pc', 75015 => 'https://www.accuweather.com/en/fr/paris-15-vaugirard/75015/daily-weather-forecast/179156_pc', 75019 => 'https://www.accuweather.com/en/fr/paris-19-buttes-chaumont/75019/daily-weather-forecast/179160_pc', 75116 => 'https://www.accuweather.com/en/fr/paris-16-passy/75116/daily-weather-forecast/179246_pc' @@ -261,14 +265,16 @@ class WeatherCommand extends DoctrineCommand { //Get rainrisk $rainrisk = str_replace('%', '', trim($node->div[0]->div[0]->div[1]))/100; - //Label is Rain when we have a rainfall - if (($pluviolabel = trim($node->div[1]->div[0]->div[0]->div[1]->p[1])) == 'Rain') { - //Get rainfall - $rainfall = str_replace(' mm', '', $node->div[1]->div[0]->div[0]->div[1]->p[1]->span[0]); - //Cloud Cover, no rainfall - } else { - //Set rainfall to 0 (mm) - $rainfall = 0; + //Set rainfall to 0 (mm) + $rainfall = 0; + + //Iterate on each entry + foreach($node->div[1]->div[0]->div[0]->div[1]->p as $p) { + //Lookup for rain entry if present + if (trim($p) == 'Rain') { + //Get rainfall + $rainfall = floatval(str_replace(' mm', '', $p->span[0])); + } } //Store data