summaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorMartin Schirrmacher <vdr.skinflatplus@schirrmacher.eu>2014-11-30 13:30:51 +0100
committerMartin Schirrmacher <vdr.skinflatplus@schirrmacher.eu>2014-11-30 13:30:51 +0100
commit7077eba3c3bf4ff2f641b5873e414ad9c3c541ba (patch)
tree39d7c10226f65df47d9c4ae179bdd4c9d93753fa /widgets
parent0e077a1ed82ca9bfb8e6f234f53bbb44400df86a (diff)
downloadskin-flatplus-7077eba3c3bf4ff2f641b5873e414ad9c3c541ba.tar.gz
skin-flatplus-7077eba3c3bf4ff2f641b5873e414ad9c3c541ba.tar.bz2
update widgets folders
Diffstat (limited to 'widgets')
-rwxr-xr-xwidgets/command_output/command.example9
-rwxr-xr-xwidgets/system_information/system_information.g2v57
-rwxr-xr-xwidgets/system_information/system_information.ubuntu60
-rwxr-xr-xwidgets/system_updatestatus/system_update_status.ubuntu9
-rwxr-xr-xwidgets/temperatures/temperatures.default13
-rwxr-xr-xwidgets/temperatures/temperatures.g2v17
-rw-r--r--widgets/weather/update_weather.php22
7 files changed, 108 insertions, 79 deletions
diff --git a/widgets/command_output/command.example b/widgets/command_output/command.example
index 03b12b23..25eab1b2 100755
--- a/widgets/command_output/command.example
+++ b/widgets/command_output/command.example
@@ -1,6 +1,9 @@
#!/bin/bash
-echo "MyTitle" > title
+OUTPUTFLDR="/tmp/skinflatplus/widgets/command_output"
+mkdir -p ${OUTPUTFLDR}
-echo "output line 1" > output
-echo "output line 2" >> output
+echo "MyTitle" > ${OUTPUTFLDR}/title
+
+echo "output line 1" > ${OUTPUTFLDR}/output
+echo "output line 2" >> ${OUTPUTFLDR}/output
diff --git a/widgets/system_information/system_information.g2v b/widgets/system_information/system_information.g2v
index c0905624..727b20c1 100755
--- a/widgets/system_information/system_information.g2v
+++ b/widgets/system_information/system_information.g2v
@@ -3,6 +3,13 @@
# this script will be executed when the widget will be drawn
# so make it short and fast
+OUTPUTFLDR="/tmp/skinflatplus/widgets/system_information"
+mkdir -p ${OUTPUTFLDR}
+
+OUTPUTFLDRTEMP="/tmp/skinflatplus/widgets/temperatures"
+OUTPUTFLDRSUPD="/tmp/skinflatplus/widgets/system_updatestatus"
+
+
# enable/disable items
SHOW_SYS_VERSION=1
SHOW_KERNEL_VERSION=0
@@ -56,7 +63,7 @@ LANG=en_EN
REL_FILE="/etc/g2v-release"
# delete all files
-rm -f [0-99]*
+rm -f ${OUTPUTFLDR}/[0-99]*
if [ $SHOW_SYS_VERSION = 1 ]; then
if [ -e $REL_FILE ] ; then
@@ -64,12 +71,12 @@ if [ $SHOW_SYS_VERSION = 1 ]; then
[[ ${REPLY} =~ PRETTY_NAME ]] && declare "${REPLY}" # locale Variable
[[ ${REPLY} =~ VERSION ]] && declare "${REPLY}" # locale Variable
done < $REL_FILE
- [ -n "$PRETTY_NAME" ] && echo "${PRETTY_NAME//\"/} ${VERSION//\"/}" > ./${SYS_VERSION_POS}_sys_version
+ [ -n "$PRETTY_NAME" ] && echo "${PRETTY_NAME//\"/} ${VERSION//\"/}" > ${OUTPUTFLDR}/${SYS_VERSION_POS}_sys_version
fi
fi
if [ $SHOW_KERNEL_VERSION = 1 ]; then
- uname -r > ./${KERNEL_VERSION_POS}_kernel_version
+ uname -r > ${OUTPUTFLDR}/${KERNEL_VERSION_POS}_kernel_version
fi
if [ $SHOW_UPTIME = 1 ]; then
@@ -78,21 +85,21 @@ if [ $SHOW_UPTIME = 1 ]; then
TAGE=$((UPTIME[0] / 86400)) ; STD=$((UPTIME[0] % 86400 / 3600))
MIN=$((UPTIME[0] % 3600 / 60)) ; SEK=$((UPTIME[0] % 60))
if [ $TAGE -ge 1 ] ; then
- echo "${TAGE}T ${STD}S ${MIN}M" > ./${UPTIME_POS}_uptime
+ echo "${TAGE}T ${STD}S ${MIN}M" > ${OUTPUTFLDR}/${UPTIME_POS}_uptime
else
- [ $STD -ge 1 ] && echo -n "${STD} Std. " > ./${UPTIME_POS}_uptime
- echo "${MIN} Min." >> ./${UPTIME_POS}_uptime
+ [ $STD -ge 1 ] && echo -n "${STD} Std. " > ${OUTPUTFLDR}/${UPTIME_POS}_uptime
+ echo "${MIN} Min." >> ${OUTPUTFLDR}/${UPTIME_POS}_uptime
fi
fi
if [ $SHOW_LOAD = 1 ]; then
LOADAVG=($(cat /proc/loadavg)) # Zeile in Array
- echo "${LOADAVG[0]//./,}" > ./${LOAD_POS}_load
+ echo "${LOADAVG[0]//./,}" > ${OUTPUTFLDR}/${LOAD_POS}_load
fi
if [ $SHOW_PROCESSES = 1 ]; then
PROCS=($(ls -d /proc/[0-9]*/))
- echo "${#PROCS[@]}" > ./${PROCESSES_POS}_processes
+ echo "${#PROCS[@]}" > ${OUTPUTFLDR}/${PROCESSES_POS}_processes
fi
if [ $SHOW_MEM_USAGE = 1 ]; then
@@ -102,7 +109,7 @@ if [ $SHOW_MEM_USAGE = 1 ]; then
MEM_USAGE=$((${BUF[2]} * 1000 / ${MEM[1]}))
[ $MEM_USAGE -lt 10 ] && MEM_USAGE="0${MEM_USAGE}"
MEM_DEC=${MEM_USAGE: -1}
- echo "${MEM_USAGE:0: -1},${MEM_DEC}%" > ./${MEM_USAGE_POS}_mem_usage
+ echo "${MEM_USAGE:0: -1},${MEM_DEC}%" > ${OUTPUTFLDR}/${MEM_USAGE_POS}_mem_usage
fi
if [ $SHOW_SWAP_USAGE = 1 ]; then
@@ -113,9 +120,9 @@ if [ $SHOW_SWAP_USAGE = 1 ]; then
SWP=$((${SWAP[2]} * 1000 / ${SWAP[1]}))
[ $SWP -lt 10 ] && SWP="0${SWP}"
SWP_DEC=${SWP: -1} ; SWP=${SWP:0: -1},${SWP_DEC}
- echo "${SWP}%" > ./${SWAP_USAGE_POS}_swap_usage
+ echo "${SWP}%" > ${OUTPUTFLDR}/${SWAP_USAGE_POS}_swap_usage
else
- echo "0,0%" > ./${SWAP_USAGE_POS}_swap_usage
+ echo "0,0%" > ${OUTPUTFLDR}/${SWAP_USAGE_POS}_swap_usage
fi
fi
fi
@@ -124,14 +131,14 @@ if [ $SHOW_ROOT_USAGE = 1 ]; then
mapfile -t < <(df -Ph /) # Ausgabe von df in Array (Zwei Zeilen)
ROOTUSAGE=(${MAPFILE[1]}) # 2. Zeile in Array
# Beispiel 2. Zeile: tmpfs 128M 30M 99M 23% /root
- echo "${ROOTUSAGE[4]}" > ./${ROOT_USAGE_POS}_root_usage
+ echo "${ROOTUSAGE[4]}" > ${OUTPUTFLDR}/${ROOT_USAGE_POS}_root_usage
fi
if [ $SHOW_VIDEO_USAGE = 1 ] && [ -d ${VIDEO_MOUNT} ]; then
mapfile -t < <(df -Ph ${VIDEO_MOUNT}) # Ausgabe von df in Array (Zwei Zeilen)
VIDEOUSAGE=(${MAPFILE[1]}) # 2. Zeile in Array
# Beispiel 2. Zeile: tmpfs 128M 30M 99M 23% /root
- echo "${VIDEOUSAGE[4]}" > ./${VIDEO_USAGE_POS}_video_usage
+ echo "${VIDEOUSAGE[4]}" > ${OUTPUTFLDR}/${VIDEO_USAGE_POS}_video_usage
fi
if [ $SHOW_VDR_CPU_USAGE = 1 ]; then
@@ -139,7 +146,7 @@ if [ $SHOW_VDR_CPU_USAGE = 1 ]; then
if [ $? = 0 ]; then
mapfile -t < <(ps -p ${vdr_pid} -o %cpu) # Ausgabe von ps in Array (Zwei Zeilen)
CPU_USAGE=${MAPFILE[1]/./,} # 24.2 -> 24,2
- echo "${CPU_USAGE}%" > ./${VDR_CPU_USAGE_POS}_vdr_cpu_usage
+ echo "${CPU_USAGE}%" > ${OUTPUTFLDR}/${VDR_CPU_USAGE_POS}_vdr_cpu_usage
fi
fi
@@ -148,28 +155,28 @@ if [ $SHOW_VDR_MEM_USAGE = 1 ]; then
if [ $? = 0 ]; then
mapfile -t < <(ps -p ${vdr_pid} -o %mem) # Ausgabe von ps in Array (Zwei Zeilen)
VDR_MEM_USAGE=${MAPFILE[1]/./,} # 24.2 -> 24,2
- echo "${VDR_MEM_USAGE}%" > ./${VDR_MEM_USAGE_POS}_vdr_mem_usage
+ echo "${VDR_MEM_USAGE}%" > ${OUTPUTFLDR}/${VDR_MEM_USAGE_POS}_vdr_mem_usage
fi
fi
if [ $SHOW_TEMPERATURES = 1 ]; then
./../temperatures/temperatures
- if [ -f ./cpu ]; then
- mv ./cpu ${TEMP_CPU_POS}_cpu
+ if [ -f ${OUTPUTFLDRTEMP}/cpu ]; then
+ cp ${OUTPUTFLDRTEMP}/cpu ${OUTPUTFLDR}/${TEMP_CPU_POS}_cpu
fi
- if [ -f ./pccase ]; then
- mv ./pccase ${TEMP_PCCASE_POS}_pccase
+ if [ -f ${OUTPUTFLDRTEMP}/pccase ]; then
+ cp ${OUTPUTFLDRTEMP}/pccase ${OUTPUTFLDR}/${TEMP_PCCASE_POS}_pccase
fi
- if [ -f ./gpu ]; then
- mv ./gpu ${TEMP_GPU_POS}_gpu
+ if [ -f ${OUTPUTFLDRTEMP}/gpu ]; then
+ cp ${OUTPUTFLDRTEMP}/gpu ${OUTPUTFLDR}/${TEMP_GPU_POS}_gpu
fi
fi
if [ $SHOW_SYSUPDATES = 1 ]; then
- if [ -f ./../system_updatestatus/updates ]; then
- cp ./../system_updatestatus/updates ${SYSUPD_POS}_updates
+ if [ -f ${OUTPUTFLDRSUPD}/updates ]; then
+ cp ${OUTPUTFLDRSUPD}/updates ${OUTPUTFLDR}/${SYSUPD_POS}_updates
fi
- if [ -f ./../system_updatestatus/security_updates ]; then
- cp ./../system_updatestatus/security_updates ${SYSSECUPD_POS}_security_updates
+ if [ -f ${OUTPUTFLDRSUPD}/security_updates ]; then
+ cp ${OUTPUTFLDRSUPD}/security_updates ${OUTPUTFLDR}/${SYSSECUPD_POS}_security_updates
fi
fi
diff --git a/widgets/system_information/system_information.ubuntu b/widgets/system_information/system_information.ubuntu
index 5d4c98a2..36c82896 100755
--- a/widgets/system_information/system_information.ubuntu
+++ b/widgets/system_information/system_information.ubuntu
@@ -3,6 +3,12 @@
# this script will be executed when the widget will be drawn
# so make it short and fast
+OUTPUTFLDR="/tmp/skinflatplus/widgets/system_information"
+mkdir -p ${OUTPUTFLDR}
+
+OUTPUTFLDRTEMP="/tmp/skinflatplus/widgets/temperatures"
+OUTPUTFLDRSUPD="/tmp/skinflatplus/widgets/system_updatestatus"
+
# enable/disable items
SHOW_SYS_VERSION=0
SHOW_KERNEL_VERSION=0
@@ -16,8 +22,8 @@ SHOW_VIDEO_USAGE=1
SHOW_VDR_CPU_USAGE=1
SHOW_VDR_MEM_USAGE=1
-SHOW_TEMPERATURES=0
-SHOW_SYSUPDATES=0
+SHOW_TEMPERATURES=1
+SHOW_SYSUPDATES=1
# Position of items
# sys_version & kernel_version are drawn in one line
@@ -54,14 +60,14 @@ VIDEO_MOUNT="/media/video"
LANG=en_EN
# delete all files
-rm -f [0-99]*
+rm -f ${OUTPUTFLDR}/[0-99]*
if [ $SHOW_SYS_VERSION = 1 ]; then
- cat /etc/os-release | grep "PRETTY_NAME=" | cut -d"\"" -f 2 > ./${SYS_VERSION_POS}_sys_version
+ cat /etc/os-release | grep "PRETTY_NAME=" | cut -d"\"" -f 2 > ${OUTPUTFLDR}/${SYS_VERSION_POS}_sys_version
fi
if [ $SHOW_KERNEL_VERSION = 1 ]; then
- uname -r > ./${KERNEL_VERSION_POS}_kernel_version
+ uname -r > ${OUTPUTFLDR}/${KERNEL_VERSION_POS}_kernel_version
fi
if [ $SHOW_UPTIME = 1 ]; then
@@ -70,21 +76,21 @@ if [ $SHOW_UPTIME = 1 ]; then
TAGE=$((UPTIME[0] / 86400)) ; STD=$((UPTIME[0] % 86400 / 3600))
MIN=$((UPTIME[0] % 3600 / 60)) ; SEK=$((UPTIME[0] % 60))
if [ $TAGE -ge 1 ] ; then
- echo "${TAGE}T ${STD}S ${MIN}M" > ./${UPTIME_POS}_uptime
+ echo "${TAGE}T ${STD}S ${MIN}M" > ${OUTPUTFLDR}/${UPTIME_POS}_uptime
else
- [ $STD -ge 1 ] && echo -n "${STD} Std. " > ./${UPTIME_POS}_uptime
- echo "${MIN} Min." >> ./${UPTIME_POS}_uptime
+ [ $STD -ge 1 ] && echo -n "${STD} Std. " > ${OUTPUTFLDR}/${UPTIME_POS}_uptime
+ echo "${MIN} Min." >> ${OUTPUTFLDR}/${UPTIME_POS}_uptime
fi
fi
if [ $SHOW_LOAD = 1 ]; then
LOADAVG=($(cat /proc/loadavg)) # Zeile in Array
- echo "${LOADAVG[0]//./,}" > ./${LOAD_POS}_load
+ echo "${LOADAVG[0]//./,}" > ${OUTPUTFLDR}/${LOAD_POS}_load
fi
if [ $SHOW_PROCESSES = 1 ]; then
PROCS=($(ls -d /proc/[0-9]*/))
- echo "${#PROCS[@]}" > ./${PROCESSES_POS}_processes
+ echo "${#PROCS[@]}" > ${OUTPUTFLDR}/${PROCESSES_POS}_processes
fi
if [ $SHOW_MEM_USAGE = 1 ]; then
@@ -94,7 +100,7 @@ if [ $SHOW_MEM_USAGE = 1 ]; then
MEM_USAGE=$((${BUF[2]} * 1000 / ${MEM[1]}))
[ $MEM_USAGE -lt 10 ] && MEM_USAGE="0${MEM_USAGE}"
MEM_DEC=${MEM_USAGE: -1}
- echo "${MEM_USAGE:0: -1},${MEM_DEC}%" > ./${MEM_USAGE_POS}_mem_usage
+ echo "${MEM_USAGE:0: -1},${MEM_DEC}%" > ${OUTPUTFLDR}/${MEM_USAGE_POS}_mem_usage
fi
if [ $SHOW_SWAP_USAGE = 1 ]; then
@@ -105,19 +111,19 @@ if [ $SHOW_SWAP_USAGE = 1 ]; then
SWP=$((${SWAP[2]} * 1000 / ${SWAP[1]}))
[ $SWP -lt 10 ] && SWP="0${SWP}"
SWP_DEC=${SWP: -1} ; SWP=${SWP:0: -1},${SWP_DEC}
- echo "${SWP}%" > ./${SWAP_USAGE_POS}_swap_usage
+ echo "${SWP}%" > ${OUTPUTFLDR}/${SWAP_USAGE_POS}_swap_usage
else
- echo "0,0%" > ./${SWAP_USAGE_POS}_swap_usage
+ echo "0,0%" > ${OUTPUTFLDR}/${SWAP_USAGE_POS}_swap_usage
fi
fi
fi
if [ $SHOW_ROOT_USAGE = 1 ]; then
- df -h / | awk '/\// {print $(NF-1)}' > ./${ROOT_USAGE_POS}_root_usage
+ df -h / | awk '/\// {print $(NF-1)}' > ${OUTPUTFLDR}/${ROOT_USAGE_POS}_root_usage
fi
if [ $SHOW_VIDEO_USAGE = 1 ] && [ -d ${VIDEO_MOUNT} ]; then
- df -h ${VIDEO_MOUNT} | awk '/\// {print $(NF-1)}' > ./${VIDEO_USAGE_POS}_video_usage
+ df -h ${VIDEO_MOUNT} | awk '/\// {print $(NF-1)}' > ${OUTPUTFLDR}/${VIDEO_USAGE_POS}_video_usage
fi
if [ $SHOW_VDR_CPU_USAGE = 1 ]; then
@@ -125,7 +131,7 @@ if [ $SHOW_VDR_CPU_USAGE = 1 ]; then
if [ $? = 0 ]; then
mapfile -t < <(ps -p ${vdr_pid} -o %cpu) # Ausgabe von ps in Array (Zwei Zeilen)
CPU_USAGE=${MAPFILE[1]/./,} # 24.2 -> 24,2
- echo "${CPU_USAGE}%" > ./${VDR_CPU_USAGE_POS}_vdr_cpu_usage
+ echo "${CPU_USAGE}%" > ${OUTPUTFLDR}/${VDR_CPU_USAGE_POS}_vdr_cpu_usage
fi
fi
@@ -134,28 +140,28 @@ if [ $SHOW_VDR_MEM_USAGE = 1 ]; then
if [ $? = 0 ]; then
mapfile -t < <(ps -p ${vdr_pid} -o %mem) # Ausgabe von ps in Array (Zwei Zeilen)
VDR_MEM_USAGE=${MAPFILE[1]/./,} # 24.2 -> 24,2
- echo "${VDR_MEM_USAGE}%" > ./${VDR_MEM_USAGE_POS}_vdr_mem_usage
+ echo "${VDR_MEM_USAGE}%" > ${OUTPUTFLDR}/${VDR_MEM_USAGE_POS}_vdr_mem_usage
fi
fi
if [ $SHOW_TEMPERATURES = 1 ]; then
./../temperatures/temperatures
- if [ -f ./cpu ]; then
- mv ./cpu ${TEMP_CPU_POS}_cpu
+ if [ -f ${OUTPUTFLDRTEMP}/cpu ]; then
+ cp ${OUTPUTFLDRTEMP}/cpu ${OUTPUTFLDR}/${TEMP_CPU_POS}_cpu
fi
- if [ -f ./pccase ]; then
- mv ./pccase ${TEMP_PCCASE_POS}_pccase
+ if [ -f ${OUTPUTFLDRTEMP}/pccase ]; then
+ cp ${OUTPUTFLDRTEMP}/pccase ${OUTPUTFLDR}/${TEMP_PCCASE_POS}_pccase
fi
- if [ -f ./gpu ]; then
- mv ./gpu ${TEMP_GPU_POS}_gpu
+ if [ -f ${OUTPUTFLDRTEMP}/gpu ]; then
+ cp ${OUTPUTFLDRTEMP}/gpu ${OUTPUTFLDR}/${TEMP_GPU_POS}_gpu
fi
fi
if [ $SHOW_SYSUPDATES = 1 ]; then
- if [ -f ./../system_updatestatus/updates ]; then
- cp ./../system_updatestatus/updates ${SYSUPD_POS}_updates
+ if [ -f ${OUTPUTFLDRSUPD}/updates ]; then
+ cp ${OUTPUTFLDRSUPD}/updates ${OUTPUTFLDR}/${SYSUPD_POS}_updates
fi
- if [ -f ./../system_updatestatus/security_updates ]; then
- cp ./../system_updatestatus/security_updates ${SYSSECUPD_POS}_security_updates
+ if [ -f ${OUTPUTFLDRSUPD}/security_updates ]; then
+ cp ${OUTPUTFLDRSUPD}/security_updates ${OUTPUTFLDR}/${SYSSECUPD_POS}_security_updates
fi
fi
diff --git a/widgets/system_updatestatus/system_update_status.ubuntu b/widgets/system_updatestatus/system_update_status.ubuntu
index 50bdc037..00972628 100755
--- a/widgets/system_updatestatus/system_update_status.ubuntu
+++ b/widgets/system_updatestatus/system_update_status.ubuntu
@@ -1,8 +1,11 @@
#!/bin/bash
+OUTPUTFLDR="/tmp/skinflatplus/widgets/system_updatestatus"
+mkdir -p ${OUTPUTFLDR}
+
APTCHECK=/usr/lib/update-notifier/apt-check
-rm -f updates security_updates
+rm -f ${OUTPUTFLDR}/updates ${OUTPUTFLDR}/security_updates
if [ ! -f ${APTCHECK} ]
then
@@ -12,6 +15,6 @@ fi
RET=$(${APTCHECK} 2>&1)
# updates
-echo $RET | cut -d";" -f1 > updates
+echo $RET | cut -d";" -f1 > ${OUTPUTFLDR}/updates
# security updates
-echo $RET | cut -d";" -f2 > security_updates
+echo $RET | cut -d";" -f2 > ${OUTPUTFLDR}/security_updates
diff --git a/widgets/temperatures/temperatures.default b/widgets/temperatures/temperatures.default
index be764be0..5d823b5c 100755
--- a/widgets/temperatures/temperatures.default
+++ b/widgets/temperatures/temperatures.default
@@ -3,23 +3,26 @@
# please update this script to fit your needs
# this script is call every time the widget will be drawn, so keep it short and fast ;)
+OUTPUTFLDR="/tmp/skinflatplus/widgets/temperatures"
+mkdir -p ${OUTPUTFLDR}
+
# if the script is executed from system_information script set the locale back for "°C"
LANG=de_DE.UTF-8
# there can be 4 files, cpu, gpu, pccase, motherboard
-rm -f ./cpu ./pccase ./gpu ./motherboard
+rm -f ${OUTPUTFLDR}/cpu ${OUTPUTFLDR}/pccase ${OUTPUTFLDR}/gpu ${OUTPUTFLDR}/motherboard
# intel core-i cpu temp
-sensors -A coretemp-isa-0000 | grep "Core 0" | awk '{print $3}' | tr -d "+" > ./cpu
+sensors -A coretemp-isa-0000 | grep "Core 0" | awk '{print $3}' | tr -d "+" > ${OUTPUTFLDR}/cpu
# pc case temp
-#sensors -A acpitz-virtual-0 | grep "temp1" | awk '{print $2}' | tr -d "+" > ./pccase
+#sensors -A acpitz-virtual-0 | grep "temp1" | awk '{print $2}' | tr -d "+" > ${OUTPUTFLDR}/pccase
# motherboard temp
-sensors -A acpitz-virtual-0 | grep "temp1" | awk '{print $2}' | tr -d "+" > ./motherboard
+sensors -A acpitz-virtual-0 | grep "temp1" | awk '{print $2}' | tr -d "+" > ${OUTPUTFLDR}/motherboard
# nvidia gpu temp
# nvidia-settings must be run as the user of the x server
GPU=`nvidia-settings -c :0 -t -query GPUCoreTemp | head -n 1`
-echo "${GPU}°C" > ./gpu
+echo "${GPU}°C" > ${OUTPUTFLDR}/gpu
diff --git a/widgets/temperatures/temperatures.g2v b/widgets/temperatures/temperatures.g2v
index 0f0472ff..cbac970b 100755
--- a/widgets/temperatures/temperatures.g2v
+++ b/widgets/temperatures/temperatures.g2v
@@ -3,12 +3,15 @@
# please update this script to fit your needs
# this script is call every time the widget will be drawn, so keep it short and fast ;)
+OUTPUTFLDR="/tmp/skinflatplus/widgets/temperatures"
+mkdir -p ${OUTPUTFLDR}
+
# if the script is executed from system_information script set the locale back for "°C"
LANG=de_DE.UTF-8
# there can be 4 files, cpu, gpu, pccase, motherboard
-rm -f ./cpu ./gpu ./pccase ./motherboard
+rm -f ${OUTPUTFLDR}/cpu ${OUTPUTFLDR}/gpu ${OUTPUTFLDR}/pccase ${OUTPUTFLDR}/motherboard
# intel core-i cpu temp
#sensors -A coretemp-isa-0000 | grep "Core 0" | awk '{print $3}' | tr -d "+" > ./cpu
@@ -16,19 +19,19 @@ rm -f ./cpu ./gpu ./pccase ./motherboard
# cpu temp
CPUTEMP=($(sensors -A | grep "CPU Temperature"))
CPUTEMP[2]=${CPUTEMP[2]/+} # +36.0°C -> 36.0°C
-#echo "${CPUTEMP[2]/./,}" > ./cpu # 36,0°C
-echo "${CPUTEMP[2]%.*}°C" > ./cpu # 36°C
+#echo "${CPUTEMP[2]/./,}" > ${OUTPUTFLDR}/cpu # 36,0°C
+echo "${CPUTEMP[2]%.*}°C" > ${OUTPUTFLDR}/cpu # 36°C
# pc case temp
-#sensors -A acpitz-virtual-0 | grep "temp1" | awk '{print $2}' | tr -d "+" > ./pccase
+#sensors -A acpitz-virtual-0 | grep "temp1" | awk '{print $2}' | tr -d "+" > ${OUTPUTFLDR}/pccase
# motherboard temp
MBTEMP=($(sensors -A | grep "MB Temperature"))
MBTEMP[2]=${MBTEMP[2]/+} # +36.0°C -> 36.0°C
-#echo "${MBTEMP[2]/./,}" > ./motherboard # 36,0°C
-echo "${MBTEMP[2]%.*}°C" > ./motherboard # 36°C
+#echo "${MBTEMP[2]/./,}" > ${OUTPUTFLDR}/motherboard # 36,0°C
+echo "${MBTEMP[2]%.*}°C" > ${OUTPUTFLDR}/motherboard # 36°C
# nvidia gpu temp
# nvidia-settings must be run as the user of the x server
GPU=$(nvidia-settings -c :0 -t -query GPUCoreTemp | head -n 1)
-echo "${GPU}°C" > ./gpu
+echo "${GPU}°C" > ${OUTPUTFLDR}/gpu
diff --git a/widgets/weather/update_weather.php b/widgets/weather/update_weather.php
index 4b4dbb86..a2294906 100644
--- a/widgets/weather/update_weather.php
+++ b/widgets/weather/update_weather.php
@@ -11,16 +11,20 @@ $lang = $ini_array['Lang'];
$convertPoint = $ini_array['ConvertPoint2Comma'];
$api_key = $ini_array['ApiKey'];
+$OUTPUTFLDRTEMP = "/tmp/skinflatplus/widgets/weather";
+if( !file_exists($OUTPUTFLDRTEMP) )
+ mkdir($OUTPUTFLDRTEMP, 0775, true);
+
include('lib/forecast.io.php');
// delete old files
-array_map('unlink', glob("weather.*"));
+array_map('unlink', glob($OUTPUTFLDRTEMP."/weather.*"));
// forecast query
$forecast = new ForecastIO($api_key);
$condition = $forecast->getCurrentConditions($latitude, $longitude, $units, $lang);
-if( !$handle = fopen("weather.0.temp", "w") ) {
+if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.0.temp", "w") ) {
print "can't create file!\n";
continue;
}
@@ -35,7 +39,7 @@ fclose($handle);
// get daily conditions for next 7 days
$conditions_week = $forecast->getForecastWeek($latitude, $longitude, $units, $lang);
-if( !$handle = fopen("weather.location", "w") ) {
+if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.location", "w") ) {
print "can't create file!\n";
} else {
fwrite($handle, $locationSkin);
@@ -47,14 +51,14 @@ $index = -1;
foreach($conditions_week as $conditions) {
$index++;
- if( !$handle = fopen("weather.".$index.".summary", "w") ) {
+ if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".summary", "w") ) {
print "can't create file!\n";
continue;
}
fwrite($handle, $conditions->getSummary());
fclose($handle);
- if( !$handle = fopen("weather.".$index.".tempMin", "w") ) {
+ if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".tempMin", "w") ) {
print "can't create file!\n";
continue;
}
@@ -66,7 +70,7 @@ foreach($conditions_week as $conditions) {
fwrite($handle, $degree_sign);
fclose($handle);
- if( !$handle = fopen("weather.".$index.".tempMax", "w") ) {
+ if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".tempMax", "w") ) {
print "can't create file!\n";
continue;
}
@@ -79,14 +83,14 @@ foreach($conditions_week as $conditions) {
fclose($handle);
- if( !$handle = fopen("weather.".$index.".precipitation", "w") ) {
+ if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".precipitation", "w") ) {
print "can't create file!\n";
continue;
}
fwrite($handle, $conditions->getPrecipitationProbability());
fclose($handle);
- if( !$handle = fopen("weather.".$index.".precipitationType", "w") ) {
+ if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".precipitationType", "w") ) {
print "can't create file!\n";
continue;
}
@@ -96,7 +100,7 @@ foreach($conditions_week as $conditions) {
fwrite($handle, "none");
fclose($handle);
- if( !$handle = fopen("weather.".$index.".icon", "w") ) {
+ if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".icon", "w") ) {
print "can't create file!\n";
continue;
}