X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/69480335852a70cb4d67fe7f4e3de03580424032..53f1bc75c00ec1ad6bf68cc80061e6cde94752e9:/Command/WeatherCommand.php diff --git a/Command/WeatherCommand.php b/Command/WeatherCommand.php index d8b2c86..4b3ea40 100644 --- a/Command/WeatherCommand.php +++ b/Command/WeatherCommand.php @@ -37,6 +37,7 @@ class WeatherCommand extends DoctrineCommand { 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=' @@ -48,6 +49,7 @@ class WeatherCommand extends DoctrineCommand { 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' @@ -263,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