neffo / bing-wallpaper-gnome-extension

GNOME shell extension that syncs your desktop & lock screen wallpaper to Microsoft Bing's Image of the Day.
https://extensions.gnome.org/extension/1262/bing-wallpaper-changer/
GNU General Public License v3.0
299 stars 56 forks source link

[BUG] Refresh fails with SyntaxError: JSON.parse: unexpected end of data #248

Closed holzbrenner closed 1 month ago

holzbrenner commented 1 month ago

Describe the bug The extension is unable to download images anymore (I am guessing that parsing API response from the Bing site is the problem; perhaps something is not working reliably there).

Screenshots

To Reproduce Steps to reproduce the behavior:

  1. Log into gnome shell.
  2. Click on the extension menu in the top bar.
  3. Click 'refresh now'.
  4. The image is not refreshed and an error notification is shown (see the screenshot above).

Desktop:

Additional context This started happening around 1-2 days ago (perhaps with the extension upgrade to version 50?), yesterday I resolved the problem by reloading the extension in the "gnome extensions" dialog (switching it off and then on again), but this does not seem to be working today. The destination directory has all necessary permissions (is user writable).

journal log:

gnome-shell[1423]: BingWallpaper extension: next check in 86400 seconds
gnome-shell[1423]: BingWallpaper extension: Recieved 0 bytes
gnome-shell[1423]: BingWallpaper extension: _parseData() failed with error SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data @ 802
gnome-shell[1423]: error: BingWallpaper extension error: Bing metadata parsing error check SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data @ 802
gnome-shell[1423]: BingWallpaper extension: _parseData@file:///home/_user_/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/extension.js:802:31
                  _processMessageRefresh@file:///home/_user_/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/extension.js:738:18
                  _refresh/<@file:///home/_user_/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/extension.js:704:26
                  @resource:///org/gnome/shell/ui/init.js:21:20
gnome-shell[1423]: BingWallpaper extension: /th?id=OHR.AspensColorado_ROW9309949443
gnome-shell[1423]: BingWallpaper extension: key selected-image set to AspensColorado_ROW9309949443 (returned true)
gnome-shell[1423]: BingWallpaper extension: scale factor: 1
gnome-shell[1423]: BingWallpaper extension: image set to : /home/_user_/Pictures/BingWallpaper/20241009-AspensColorado_ROW9309949443_UHD.jpg
gnome-shell[1423]: BingWallpaper extension: Storing state as JSON: {"maxlongdate":202410090700,"title":"Aspens near Marble, Colorado, USA","explanation":"Bing Wallpaper of the Day for 2024-10-09","copyright":"© Jason Hatfield/TANDEM Stills + Motion","longstartdate":"202410090700","imageinfolink":"https://www.bing.com/search?q=Aspen+tree&form=hpcapt","imageURL":"https://www.bing.com/th?id=OHR.AspensColorado_ROW9309949443_UHD.jpg&qlt=100","filename":"/home/_user_/Pictures/BingWallpaper/20241009-AspensColorado_ROW9309949443_UHD.jpg","favourite":false,"width":3840,"height":2160,"shuffledue":0}
gnome-shell[1423]: BingWallpaper extension: key state set to {"maxlongdate":202410090700,"title":"Aspens near Marble, Colorado, USA","explanation":"Bing Wallpaper of the Day for 2024-10-09","copyright":"© Jason Hatfield/TANDEM Stills + Motion","longstartdate":"202410090700","imageinfolink":"https://www.bing.com/search?q=Aspen+tree&form=hpcapt","imageURL":"https://www.bing.com/th?id=OHR.AspensColorado_ROW9309949443_UHD.jpg&qlt=100","filename":"/home/_user_/Pictures/BingWallpaper/20241009-AspensColorado_ROW9309949443_UHD.jpg","favourite":false,"width":3840,"height":2160,"shuffledue":0} (returned true)
holzbrenner commented 1 month ago

I think there is some intermittent problem with Bing servers. I just clicked on "Refresh Now" and the image was replaced. Restarting the extension to resolve the problem was probably just a coincidence. I'll leave this open for now, perhaps there can be some improvement (retry mechanism?) based on this report, but otherwise this can be closed.

neffo commented 1 month ago

Yeah the error notifications are new, these wouldn't have been apparent previously. Agree this shouldn't hassle users so much with non-fatal errors. (It should retry in 5 minutes.)

holzbrenner commented 1 month ago

This hasn't happened anymore since I reported it last week, so I'll close this (can't reproduce; as I already wrote it looks like an intermittent server-side problem).