greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.86k stars 472 forks source link

weather(metno) "Legend replied in unknown format" #1939

Closed ngcbg closed 1 year ago

ngcbg commented 1 year ago

Today, after getting back from a vacation, my amd_gpu block is trowing an error in red "Legend replied in unknown format". My config (amd part):

block = "amd_gpu"
device = "card1"
format = " $icon $utilization $vram_used_percents ($vram_used/$vram_total)"
interval = 10
[block.theme_overrides]
idle_bg = "#778BB7af"
idle_fg = "#ffffffda"

My system: Linux ngc-ryzen7 6.4.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 24 Aug 2023 00:38:14 +0000 x86_64 GNU/Linux

~ inxi -G

Graphics:
  Device-1: AMD Navi 31 [Radeon RX 7900 XT/7900 XTX] driver: amdgpu v: kernel
  Display: x11 server: X.Org v: 21.1.8 driver: X: loaded: amdgpu
    unloaded: modesetting dri: radeonsi gpu: amdgpu resolution:
    1: 2560x1440~144Hz 2: 1080x1920~60Hz
  API: OpenGL v: 4.6 Mesa 23.1.6-arch1.4 renderer: AMD Radeon RX 7900 XT
    (gfx1100 LLVM 16.0.6 DRM 3.52 6.4.12-arch1-1)

I do not know what could be changed to be honest, since it was trowing the error, before updating via pacman. Anyways, an update didn't help - there were no updates concerning the video subsystem or i3status-rs.

MaxVerevkin commented 1 year ago

Hm, this is a weird error message and I have no idea what it means. Does the rest of the bar keep running? Does the error message change if you click on the block? Do you use the latest i3status-rs version?

ngcbg commented 1 year ago

The rest of the bar with all of my blocks runs flawlessly. Following your suggestion, when did a click on the message, it expands to: `"Legend replied in unknown format. (Cause: error decoding response body: invalid type: integer "404", expected a map at line 1 column 3) " Another interesting observation - when restarting the bar (along with the i3 I am using as a WM), it starts correctly - shows everything as it is suppose to do. But In 10 sec. (my config interval timeout) , the issue appears again.

My version is the latest, provided by the distro - 3status-rs 0.32.0

That's is very confusing to be honest...

MaxVerevkin commented 1 year ago

Are you sure this error is from the amd_gpu block? Looks like it's from weather: https://github.com/greshake/i3status-rust/blob/c0b43af66e883b2d7e83e39c0ef4656aa6c53564/src/blocks/weather/met_no.rs#L104

MaxVerevkin commented 1 year ago

Yeah, weather's "metno" backend is broken.

MaxVerevkin commented 1 year ago

cc @sigvei

MaxVerevkin commented 1 year ago

Apparently they've shut down their "weathericon" API. Fortunately the relevant response of this API is archived at https://web.archive.org/web/20230328155110/https://api.met.no/weatherapi/weathericon/2.0/legends and I suppose we can just use it.

ngcbg commented 1 year ago

Oh...it's is not the amd_gpu. Thank you for the help and sorry for the confusion!

MaxVerevkin commented 1 year ago

The weather block is still broken though, so I'll reopen this.

sigvei commented 1 year ago

Yeah, sorry, I missed this change. From their change log:

"Removal of the WeatherIcon service

Whereas in older versions we had a functional API, the current version of WeatherIcon is only indended as a one-time download of an archive of icon files. Still, many users are hotlinking the icons and downloading the static file "legend" for every request, causing a lot of unnecessary traffic. As a consequence we will be removing the weather icons from the API, moving it instead to the documentation and only allowing the icons to be downloaded offline. This is planned to terminate on 31 August."

I guess another way would be to just bundle the static legends api data in the module? I made it do an API call originally because I did not know if this changed at any time, but that point is moot if we target archive.org instead.

MaxVerevkin commented 1 year ago

if we target archive.org instead

I don't think this is a good idea. The request to archive.org is slow. Also I wasn't aware that the data provided by that API is meant to be static, so just include_str!()ing might be the best solution.