Bug 382320

Summary: Wikimedia Picture of the Day does not work
Product: [Plasma] kdeplasma-addons Reporter: Anton Smirnov <sandfox+kde>
Component: Picture of the DayAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: bugseforuns, filtrationunit6, i, nate, qydwhotmail, simonandric5, vitor895
Priority: NOR    
Version: 5.10.1   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 5.13.0

Description Anton Smirnov 2017-07-14 01:25:12 UTC
Problem: Picture of the Day not shown if Wikimedia is selected (black screen)

Reproducuble: always

Reason:
https://github.com/KDE/kdeplasma-addons/blob/Plasma/5.10/dataengines/potd/wcpotdprovider.cpp#L54
Image retrieval for this options relies on a service that is down at the moment

How to fix:
The service can retrieve data directly from wikimedia with two requests

1) Request the picture at the day page [1]
https://commons.wikimedia.org/w/api.php?action=query&prop=images&format=json&formatversion=2&titles=Template:Potd

1a) Get picture name at received json as name = query.pages[0].images[0].title

2) Query picture url by [2][3]
https://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&format=json&formatversion=2&titles=***urlencode(name)***&iiprop=url

2a) Get target url as url = query.pages[0].imageinfo[0].url

Sorry for the pseudocode, C++ is not my speciality

[1] https://www.mediawiki.org/wiki/API:Showing_interesting_content
[2] https://stackoverflow.com/questions/30781455/how-to-get-image-url-in-wiki-api
[3] https://en.wikipedia.org/w/api.php?action=help&modules=query%2Bimageinfo
Comment 1 Vitor Pereira 2017-07-30 02:23:43 UTC
Hi, I'm running Arch Linux with KDE Plasma 5.10.4, KDE Frameworks 5.36.0 and QT 5.9.1 and I can reproduce this issue on my system. I get a black screen when select as wallpaper --> Wikimedia Picture of the Day
Comment 2 filtrationunit6 2017-12-03 14:12:35 UTC
I'm running Arch Linux with KDE Plasma 5.11.4, and I can also reproduce this issue on my system. Like the others, i get a black screen when I try to select it as my wallpaper.
Comment 3 filtrationunit6 2017-12-08 23:29:55 UTC
A very similar approach to what Anton suggested is used in the bing provider:

https://github.com/KDE/kdeplasma-addons/blob/Plasma/5.10/dataengines/potd/bingprovider.cpp

1) A request is made to find the name of the picture of the day:

https://github.com/KDE/kdeplasma-addons/blob/Plasma/5.10/dataengines/potd/bingprovider.cpp#L96

2) Once it's found it's used to get the picture:

https://github.com/KDE/kdeplasma-addons/blob/Plasma/5.10/dataengines/potd/bingprovider.cpp#L71

In the place of the %1.

Should be similar for this dataprovider.
Comment 4 Patrick Silva 2018-01-20 16:47:53 UTC
same bugv in plasma 5.12 beta, Arch Linux.