diff options
author | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-11-16 15:05:20 +0100 |
---|---|---|
committer | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-11-16 15:05:20 +0100 |
commit | a43f1eeda472fc41b6f64f37f1a11749b6dac75c (patch) | |
tree | 94bf6dff8ebc1a214d642de60f8bad35cf7f6900 /widgets | |
parent | efdb12a81dd96d913651b8b2bd5bbcbd8b135cbb (diff) | |
download | skin-flatplus-a43f1eeda472fc41b6f64f37f1a11749b6dac75c.tar.gz skin-flatplus-a43f1eeda472fc41b6f64f37f1a11749b6dac75c.tar.bz2 |
add weather widget in displaychannel displayreplay
Diffstat (limited to 'widgets')
-rwxr-xr-x | widgets/temperatures/temperatures | 2 | ||||
-rwxr-xr-x | widgets/temperatures/temperatures.g2v | 12 | ||||
-rw-r--r-- | widgets/weather/update_weather.php | 22 |
3 files changed, 19 insertions, 17 deletions
diff --git a/widgets/temperatures/temperatures b/widgets/temperatures/temperatures index 56259ddd..be764be0 100755 --- a/widgets/temperatures/temperatures +++ b/widgets/temperatures/temperatures @@ -8,7 +8,7 @@ LANG=de_DE.UTF-8 # there can be 4 files, cpu, gpu, pccase, motherboard -rm -f ./cpu ./pccase ./gpu +rm -f ./cpu ./pccase ./gpu ./motherboard # intel core-i cpu temp sensors -A coretemp-isa-0000 | grep "Core 0" | awk '{print $3}' | tr -d "+" > ./cpu diff --git a/widgets/temperatures/temperatures.g2v b/widgets/temperatures/temperatures.g2v index 7da4d68e..0f0472ff 100755 --- a/widgets/temperatures/temperatures.g2v +++ b/widgets/temperatures/temperatures.g2v @@ -8,23 +8,25 @@ LANG=de_DE.UTF-8 # there can be 4 files, cpu, gpu, pccase, motherboard -rm -f ./cpu ./pccase ./gpu +rm -f ./cpu ./gpu ./pccase ./motherboard # intel core-i cpu temp #sensors -A coretemp-isa-0000 | grep "Core 0" | awk '{print $3}' | tr -d "+" > ./cpu # cpu temp CPUTEMP=($(sensors -A | grep "CPU Temperature")) -CPUTEMP[2]=${CPUTEMP[2]/+} +CPUTEMP[2]=${CPUTEMP[2]/+} # +36.0°C -> 36.0°C #echo "${CPUTEMP[2]/./,}" > ./cpu # 36,0°C echo "${CPUTEMP[2]%.*}°C" > ./cpu # 36°C # pc case temp #sensors -A acpitz-virtual-0 | grep "temp1" | awk '{print $2}' | tr -d "+" > ./pccase + +# motherboard temp MBTEMP=($(sensors -A | grep "MB Temperature")) -MBTEMP[2]=${MBTEMP[2]/+} -#echo "${MBTEMP[2]/./,}" > ./pccase # 36,0°C -echo "${MBTEMP[2]%.*}°C" > ./pccase # 36°C +MBTEMP[2]=${MBTEMP[2]/+} # +36.0°C -> 36.0°C +#echo "${MBTEMP[2]/./,}" > ./motherboard # 36,0°C +echo "${MBTEMP[2]%.*}°C" > ./motherboard # 36°C # nvidia gpu temp # nvidia-settings must be run as the user of the x server diff --git a/widgets/weather/update_weather.php b/widgets/weather/update_weather.php index d2d38c1e..800f3f7b 100644 --- a/widgets/weather/update_weather.php +++ b/widgets/weather/update_weather.php @@ -18,6 +18,17 @@ array_map('unlink', glob("weather.*")); // forecast query $forecast = new ForecastIO($api_key); +$condition = $forecast->getCurrentConditions($latitude, $longitude, $units, $lang); +if( !$handle = fopen("weather.0.temp", "w") ) { + print "can't create file!\n"; + continue; +} +$temp = round($condition->getTemperature(), 1); +fwrite($handle, $temp); +fwrite($handle, $degree_sign); +fclose($handle); + + // get daily conditions for next 7 days $conditions_week = $forecast->getForecastWeek($latitude, $longitude, $units, $lang); @@ -40,17 +51,6 @@ foreach($conditions_week as $conditions) { fwrite($handle, $conditions->getSummary()); fclose($handle); -/* - if( !$handle = fopen("weather.".$index.".temp", "w") ) { - print "can't create file!\n"; - continue; - } - // we only have min & max so we must calc - $temp = round(($conditions->getMinTemperature() + $conditions->getMaxTemperature()) / 2.0, 1); - fwrite($handle, $temp); - fwrite($handle, $degree_sign); - fclose($handle); - */ if( !$handle = fopen("weather.".$index.".tempMin", "w") ) { print "can't create file!\n"; continue; |