Bug 453391

Summary: Simon Stålenhag’s Wallpapers change more than once a day
Product: [Plasma] Plasma Workspace Wallpapers Reporter: Nicola Smaniotto <smaniotto.nicola>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: nate, qydwhotmail, wengxt
Priority: NOR    
Version: 5.24.4   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 5.24.6

Description Nicola Smaniotto 2022-05-04 15:01:26 UTC
SUMMARY
The POTD Simon Stålenhag’s Wallpapers changes many times a day, whenever the screen is locked

STEPS TO REPRODUCE
1. Select Simon Stålenhag’s Wallpapers as picture of the day provider for the lockscreen
2. Lock the screen
3. Unlock the screen
4. Lock the screen again

OBSERVED RESULT
The wallpaper changes each time the screen is locked

EXPECTED RESULT
The wallpaper should stay the same for consecutive locks, since this is a "picture of the day"

SOFTWARE/OS VERSIONS 
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Comment 1 Nate Graham 2022-05-04 16:04:58 UTC
Just that provider, or any one?
Comment 2 Nicola Smaniotto 2022-05-04 18:52:38 UTC
(In reply to Nate Graham from comment #1)
> Just that provider, or any one?

I checked them all, Flickr has the same issue. I used Wikimedia Commons until the other day, so I never noticed.
Comment 3 Nicola Smaniotto 2022-05-04 20:20:23 UTC
If I understand the code correctly, the issue comes from [0]. The image is randomly chosen each time, there isn't a daily image provided by upstream.
If I may suggest a fix, we could switch to a deterministic function, like going through one image per day in order or using a hash of the date. This would make the code fetch always the same image in any specific day.

[0] https://invent.kde.org/plasma/kdeplasma-addons/-/blob/v5.24.4/dataengines/potd/simonstalenhagprovider.cpp#L58
Comment 4 Fushan Wen 2022-05-05 00:44:08 UTC
Not fully fixed: https://invent.kde.org/plasma/kdeplasma-addons/-/merge_requests/139
Comment 6 Fushan Wen 2022-05-05 10:21:18 UTC
Git commit d3bb3dc1d96ef7d734503e6d78dc3ce35106a628 by Fushan Wen.
Committed on 05/05/2022 at 02:16.
Pushed by fusionfuture into branch 'Plasma/5.24'.

wallpapers/potd: Give random chooser a seed in simonstalenhagprovider

Make the seed depend on the current date.

M  +7    -3    dataengines/potd/simonstalenhagprovider.cpp

https://invent.kde.org/plasma/kdeplasma-addons/commit/d3bb3dc1d96ef7d734503e6d78dc3ce35106a628
Comment 7 Fushan Wen 2022-05-05 10:21:26 UTC
Git commit 326ae3a24ccb1f1b526f4742a84e4ce24046effd by Fushan Wen.
Committed on 05/05/2022 at 02:19.
Pushed by fusionfuture into branch 'Plasma/5.24'.

wallpapers/potd: Give random chooser a seed in flickrprovider

Make the seed depend on the current date.
FIXED-IN: 5.24.6

M  +7    -2    dataengines/potd/flickrprovider.cpp

https://invent.kde.org/plasma/kdeplasma-addons/commit/326ae3a24ccb1f1b526f4742a84e4ce24046effd
Comment 8 Fushan Wen 2022-05-05 10:23:51 UTC
Git commit 7fd63273f41469219ac756d87ac53bd9b8f1cb8e by Fushan Wen.
Committed on 05/05/2022 at 10:22.
Pushed by fusionfuture into branch 'master'.

wallpapers/potd: Give random chooser a seed in simonstalenhagprovider

Make the seed depend on the current date.

M  +7    -3    wallpapers/potd/plugins/simonstalenhagprovider.cpp

https://invent.kde.org/plasma/kdeplasma-addons/commit/7fd63273f41469219ac756d87ac53bd9b8f1cb8e
Comment 9 Fushan Wen 2022-05-05 10:23:59 UTC
Git commit 7d152446ce2c34922593202453726984cd66f797 by Fushan Wen.
Committed on 05/05/2022 at 10:22.
Pushed by fusionfuture into branch 'master'.

wallpapers/potd: Give random chooser a seed in flickrprovider

Make the seed depend on the current date.

M  +7    -3    wallpapers/potd/plugins/flickrprovider.cpp

https://invent.kde.org/plasma/kdeplasma-addons/commit/7d152446ce2c34922593202453726984cd66f797
Comment 10 Fushan Wen 2022-05-09 23:28:15 UTC
Git commit 52e13a84384723a875ba60220c3201921dce7a0d by Fushan Wen.
Committed on 09/05/2022 at 23:25.
Pushed by fusionfuture into branch 'master'.

wallpapers/potd: Check last update date after resume from sleep

It's unnecessary to force update the wallpaper if the day is not
changed, instead, we can calculate the time remaining until tomorrow,
and update the update timer's interval.

M  +18   -2    wallpapers/potd/plugins/potdprovidermodel.cpp
M  +1    -0    wallpapers/potd/plugins/potdprovidermodel.h

https://invent.kde.org/plasma/kdeplasma-addons/commit/52e13a84384723a875ba60220c3201921dce7a0d