Xfce Forum

Sub domains
 

You are not logged in.

#26 2021-03-07 00:20:28

John Jason Jordan
Member
Registered: 2019-11-22
Posts: 76

Re: Weather applet died again

ToZ wrote:

VPNs confuse the system because by default it uses metric unless the connection request comes from a US ip address, in which case it uses imperial. I had a closer look and if I change line 44 like this:

OUT=$(curl -s v2d.wttr.in/$LATITUDE,$LONGITUDE?m\&?format="%c\n%h\n%t\n%f\n%w\n%l\n%m\n%M\n%p\n%P\n%D\n%S\n%z\n%s\n%d\n%C\n")

...it forces metric. I've added "?m\&" right after the LONGITUDE variable. Can you give this line a try?

I got two lines working now.

But the above line with ?m\& after LONGITUDE doesn't work at all (I copied and pasted it), so I went back to the previous version. The new line gave me no icon, and two lines, the top line said just 'report' and the second line just repeated my longitude and latitude.

And yeah, it always gives me imperial when I'm connected to any US server, and always metric when I'm connected anyplace else in the world. The only reason I chose US servers is that they are closer to me, so I get better speed. But after a bit of experimenting I discovered a server in Vancouver, BC that is practically as fast as the one in Los Angeles, and then the script always gives me C and kmph. Still, it would be nice to figure out how to make it disregard the location of the server. After all, the old utility always gave me metric regardless of where I was connecting from. And I have Meteo, which also always gives me metric.

Offline

#27 2021-03-07 01:54:43

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,486

Re: Weather applet died again

Sorry, my bad. I was testing something. Try this line instead:

OUT=$(curl -s wttr.in/$LATITUDE,$LONGITUDE?m\&format="%c\n%h\n%t\n%f\n%w\n%l\n%m\n%M\n%p\n%P\n%D\n%S\n%z\n%s\n%d\n%C\n")

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#28 2021-03-07 05:14:31

John Jason Jordan
Member
Registered: 2019-11-22
Posts: 76

Re: Weather applet died again

ToZ wrote:
OUT=$(curl -s wttr.in/$LATITUDE,$LONGITUDE?m\&format="%c\n%h\n%t\n%f\n%w\n%l\n%m\n%M\n%p\n%P\n%D\n%S\n%z\n%s\n%d\n%C\n")

That seems to work. I pasted it in, then right-clicked and went to Properties, closed the popup window, and it stayed on metric. At the time I was connected through a server in Vancouver, so I switched my VPN to a Los Angeles server and repeated the refresh. It's still displaying C and kmph.

Thanks a million for all your help. I hope the discussion helps others, too.

Offline

#29 2021-03-07 16:22:44

Mellowbob
Member
Registered: 2011-10-16
Posts: 286

Re: Weather applet died again

A caution on removing the "old" plugin, well at least on Ubuntu. Seems that the weather app is part of goodies and you'll end up losing more than just the app.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libexo-1-0 ristretto xfburn xfce4-battery-plugin xfce4-cpufreq-plugin
  xfce4-cpugraph-plugin xfce4-dict xfce4-diskperf-plugin xfce4-fsguard-plugin
  xfce4-genmon-plugin xfce4-mailwatch-plugin xfce4-netload-plugin xfce4-notes
  xfce4-notes-plugin xfce4-places-plugin xfce4-screenshooter xfce4-sensors-plugin
  xfce4-smartbookmark-plugin xfce4-systemload-plugin xfce4-taskmanager
  xfce4-timer-plugin xfce4-verve-plugin xfce4-wavelan-plugin xfce4-whiskermenu-plugin
  xfce4-xkb-plugin
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  xfce4-goodies xfce4-weather-plugin
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 4,927 kB disk space will be freed.
Do you want to continue? [Y/n]

Probably not what you want to do.

Offline

#30 2021-03-07 17:59:38

John Jason Jordan
Member
Registered: 2019-11-22
Posts: 76

Re: Weather applet died again

Mellowbob wrote:

