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] The date in the extension UI is 1 day delayed in UK region #172

Closed christianrauch closed 2 years ago

christianrauch commented 2 years ago

Describe the bug

It appears as if the image is not updated periodically. The given date in the extension UI is 1 day delayed.

Screenshots Bildschirmfoto vom 2022-05-28 17-03-53 The image was updated on the 27th, but today is the 28th.

To Reproduce Steps to reproduce the behavior:

  1. select UK region
  2. refresh image

Desktop (please complete the following information):

Additional context It would be useful to be able to set the condition for updating the image, e.g. when waking up from suspend etc, or periodically, e.g. every 4 hours. And it would be good to see when the image was last (time and date) updated.

neffo commented 2 years ago

Right, this is probably due to how we derive the date. We just convert startdate into a ISO-8601 format date:

{
  "startdate":"20220527",
  "fullstartdate":"202205272300",
  "enddate":"20220528","url":"/th?id=OHR.PurnululuNP_EN-GB6729482920_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp",
  "urlbase":"/th?id=OHR.PurnululuNP_EN-GB6729482920",
  "copyright":"Bungle Bungle Range in Purnululu National Park, Australia (© Francesco Riccardo Iacomino/Getty Images)",
...}

As in 2022-05-27 in this case, it would have updated at 11pm on that date in your region (about 18 hours before). (In my region it updates at 5pm.) It might be more appropriate to use the following day or the day that best covers the 24-hour period from 'fullstartdate'.

(NOTE: historically Bing used to always update at midnight in the region, so the current treatment of dates worked well.)

neffo commented 2 years ago

So one approach would be to delay the presentation of the 'current' image until it a user defined time of day (say 8am), and then label each image according to the day it is first presented to the user (the date at 8am), rather than the date Bing publishes it. (Which in the UK case is 11pm the day before.) This would require a bit of calendar math, and a way to present this in preferences.

That said I think it's pretty achievable.

christianrauch commented 2 years ago

I think the extension should use the fullstartdate or whatever https://www.bing.com is using. Is the fullstartdate in the local time zone or UTC? In either case, converting this to the local time to match with the system time should be fairly easy.

neffo commented 2 years ago

It's UTC, yeah and as you note trivial to convert.

It's still somewhat awkward for some zones though, so having an user defined offset might be a good idea.

neffo commented 2 years ago

Last updated in menu: image

christianrauch commented 2 years ago

It's UTC, yeah and as you note trivial to convert.

It's still somewhat awkward for some zones though, so having an user defined offset might be a good idea.

Isn't there API in GNOME Shell to do these conversions?

neffo commented 2 years ago

Yep not reinventing the wheel, I mean when a new image is presented to a user rather than what date is presented.