diff options
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | baserender.c | 18 | ||||
-rw-r--r-- | config.h | 2 | ||||
-rw-r--r-- | displaymenu.c | 43 | ||||
-rwxr-xr-x | widgets/command_output/command.example | 9 | ||||
-rwxr-xr-x | widgets/system_information/system_information.g2v | 57 | ||||
-rwxr-xr-x | widgets/system_information/system_information.ubuntu | 60 | ||||
-rwxr-xr-x | widgets/system_updatestatus/system_update_status.ubuntu | 9 | ||||
-rwxr-xr-x | widgets/temperatures/temperatures.default | 13 | ||||
-rwxr-xr-x | widgets/temperatures/temperatures.g2v | 17 | ||||
-rw-r--r-- | widgets/weather/update_weather.php | 22 |
11 files changed, 144 insertions, 112 deletions
@@ -28,7 +28,6 @@ VDRLOGO = vdrlogo_default #DEFINES += -DDEBUGIMAGELOADTIME #DEFINES += -DDEBUGEPGTIME - ### The version number of this plugin (taken from the main source file): VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g') @@ -69,6 +68,7 @@ SOFILE = libvdr-$(PLUGIN).so INCLUDES += $(shell pkg-config --cflags Magick++ freetype2 fontconfig) DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVDRLOGO=\"$(VDRLOGO)\" +DEFINES += -DWIDGETFOLDER='"$(DESTDIR)$(LIBDIR)/$(PLUGIN)/widgets"' LIBS += $(shell pkg-config --libs Magick++) @@ -146,8 +146,8 @@ install-configs: cp configs/* $(DESTDIR)$(VDRCONFDIR)/plugins/$(PLUGIN)/configs install-widgets: - mkdir -p $(DESTDIR)$(VDRCONFDIR)/plugins/$(PLUGIN)/widgets - cp -r widgets/* $(DESTDIR)$(VDRCONFDIR)/plugins/$(PLUGIN)/widgets + mkdir -p $(DESTDIR)$(LIBDIR)/$(PLUGIN)/widgets + cp -r widgets/* $(DESTDIR)$(LIBDIR)/$(PLUGIN)/widgets install: install-lib install-i18n install-themes install-icons install-decors install-configs install-widgets diff --git a/baserender.c b/baserender.c index 5c971406..a8724dbf 100644 --- a/baserender.c +++ b/baserender.c @@ -1498,7 +1498,7 @@ void cFlatBaseRender::DrawWidgetWeather(void) { std::ifstream file; cString filename; - filename = cString::sprintf("%s/widgets/weather/weather.0.temp", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + filename = cString::sprintf("%s/weather/weather.0.temp", WIDGETOUTPUTPATH ); file.open(*filename, std::ifstream::in); if( file.is_open() ) { std::getline(file, tempToday); @@ -1511,7 +1511,7 @@ void cFlatBaseRender::DrawWidgetWeather(void) { } else return; - filename = cString::sprintf("%s/widgets/weather/weather.0.icon", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + filename = cString::sprintf("%s/weather/weather.0.icon", WIDGETOUTPUTPATH ); file.open(*filename, std::ifstream::in); if( file.is_open() ) { std::getline(file, iconToday); @@ -1519,7 +1519,7 @@ void cFlatBaseRender::DrawWidgetWeather(void) { } else return; - filename = cString::sprintf("%s/widgets/weather/weather.1.icon", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + filename = cString::sprintf("%s/weather/weather.1.icon", WIDGETOUTPUTPATH ); file.open(*filename, std::ifstream::in); if( file.is_open() ) { std::getline(file, iconTomorrow); @@ -1527,7 +1527,7 @@ void cFlatBaseRender::DrawWidgetWeather(void) { } else return; - filename = cString::sprintf("%s/widgets/weather/weather.0.tempMax", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + filename = cString::sprintf("%s/weather/weather.0.tempMax", WIDGETOUTPUTPATH ); file.open(*filename, std::ifstream::in); if( file.is_open() ) { std::getline(file, tempMaxToday); @@ -1535,7 +1535,7 @@ void cFlatBaseRender::DrawWidgetWeather(void) { } else return; - filename = cString::sprintf("%s/widgets/weather/weather.1.tempMax", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + filename = cString::sprintf("%s/weather/weather.1.tempMax", WIDGETOUTPUTPATH ); file.open(*filename, std::ifstream::in); if( file.is_open() ) { std::getline(file, tempMaxTomorrow); @@ -1543,7 +1543,7 @@ void cFlatBaseRender::DrawWidgetWeather(void) { } else return; - filename = cString::sprintf("%s/widgets/weather/weather.0.tempMin", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + filename = cString::sprintf("%s/weather/weather.0.tempMin", WIDGETOUTPUTPATH ); file.open(*filename, std::ifstream::in); if( file.is_open() ) { std::getline(file, tempMinToday); @@ -1551,7 +1551,7 @@ void cFlatBaseRender::DrawWidgetWeather(void) { } else return; - filename = cString::sprintf("%s/widgets/weather/weather.1.tempMin", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + filename = cString::sprintf("%s/weather/weather.1.tempMin", WIDGETOUTPUTPATH ); file.open(*filename, std::ifstream::in); if( file.is_open() ) { std::getline(file, tempMinTomorrow); @@ -1560,7 +1560,7 @@ void cFlatBaseRender::DrawWidgetWeather(void) { return; double p = 0.0; - filename = cString::sprintf("%s/widgets/weather/weather.0.precipitation", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + filename = cString::sprintf("%s/weather/weather.0.precipitation", WIDGETOUTPUTPATH ); file.open(*filename, std::ifstream::in); if( file.is_open() ) { std::getline(file, precToday); @@ -1571,7 +1571,7 @@ void cFlatBaseRender::DrawWidgetWeather(void) { precToday = cString::sprintf("%.0f%%", p); } - filename = cString::sprintf("%s/widgets/weather/weather.1.precipitation", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + filename = cString::sprintf("%s/weather/weather.1.precipitation", WIDGETOUTPUTPATH ); file.open(*filename, std::ifstream::in); if( file.is_open() ) { std::getline(file, precTomorrow); @@ -8,6 +8,8 @@ #define PLUGINCONFIGPATH (cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)) #define PLUGINRESOURCEPATH (cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)) +#define WIDGETOUTPUTPATH "/tmp/skinflatplus/widgets" + bool stringCompare( const std::string &left, const std::string &right ); bool pairCompareTimeStringDesc(const std::pair<time_t, std::string>&i, const std::pair<time_t, std::string>&j); diff --git a/displaymenu.c b/displaymenu.c index 4c68af96..dbce9d52 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -4224,11 +4224,12 @@ int cFlatDisplayMenu::DrawMainMenuWidgetSystemInformation(int wLeft, int wWidth, contentWidget.AddRect(cRect(0, ContentTop, wWidth, 3), Theme.Color(clrMenuEventTitleLine)); ContentTop += 6; - cString execFile = cString::sprintf("cd \"%s/widgets/system_information\"; \"%s/widgets/system_information/system_information\"", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)); + cString execFile = cString::sprintf("cd \"%s/system_information\"; \"%s/system_information/system_information\"", WIDGETFOLDER, WIDGETFOLDER); int r = system(*execFile); r += 0; // prevent Warning for unused variable - cString configsPath = cString::sprintf("%s/widgets/system_information/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)); + cString configsPath = cString::sprintf("%s/system_information/", WIDGETOUTPUTPATH); + std::vector<std::string> files; cReadDir d(configsPath); @@ -4261,7 +4262,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetSystemInformation(int wLeft, int wWidth, std::string num = fname.substr(0, found); if( atoi( num.c_str() ) > 0 ) { std::string item = fname.substr(found + 1, fname.length() - found); - cString itemFilename = cString::sprintf("%s/widgets/system_information/%s", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), fname.c_str() ); + cString itemFilename = cString::sprintf("%s/system_information/%s", WIDGETOUTPUTPATH, fname.c_str() ); std::ifstream file(*itemFilename, std::ifstream::in); if( file.is_open() ) { std::string item_content; @@ -4492,7 +4493,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetSystemUpdates(int wLeft, int wWidth, int ContentTop += 6; int updates = 0, securityUpdates = 0; - cString itemFilename = cString::sprintf("%s/widgets/system_updatestatus/updates", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + cString itemFilename = cString::sprintf("%s/system_updatestatus/updates", WIDGETOUTPUTPATH ); std::ifstream file(*itemFilename, std::ifstream::in); if( file.is_open() ) { std::string cont; @@ -4503,7 +4504,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetSystemUpdates(int wLeft, int wWidth, int updates = -1; } - itemFilename = cString::sprintf("%s/widgets/system_updatestatus/security_updates", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + itemFilename = cString::sprintf("%s/system_updatestatus/security_updates", WIDGETOUTPUTPATH ); std::ifstream file2(*itemFilename, std::ifstream::in); if( file2.is_open() ) { std::string cont; @@ -4544,14 +4545,14 @@ int cFlatDisplayMenu::DrawMainMenuWidgetTemperaturs(int wLeft, int wWidth, int C contentWidget.AddRect(cRect(0, ContentTop, wWidth, 3), Theme.Color(clrMenuEventTitleLine)); ContentTop += 6; - cString execFile = cString::sprintf("cd \"%s/widgets/temperatures\"; \"%s/widgets/temperatures/temperatures\"", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)); + cString execFile = cString::sprintf("cd \"%s/temperatures\"; \"%s/temperatures/temperatures\"", WIDGETFOLDER, WIDGETFOLDER); int r = system(*execFile); r += 0; // prevent Warning for unused variable int countTemps = 0; std::string tempCPU, tempCase, tempMB, tempGPU; - cString itemFilename = cString::sprintf("%s/widgets/temperatures/cpu", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + cString itemFilename = cString::sprintf("%s/temperatures/cpu", WIDGETOUTPUTPATH ); std::ifstream file(*itemFilename, std::ifstream::in); if( file.is_open() ) { std::getline(file, tempCPU); @@ -4561,7 +4562,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetTemperaturs(int wLeft, int wWidth, int C tempCPU = "-1"; } - itemFilename = cString::sprintf("%s/widgets/temperatures/pccase", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + itemFilename = cString::sprintf("%s/temperatures/pccase", WIDGETOUTPUTPATH ); std::ifstream file2(*itemFilename, std::ifstream::in); if( file2.is_open() ) { std::string cont; @@ -4572,7 +4573,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetTemperaturs(int wLeft, int wWidth, int C tempCase = "-1"; } - itemFilename = cString::sprintf("%s/widgets/temperatures/motherboard", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + itemFilename = cString::sprintf("%s/temperatures/motherboard", WIDGETOUTPUTPATH ); std::ifstream file3(*itemFilename, std::ifstream::in); if( file3.is_open() ) { std::string cont; @@ -4582,7 +4583,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetTemperaturs(int wLeft, int wWidth, int C } else { tempMB = "-1"; } - itemFilename = cString::sprintf("%s/widgets/temperatures/gpu", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + itemFilename = cString::sprintf("%s/temperatures/gpu", WIDGETOUTPUTPATH ); std::ifstream file4(*itemFilename, std::ifstream::in); if( file4.is_open() ) { std::string cont; @@ -4631,12 +4632,12 @@ int cFlatDisplayMenu::DrawMainMenuWidgetCommand(int wLeft, int wWidth, int Conte if( ContentTop + fontHeight + 6 + fontSmlHeight > menuPixmap->ViewPort().Height() ) return -1; - cString execFile = cString::sprintf("cd \"%s/widgets/command_output\"; \"%s/widgets/command_output/command\"", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)); + cString execFile = cString::sprintf("cd \"%s/command_output\"; \"%s/command_output/command\"", WIDGETFOLDER, WIDGETFOLDER); int r = system(*execFile); r += 0; // prevent Warning for unused variable std::string Title; - cString itemFilename = cString::sprintf("%s/widgets/command_output/title", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + cString itemFilename = cString::sprintf("%s/command_output/title", WIDGETOUTPUTPATH ); std::ifstream file(*itemFilename, std::ifstream::in); if( file.is_open() ) { std::getline(file, Title); @@ -4655,7 +4656,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetCommand(int wLeft, int wWidth, int Conte ContentTop += 6; std::string Output; - itemFilename = cString::sprintf("%s/widgets/command_output/output", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + itemFilename = cString::sprintf("%s/command_output/output", WIDGETOUTPUTPATH ); std::ifstream file2(*itemFilename, std::ifstream::in); if( file2.is_open() ) { for (; std::getline(file2, Output); ) { @@ -4681,7 +4682,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetWeather(int wLeft, int wWidth, int Conte cFont *fontTempSml = cFont::CreateFont(Setup.FontOsd, Setup.FontOsdSize/2.0 ); std::string Location; - cString locationFilename = cString::sprintf("%s/widgets/weather/weather.location", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + cString locationFilename = cString::sprintf("%s/weather/weather.location", WIDGETOUTPUTPATH ); std::ifstream file(*locationFilename, std::ifstream::in); if( file.is_open() ) { std::getline(file, Location); @@ -4692,7 +4693,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetWeather(int wLeft, int wWidth, int Conte std::string tempToday = ""; cString filename; - filename = cString::sprintf("%s/widgets/weather/weather.0.temp", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N) ); + filename = cString::sprintf("%s/weather/weather.0.temp", WIDGETOUTPUTPATH ); file.open(*filename, std::ifstream::in); if( file.is_open() ) { std::getline(file, tempToday); @@ -4713,7 +4714,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetWeather(int wLeft, int wWidth, int Conte int left = marginItem; for( int index = 0; index < Config.MainMenuWidgetWeatherDays; index++ ) { std::string icon; - cString iconFilename = cString::sprintf("%s/widgets/weather/weather.%d.icon", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), index ); + cString iconFilename = cString::sprintf("%s/weather/weather.%d.icon", WIDGETOUTPUTPATH, index ); std::ifstream file(*iconFilename, std::ifstream::in); if( file.is_open() ) { std::getline(file, icon); @@ -4722,7 +4723,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetWeather(int wLeft, int wWidth, int Conte continue; std::string summary; - cString summaryFilename = cString::sprintf("%s/widgets/weather/weather.%d.summary", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), index ); + cString summaryFilename = cString::sprintf("%s/weather/weather.%d.summary", WIDGETOUTPUTPATH, index ); std::ifstream file2(*summaryFilename, std::ifstream::in); if( file2.is_open() ) { std::getline(file2, summary); @@ -4731,7 +4732,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetWeather(int wLeft, int wWidth, int Conte continue; std::string tempMax; - cString tempMaxFilename = cString::sprintf("%s/widgets/weather/weather.%d.tempMax", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), index ); + cString tempMaxFilename = cString::sprintf("%s/weather/weather.%d.tempMax", WIDGETOUTPUTPATH, index ); std::ifstream file3(*tempMaxFilename, std::ifstream::in); if( file3.is_open() ) { std::getline(file3, tempMax); @@ -4740,7 +4741,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetWeather(int wLeft, int wWidth, int Conte continue; std::string tempMin; - cString tempMinFilename = cString::sprintf("%s/widgets/weather/weather.%d.tempMin", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), index ); + cString tempMinFilename = cString::sprintf("%s/weather/weather.%d.tempMin", WIDGETOUTPUTPATH, index ); std::ifstream file4(*tempMinFilename, std::ifstream::in); if( file4.is_open() ) { std::getline(file4, tempMin); @@ -4751,7 +4752,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetWeather(int wLeft, int wWidth, int Conte std::string prec; double p = 0.0; cString precString = "0%"; - cString precFilename = cString::sprintf("%s/widgets/weather/weather.%d.precipitation", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), index ); + cString precFilename = cString::sprintf("%s/weather/weather.%d.precipitation", WIDGETOUTPUTPATH, index ); std::ifstream file5(*precFilename, std::ifstream::in); if( file5.is_open() ) { std::getline(file5, prec); @@ -4764,7 +4765,7 @@ int cFlatDisplayMenu::DrawMainMenuWidgetWeather(int wLeft, int wWidth, int Conte continue; std::string precType; - cString precTypeFilename = cString::sprintf("%s/widgets/weather/weather.%d.precipitationType", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), index ); + cString precTypeFilename = cString::sprintf("%s/weather/weather.%d.precipitationType", WIDGETOUTPUTPATH, index ); std::ifstream file6(*precTypeFilename, std::ifstream::in); if( file6.is_open() ) { std::getline(file6, precType); 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; } |