diff options
-rw-r--r-- | baserender.c | 77 | ||||
-rw-r--r-- | config.c | 2 | ||||
-rw-r--r-- | config.h | 1 | ||||
-rw-r--r-- | po/de_DE.po | 5 | ||||
-rw-r--r-- | setup.c | 4 | ||||
-rw-r--r-- | widgets/command_output/README | 5 | ||||
-rwxr-xr-x | widgets/command_output/command.example (renamed from widgets/command_output/command) | 0 | ||||
-rw-r--r-- | widgets/system_information/README | 5 | ||||
l--------- | widgets/system_information/system_information | 1 | ||||
-rwxr-xr-x | widgets/system_information/system_information.g2v | 2 | ||||
-rwxr-xr-x | widgets/system_updatestatus/system_update_status | 17 | ||||
-rwxr-xr-x | widgets/system_updatestatus/system_update_status.ubuntu | 65 | ||||
-rw-r--r-- | widgets/temperatures/README | 3 | ||||
-rwxr-xr-x | widgets/temperatures/temperatures.default (renamed from widgets/temperatures/temperatures) | 0 | ||||
-rw-r--r-- | widgets/weather/GetLatLangFromCity.php | 4 | ||||
-rw-r--r-- | widgets/weather/README | 6 | ||||
-rw-r--r-- | widgets/weather/update_weather.config | 17 | ||||
-rw-r--r-- | widgets/weather/update_weather.config.sample | 23 | ||||
-rw-r--r-- | widgets/weather/update_weather.php | 2 |
19 files changed, 103 insertions, 136 deletions
diff --git a/baserender.c b/baserender.c index db8edbfa..0139e449 100644 --- a/baserender.c +++ b/baserender.c @@ -1484,7 +1484,10 @@ int cFlatBaseRender::GetFontAscender(const char *Name, int CharHeight, int CharW } void cFlatBaseRender::DrawWidgetWeather(void) { - cFont *fontTempSml = cFont::CreateFont(Setup.FontOsd, Setup.FontOsdSize/2.0 ); + int fs = int(round(cOsd::OsdHeight() * Config.WeatherFontSize)); + cFont *weatherFont = cFont::CreateFont(Setup.FontOsd, fs); + cFont *weatherFontSml = cFont::CreateFont(Setup.FontOsd, fs/2.0 ); + cFont *weatherFontSign = cFont::CreateFont(Setup.FontOsd, fs/2.5 ); std::string tempToday = "", tempTodaySign = ""; std::string iconToday, iconTomorrow; @@ -1581,70 +1584,70 @@ void cFlatBaseRender::DrawWidgetWeather(void) { int left = marginItem; - int widthTempToday = max(fontTempSml->Width(tempMaxToday.c_str()), fontTempSml->Width(tempMinToday.c_str()) ); - int widthTempTomorrow = max(fontTempSml->Width(tempMaxTomorrow.c_str()), fontTempSml->Width(tempMinTomorrow.c_str()) ); + int widthTempToday = max(weatherFontSml->Width(tempMaxToday.c_str()), weatherFontSml->Width(tempMinToday.c_str()) ); + int widthTempTomorrow = max(weatherFontSml->Width(tempMaxTomorrow.c_str()), weatherFontSml->Width(tempMinTomorrow.c_str()) ); int wTop = topBarHeight + Config.decorBorderTopBarSize*2 + 20 + Config.decorBorderChannelEPGSize; - int wWidth = marginItem + font->Width(tempToday.c_str()) + fontTempSml->Width(tempTodaySign.c_str()) + marginItem*2 + fontHeight + marginItem \ - + widthTempToday + marginItem + fontHeight - marginItem*2 \ - + fontTempSml->Width(precToday.c_str()) + marginItem*4 + fontHeight + marginItem \ - + widthTempTomorrow + marginItem + fontHeight - marginItem*2 \ - + fontTempSml->Width(precTomorrow.c_str()) + marginItem*2; + int wWidth = marginItem + weatherFont->Width(tempToday.c_str()) + weatherFontSign->Width(tempTodaySign.c_str()) + marginItem*2 + weatherFont->Height() + marginItem \ + + widthTempToday + marginItem + weatherFont->Height() - marginItem*2 \ + + weatherFontSml->Width(precToday.c_str()) + marginItem*4 + weatherFont->Height() + marginItem \ + + widthTempTomorrow + marginItem + weatherFont->Height() - marginItem*2 \ + + weatherFontSml->Width(precTomorrow.c_str()) + marginItem*2; int wLeft = osdWidth - wWidth - 20; weatherWidget.Clear(); weatherWidget.SetOsd(osd); - weatherWidget.SetPosition(cRect(wLeft, wTop, wWidth, fontHeight)); + weatherWidget.SetPosition(cRect(wLeft, wTop, wWidth, weatherFont->Height())); weatherWidget.SetBGColor(Theme.Color(clrItemCurrentBg)); weatherWidget.SetScrollingActive(false); - weatherWidget.AddText(tempToday.c_str(), false, cRect(left, 0, 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrItemCurrentBg), font); - left += font->Width(tempToday.c_str()); + weatherWidget.AddText(tempToday.c_str(), false, cRect(left, 0, 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrItemCurrentBg), weatherFont); + left += weatherFont->Width(tempToday.c_str()); - int fontAscender = GetFontAscender(Setup.FontOsd, Setup.FontOsdSize); - int fontAscender2 = GetFontAscender(Setup.FontOsd, Setup.FontOsdSize / 2.0); - int t = (fontHeight - fontAscender) - (fontTempSml->Height() - fontAscender2); + int fontAscender = GetFontAscender(Setup.FontOsd, fs); + int fontAscender2 = GetFontAscender(Setup.FontOsd, fs / 2.5); + int t = (weatherFont->Height() - fontAscender) - (weatherFontSign->Height() - fontAscender2); - weatherWidget.AddText(tempTodaySign.c_str(), false, cRect(left, t, 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrItemCurrentBg), fontTempSml); - left += fontTempSml->Width(tempTodaySign.c_str()) + marginItem*2; + weatherWidget.AddText(tempTodaySign.c_str(), false, cRect(left, t, 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrItemCurrentBg), weatherFontSign); + left += weatherFontSign->Width(tempTodaySign.c_str()) + marginItem*2; cString weatherIcon = cString::sprintf("widgets/%s", iconToday.c_str()); - cImage *img = imgLoader.LoadIcon(*weatherIcon, fontHeight, fontHeight - marginItem*2); + cImage *img = imgLoader.LoadIcon(*weatherIcon, weatherFont->Height(), weatherFont->Height() - marginItem*2); if( img ) { - weatherWidget.AddImage(img, cRect(left, 0 + marginItem, fontHeight, fontHeight)); - left += fontHeight + marginItem; + weatherWidget.AddImage(img, cRect(left, 0 + marginItem, weatherFont->Height(), weatherFont->Height())); + left += weatherFont->Height() + marginItem; } - weatherWidget.AddText(tempMaxToday.c_str(), false, cRect(left, 0, 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrItemCurrentBg), fontTempSml); - weatherWidget.AddText(tempMinToday.c_str(), false, cRect(left, 0 + fontTempSml->Height(), 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrItemCurrentBg), fontTempSml); + weatherWidget.AddText(tempMaxToday.c_str(), false, cRect(left, 0, 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrItemCurrentBg), weatherFontSml); + weatherWidget.AddText(tempMinToday.c_str(), false, cRect(left, 0 + weatherFontSml->Height(), 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrItemCurrentBg), weatherFontSml); left += widthTempToday + marginItem; - img = imgLoader.LoadIcon("widgets/umbrella", fontHeight, fontHeight - marginItem*2); + img = imgLoader.LoadIcon("widgets/umbrella", weatherFont->Height(), weatherFont->Height() - marginItem*2); if( img ) { - weatherWidget.AddImage(img, cRect(left, 0 + marginItem, fontHeight, fontHeight)); - left += fontHeight - marginItem*2; + weatherWidget.AddImage(img, cRect(left, 0 + marginItem, weatherFont->Height(), weatherFont->Height())); + left += weatherFont->Height() - marginItem*2; } - weatherWidget.AddText(precToday.c_str(), false, cRect(left, 0 + (fontHeight/2 - fontTempSml->Height()/2), 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrItemCurrentBg), fontTempSml); - left += fontTempSml->Width(precToday.c_str()) + marginItem*4; + weatherWidget.AddText(precToday.c_str(), false, cRect(left, 0 + (weatherFont->Height()/2 - weatherFontSml->Height()/2), 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrItemCurrentBg), weatherFontSml); + left += weatherFontSml->Width(precToday.c_str()) + marginItem*4; - weatherWidget.AddRect(cRect(left - marginItem*2, 0, wWidth - left + marginItem*2, fontHeight), Theme.Color(clrChannelBg)); + weatherWidget.AddRect(cRect(left - marginItem*2, 0, wWidth - left + marginItem*2, weatherFont->Height()), Theme.Color(clrChannelBg)); weatherIcon = cString::sprintf("widgets/%s", iconTomorrow.c_str()); - img = imgLoader.LoadIcon(*weatherIcon, fontHeight, fontHeight - marginItem*2); + img = imgLoader.LoadIcon(*weatherIcon, weatherFont->Height(), weatherFont->Height() - marginItem*2); if( img ) { - weatherWidget.AddImage(img, cRect(left, 0 + marginItem, fontHeight, fontHeight)); - left += fontHeight + marginItem; + weatherWidget.AddImage(img, cRect(left, 0 + marginItem, weatherFont->Height(), weatherFont->Height())); + left += weatherFont->Height() + marginItem; } - weatherWidget.AddText(tempMaxTomorrow.c_str(), false, cRect(left, 0, 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrChannelBg), fontTempSml); - weatherWidget.AddText(tempMinTomorrow.c_str(), false, cRect(left, 0 + fontTempSml->Height(), 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrChannelBg), fontTempSml); + weatherWidget.AddText(tempMaxTomorrow.c_str(), false, cRect(left, 0, 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrChannelBg), weatherFontSml); + weatherWidget.AddText(tempMinTomorrow.c_str(), false, cRect(left, 0 + weatherFontSml->Height(), 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrChannelBg), weatherFontSml); left += widthTempTomorrow + marginItem; - img = imgLoader.LoadIcon("widgets/umbrella", fontHeight, fontHeight - marginItem*2); + img = imgLoader.LoadIcon("widgets/umbrella", weatherFont->Height(), weatherFont->Height() - marginItem*2); if( img ) { - weatherWidget.AddImage(img, cRect(left, 0 + marginItem, fontHeight, fontHeight)); - left += fontHeight - marginItem*2; + weatherWidget.AddImage(img, cRect(left, 0 + marginItem, weatherFont->Height(), weatherFont->Height())); + left += weatherFont->Height() - marginItem*2; } - weatherWidget.AddText(precTomorrow.c_str(), false, cRect(left, 0 + (fontHeight/2 - fontTempSml->Height()/2), 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrChannelBg), fontTempSml); - left += fontTempSml->Width(precTomorrow.c_str()); + weatherWidget.AddText(precTomorrow.c_str(), false, cRect(left, 0 + (weatherFont->Height()/2 - weatherFontSml->Height()/2), 0, 0), Theme.Color(clrChannelFontEpg), Theme.Color(clrChannelBg), weatherFontSml); + left += weatherFontSml->Width(precTomorrow.c_str()); //weatherWidget.AddRect(cRect(left, 0, wWidth - left, fontHeight), clrTransparent); @@ -114,6 +114,7 @@ cFlatConfig::cFlatConfig(void) { ChannelWeatherShow = 1; PlaybackWeatherShow = 1; + WeatherFontSize = 0.05; TopBarFontClockScale = 0.01; TopBarHideClockText = 0; @@ -341,6 +342,7 @@ bool cFlatConfig::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "MainMenuWidgetWeatherType") == 0) MainMenuWidgetWeatherType = atoi(Value); else if (strcmp(Name, "ChannelWeatherShow") == 0) ChannelWeatherShow = atoi(Value); else if (strcmp(Name, "PlaybackWeatherShow") == 0) PlaybackWeatherShow = atoi(Value); + else if (strcmp(Name, "WeatherFontSize") == 0) WeatherFontSize = atod(Value); else return false; @@ -208,6 +208,7 @@ class cFlatConfig int ChannelWeatherShow; int PlaybackWeatherShow; + double WeatherFontSize; int RecordingResolutionAspectShow; int RecordingFormatShow; diff --git a/po/de_DE.po b/po/de_DE.po index 3527448c..dec8557d 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skinflat 0.4.3\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2014-11-16 14:15+0100\n" +"POT-Creation-Date: 2014-11-17 19:12+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -546,6 +546,9 @@ msgstr "Zeige Signalqualität" msgid "Show weather widget" msgstr "Zeige Wetter Widget" +msgid "Weather widget font size" +msgstr "Wetter Widget Schriftgröße" + msgid "Colors for signal quality" msgstr "Farben für Signalqualität" @@ -310,6 +310,7 @@ void cFlatSetup::Store(void) { SetupStore("MainMenuWidgetWeatherType", Config.MainMenuWidgetWeatherType); SetupStore("ChannelWeatherShow", Config.ChannelWeatherShow); SetupStore("PlaybackWeatherShow", Config.PlaybackWeatherShow); + SetupStore("WeatherFontSize", dtoa(Config.WeatherFontSize)); Config.Init(); } @@ -485,6 +486,7 @@ bool cFlatSetupGeneral::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "MainMenuWidgetWeatherType") == 0) SetupConfig->MainMenuWidgetWeatherType = atoi(Value); else if (strcmp(Name, "ChannelWeatherShow") == 0) SetupConfig->ChannelWeatherShow = atoi(Value); else if (strcmp(Name, "PlaybackWeatherShow") == 0) SetupConfig->PlaybackWeatherShow = atoi(Value); + else if (strcmp(Name, "WeatherFontSize") == 0) SetupConfig->WeatherFontSize = atod(Value); else return false; return true; @@ -642,6 +644,7 @@ void cFlatSetupGeneral::SaveCurrentSettings(void) { Config.Store("MainMenuWidgetWeatherType", SetupConfig->MainMenuWidgetWeatherType, *Filename); Config.Store("ChannelWeatherShow", SetupConfig->ChannelWeatherShow, *Filename); Config.Store("PlaybackWeatherShow", SetupConfig->PlaybackWeatherShow, *Filename); + Config.Store("WeatherFontSize", dtoa(Config.WeatherFontSize), *Filename); cString msg = cString::sprintf("%s %s", tr("saved settings in file:"), *File); Skins.Message(mtInfo, msg); @@ -814,6 +817,7 @@ void cFlatSetupChannelInfo::Setup(void) { Add(new cMenuEditBoolItem(tr("Show Channelinfo icons"), &SetupConfig->ChannelIconsShow)); Add(new cMenuEditBoolItem(tr("Show signal quality"), &SetupConfig->SignalQualityShow)); Add(new cMenuEditBoolItem(tr("Show weather widget"), &SetupConfig->ChannelWeatherShow)); + Add(new cMenuEditPrcItem(tr("Weather widget font size"), &SetupConfig->WeatherFontSize, 0.01, 0.2, 1)); Add(new cMenuEditBoolItem(tr("Colors for signal quality"), &SetupConfig->SignalQualityUseColors)); Add(new cMenuEditBoolItem(tr("Show resolution & aspect"), &SetupConfig->ChannelResolutionAspectShow)); Add(new cMenuEditBoolItem(tr("Show format (hd/sd)"), &SetupConfig->ChannelFormatShow)); diff --git a/widgets/command_output/README b/widgets/command_output/README index f73a0326..1e949b02 100644 --- a/widgets/command_output/README +++ b/widgets/command_output/README @@ -1,5 +1,6 @@ This widget is for an own command + The command "command" will be executed every time the widget is drawn, so please keep it short and fast. The command have to provide two output files: "title" and "output". -"title" is the title of the Widget. -The "output" file is read line by line. And every line is drawn without wrap the lines if they are to long. +"title" is the title for the widget. +The "output" file is read line by line. And every line is drawn without wrap the line if it is to long. diff --git a/widgets/command_output/command b/widgets/command_output/command.example index 03b12b23..03b12b23 100755 --- a/widgets/command_output/command +++ b/widgets/command_output/command.example diff --git a/widgets/system_information/README b/widgets/system_information/README index 946b5236..03ea2b22 100644 --- a/widgets/system_information/README +++ b/widgets/system_information/README @@ -1,5 +1,8 @@ This widget provides several information about the current system state. +You must manually create a link to the corresponding script, for example: +ln -s system_information.ubuntu system + The command "system_information" will be executed every time the widget is drawn, so please keep it short and fast. The command "system_information" must provide several files with the infos. The output files must begin with 01_ - 99_ for sort/position the info in the widget. For example "01_uptime", "02_load", etc.The values will be drawn in 2 columns except "system_version" and "kernel_version" they are drawn in a row. @@ -9,4 +12,4 @@ Load: 0.32 Uptime: 10:24:42 up 88 days You can include system_updatestatus and temperatures. But do not execute the system_updatestatus script (please read README of system_updatestatus) -Please see the example!
\ No newline at end of file +Please see the example! diff --git a/widgets/system_information/system_information b/widgets/system_information/system_information deleted file mode 120000 index d61d4dfb..00000000 --- a/widgets/system_information/system_information +++ /dev/null @@ -1 +0,0 @@ -system_information.ubuntu
\ No newline at end of file diff --git a/widgets/system_information/system_information.g2v b/widgets/system_information/system_information.g2v index 56480fa3..c0905624 100755 --- a/widgets/system_information/system_information.g2v +++ b/widgets/system_information/system_information.g2v @@ -12,7 +12,7 @@ SHOW_PROCESSES=1 SHOW_MEM_USAGE=1 SHOW_SWAP_USAGE=1 SHOW_ROOT_USAGE=1 -SHOW_VIDEO_USAGE=1 +SHOW_VIDEO_USAGE=0 SHOW_VDR_CPU_USAGE=1 SHOW_VDR_MEM_USAGE=1 diff --git a/widgets/system_updatestatus/system_update_status b/widgets/system_updatestatus/system_update_status deleted file mode 100755 index 50bdc037..00000000 --- a/widgets/system_updatestatus/system_update_status +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -APTCHECK=/usr/lib/update-notifier/apt-check - -rm -f updates security_updates - -if [ ! -f ${APTCHECK} ] -then - exit -fi - -RET=$(${APTCHECK} 2>&1) - -# updates -echo $RET | cut -d";" -f1 > updates -# security updates -echo $RET | cut -d";" -f2 > security_updates diff --git a/widgets/system_updatestatus/system_update_status.ubuntu b/widgets/system_updatestatus/system_update_status.ubuntu index 23f4345a..50bdc037 100755 --- a/widgets/system_updatestatus/system_update_status.ubuntu +++ b/widgets/system_updatestatus/system_update_status.ubuntu @@ -1,62 +1,17 @@ #!/bin/bash -# this script must be call from cron -# please add a cron entry for this script -# skin flatPlus only read the file "update_status" +APTCHECK=/usr/lib/update-notifier/apt-check +rm -f updates security_updates -rm -f ./update_status - -# lent code from apticron, thank you! - -# Set $DIRCACHE -eval `/usr/bin/apt-config shell DIRCACHE Dir::Cache` - -NOTIFY_HOLDS="0" -NOTIFY_NEW="1" - -# get the list of packages which are pending an upgrade -PKGNAMES=`/usr/bin/apt-get -q -y --ignore-hold --allow-unauthenticated -s dist-upgrade | \ - /bin/grep ^Inst | /usr/bin/cut -d\ -f2 | /usr/bin/sort` - -# creating the future last_run file -TMPFILE="$(mktemp -t apticron.XXXXXXXXXX)" -for p in $PKGNAMES; do - echo $p >> $TMPFILE -done - -# workaround to handle apt-get installing packages hold by aptitude. See #137771. -APTITUDE_HOLDS=`grep "^State: 2" -B 2 /var/lib/aptitude/pkgstates 2>/dev/null |grep "^Package: .*$" |cut -d" " -f 2` -DSELECT_HOLDS=`dpkg --get-selections |grep "hold$" |cut -f1` - -if [ "$NOTIFY_HOLDS" = "0" ]; then - # packages hold by aptitude don't go to the upgrading candidates list - for p in $APTITUDE_HOLDS; do - PKGNAMES=`echo $PKGNAMES |sed "s/\(^\| \)$p\( \|$\)/ /g;s/^ //g"` - done - # packages hold by dselect don't go to the upgrading candidates list - for p in $DSELECT_HOLDS; do - PKGNAMES=`echo $PKGNAMES |sed "s/\(^\| \)$p\( \|$\)/ /g;s/^ //g"` - done +if [ ! -f ${APTCHECK} ] +then + exit fi -if [ "$NOTIFY_NEW" = "0" ]; then - # new packages don't go to the upgrading candidates list (see #531002) - for p in $PKGNAMES; do - if [ -z "`dpkg -s $p 2>/dev/null| grep '^Status: install ok installed'`" ] ; then - PKGNAMES=`echo $PKGNAMES |sed "s/\(^\| \)$p\( \|$\)/ /g;s/^ //g"` - fi - done -fi - - -PKGPATH="/${DIRCACHE}archives/" -for PKG in $PKGNAMES ; do - VER=`LC_ALL=C /usr/bin/apt-cache policy $PKG | /bin/grep Candidate: | /usr/bin/cut -f 4 -d \ ` - VERFILE=`echo "$VER" | /bin/sed -e "s/:/%3a/g"` - if ls ${PKGPATH}${PKG}_${VERFILE}_*.deb >& /dev/null ; then - DEBS="$DEBS ${PKGPATH}${PKG}_${VERFILE}_*.deb" - fi - echo $PKG $VER >> ./update_status -done +RET=$(${APTCHECK} 2>&1) +# updates +echo $RET | cut -d";" -f1 > updates +# security updates +echo $RET | cut -d";" -f2 > security_updates diff --git a/widgets/temperatures/README b/widgets/temperatures/README index fc2247a8..5f22c359 100644 --- a/widgets/temperatures/README +++ b/widgets/temperatures/README @@ -1,5 +1,8 @@ This Widget provide information about the system temperatures. +You must manually create a link to the corresponding script, for example: +ln -s temperatures.default temperatures + The command "temperatures" will be executed every time the widget is drawn, so please keep it short and fast. The command can provide three temperatures: cpu, pc case and gpu temperature The command can also be called from system information widget. So the output files must also begin with 01_ - 99_ for sort/position. diff --git a/widgets/temperatures/temperatures b/widgets/temperatures/temperatures.default index be764be0..be764be0 100755 --- a/widgets/temperatures/temperatures +++ b/widgets/temperatures/temperatures.default diff --git a/widgets/weather/GetLatLangFromCity.php b/widgets/weather/GetLatLangFromCity.php index e05c1bc8..1ca7d1e3 100644 --- a/widgets/weather/GetLatLangFromCity.php +++ b/widgets/weather/GetLatLangFromCity.php @@ -18,8 +18,8 @@ if( !isset($data['results'][0]) ) { $latitude = $data['results'][0]['geometry']['location']['lat']; $longitude = $data['results'][0]['geometry']['location']['lng']; -echo "latitude: ".$latitude."\n"; -echo "longitude: ".$longitude."\n"; +echo "Latitude = ".$latitude."\n"; +echo "Longitude = ".$longitude."\n"; echo "put these values in update_weather.config\n"; ?> diff --git a/widgets/weather/README b/widgets/weather/README index 956c7a26..af7f985e 100644 --- a/widgets/weather/README +++ b/widgets/weather/README @@ -6,4 +6,8 @@ For example call the command from cron.daily. You need php5 with command line support for this widget. For example in Ubuntu you need the package "php5-cli". -Please configur your location and others in update_weather.config. Use php-script "GetLatLangFromCity.php" to get latitude & longitude from your location. +Please move update_weather.config to update_weather.config.sample + +mv update_weather.config.sample update_weather.config + +Configure your location and others in update_weather.config. Use php-script "GetLatLangFromCity.php" to get latitude & longitude from your location. diff --git a/widgets/weather/update_weather.config b/widgets/weather/update_weather.config deleted file mode 100644 index f799c6d3..00000000 --- a/widgets/weather/update_weather.config +++ /dev/null @@ -1,17 +0,0 @@ -[main] -# use GetLatLangFromCity.php to get latitude/langitude -Latitude = 52.5200066 -Longitude = 13.404954 -# location shown in Skin -LocationSkin = "Berlin" -# Can be set to 'us', 'si', 'ca', 'uk' or 'auto' (see forecast.io API); default is auto -Units = "si" -DegreeSign = "°C" -# Can be set to 'en', 'de', 'pl', 'es', 'fr', 'it', 'tet' or 'x-pig-latin' (see forecast.io API); default is 'en' -Lang = "de" -# convert . to , for german format -ConvertPoint2Comma = 1 -# We have only 1000 api calls per day, so please only do one update per day! -# Or request an own key for free at forecast.io -ApiKey = "137f2d85a1f1db5762e5e073103541d2" - diff --git a/widgets/weather/update_weather.config.sample b/widgets/weather/update_weather.config.sample new file mode 100644 index 00000000..f913d89f --- /dev/null +++ b/widgets/weather/update_weather.config.sample @@ -0,0 +1,23 @@ +[main] + +; use GetLatLangFromCity.php to get latitude/langitude +Latitude = 52.5200066 +Longitude = 13.404954 + +; location shown in Skin +LocationSkin = "Berlin" + +; Can be set to 'us', 'si', 'ca', 'uk' or 'auto' (see forecast.io API); default is auto +Units = "si" +DegreeSign = "°C" + +; Can be set to 'en', 'de', 'pl', 'es', 'fr', 'it', 'tet' or 'x-pig-latin' (see forecast.io API); default is 'en' +Lang = "de" + +; convert . to , for german format +ConvertPoint2Comma = 1 + +; We have only 1000 api calls per day, so please only do one update per day! +; Or request an own key for free at forecast.io +ApiKey = "137f2d85a1f1db5762e5e073103541d2" + diff --git a/widgets/weather/update_weather.php b/widgets/weather/update_weather.php index a35e89f4..4b4dbb86 100644 --- a/widgets/weather/update_weather.php +++ b/widgets/weather/update_weather.php @@ -71,9 +71,9 @@ foreach($conditions_week as $conditions) { continue; } // we only have min & max so we must calc + $temp = round($conditions->getMaxTemperature(), 1); if( $convertPoint == 1 ) $temp = str_replace(".", ",", $temp); - $temp = round($conditions->getMaxTemperature(), 1); fwrite($handle, $temp); fwrite($handle, $degree_sign); fclose($handle); |