A caution on removing the "old" plugin, well at least on Ubuntu. Seems that the weather app is part of goodies and you'll end up losing more than just the app.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libexo-1-0 ristretto xfburn xfce4-battery-plugin xfce4-cpufreq-plugin
  xfce4-cpugraph-plugin xfce4-dict xfce4-diskperf-plugin xfce4-fsguard-plugin
  xfce4-genmon-plugin xfce4-mailwatch-plugin xfce4-netload-plugin xfce4-notes
  xfce4-notes-plugin xfce4-places-plugin xfce4-screenshooter xfce4-sensors-plugin
  xfce4-smartbookmark-plugin xfce4-systemload-plugin xfce4-taskmanager
  xfce4-timer-plugin xfce4-verve-plugin xfce4-wavelan-plugin xfce4-whiskermenu-plugin
  xfce4-xkb-plugin
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  xfce4-goodies xfce4-weather-plugin
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 4,927 kB disk space will be freed.
Do you want to continue? [Y/n]

Yeah, I already noted that in an earlier post here. At the time I was going to try to upgrade to the latest weather-update-plugin, where the instructions said to start by uninstalling the version from the repository. When I saw that the uninstall was going to remove a lot of other utilities as well I aborted the uninstall command and decided to try the genmon script instead. Also, I didn't get the same extensive list for autoremove.

Offline

#31 2021-03-07 20:18:56

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,486

Re: Weather applet died again

Sorry, I didn't realize that it was packaged in xfce4-goodies. There is another way to update an existing ubuntu package. Tested on Xubuntu 20.04.02. Basically:

Step 1:

sudo apt-get build-dep xfce4-weather-plugin
sudo apt-get install build-essential fakeroot devscripts

Step 2:

mkdir src; cd src
apt-get source xfce4-weather-plugin
cd xfce4-weather-plugin-0.10.1 

Step 3: Copy/paste this content into a w.patch file:

diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 8780c0e..d4dd8de 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -656,7 +656,7 @@ update_handler(plugin_data *data)
         /* build url */
         url = g_strdup_printf("https://api.met.no"
                               "/weatherapi/locationforecast/%s/"
-                              "?lat=%s&lon=%s&msl=%d",
+                              "classic?lat=%s&lon=%s&altitude=%d",
                               api_version,
                               data->lat, data->lon, data->msl);
 
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index 2723fc4..921434f 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -31,7 +31,7 @@
 #define MAX_FORECAST_DAYS 10
 #define DEFAULT_FORECAST_DAYS 5
 #define MAX_SCROLLBOX_LINES 10
-#define FORECAST_API "1.9"
+#define FORECAST_API "2.0"
 
 G_BEGIN_DECLS

Step 4:

patch -p1 < w.patch

Step 5:

debchange -i

...if prompted choose your editor of choice and:
   - add a comment (something like "patched API 2.0") after the "*" on the 3rd line
   - edit your email address on the 5th line
...then save and exit

Step 6:

dpkg-source --commit

When prompted for a patch name, enter "Update to 2.0 API"
Optionally on the next screen, change the TODO section and save and exit the file.

Step 7:

debuild -us -uc -i -I

Ignore any errors that display.

Step 8:

cd ..

And note that there are now 2 .deb files there (one regular and one with debug symbols (dbgsym). Install the first one:

sudo dpkg -i xfce4-weather-plugin_0.10.1-1ubuntu1_amd64.deb

Step 9:
Restart the panel.

This process will create a new package and update the existing (broken) package without needing to uninstall it. And if Ubuntu ever updates the package, you will get the new version.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#32 2021-03-08 02:19:23

Mellowbob
Member
Registered: 2011-10-16
Posts: 286

Re: Weather applet died again

Oh my! Looks like an awful lot for a little applet smile

I followed along until the patching, but got this:

patch -p1 < w.patch
patching file panel-plugin/weather.c
patching file panel-plugin/weather.h
patch unexpectedly ends in middle of line

The last line in w.patch:

G_BEGIN_DECLS

looks suspicious ??

Offline

#33 2021-03-08 02:55:39

MrEen
Member
Registered: 2019-04-19
Posts: 295

Re: Weather applet died again

I think ToZ may have made a copying error based on the source here: https://gitlab.xfce.org/panel-plugins/x … /weather.h

Instead of the last line of the patch reading G_BEGIN_DECLS, I suspect it should have been this:

#define SETTING_LOCATION_NAME "/location/name"

EDIT: And I believe that needs to be indented by one space.

Last edited by MrEen (2021-03-08 02:57:26)

Offline

#34 2021-03-08 05:38:32

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,486

Re: Weather applet died again

There is actually a blank line in the actual patch that was used after G_BEGIN_DECLS, however, the forum code tags for some reason removes it.

Just add a blank line after G_BEGIN_DECLS.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.010 seconds, 7 queries executed - Memory usage: 586.09 KiB (Peak: 602.93 KiB) ]