Bug 470044

Summary: Bing enging retrieve title from copyright (includes solution)
Product: [Plasma] plasmashell Reporter: George Travelbacon <stuntel-tabletten0p>
Component: Picture of the Day wallpaperAssignee: Plasma Bugs List <plasma-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: i, nate, qydwhotmail
Priority: NOR    
Version First Reported In: 5.27.2   
Target Milestone: 1.0   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description George Travelbacon 2023-05-20 13:28:45 UTC
SUMMARY
***
At the moment the bingprovider retrieves the title from the node title from the JSON from https://www.bing.com/HPImageArchive.aspx?forma This node title has always the text "Info".
The code for the bingprovide already retrieves the title from the copyright, but checks if the Title node is empty. I think by removing lines 75 to 78 will fix this issue.

This way we will respect the full credentials from the author of the photo.
***

In bingprovider.cpp

from line 65. 
´        // Parse the title and the copyright text from the json data
        // Example copyright text: "草丛中的母狮和它的幼崽,南非 (© Andrew Coleman/Getty Images)"
        const QString copyright = imageObject.value(QStringLiteral("copyright")).toString();
        const QRegularExpression copyrightRegEx(QStringLiteral("(.+?)[\\((](.+?)[\\))]"));
        if (const QRegularExpressionMatch match = copyrightRegEx.match(copyright); match.hasMatch()) {
            // In some regions "title" is empty, so extract the title from the copyright text.
            m_title = match.captured(1).trimmed();
            m_author = match.captured(2).remove(QStringLiteral("©")).trimmed();
        }

        const QString title = imageObject.value(QStringLiteral("title")).toString();
        if (!title.isEmpty()) {
            m_title = title;
        }
Comment 1 Nate Graham 2023-05-22 19:55:48 UTC
Please feel free to submit a merge request for this change! The code lives at https://invent.kde.org/plasma/kdeplasma-addons/.
Comment 2 George Travelbacon 2023-06-07 21:13:36 UTC
I understand that this is the way. It is that at the moment I don´t have a clone of this repo anymore and I don´t have time to do this. If it is only possible with a CR, I respect that and we need to close this small request.