Bug 470044 - Bing enging retrieve title from copyright (includes solution)
Summary: Bing enging retrieve title from copyright (includes solution)
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Picture of the Day wallpaper (other bugs)
Version First Reported In: 5.27.2
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-20 13:28 UTC by George Travelbacon
Modified: 2025-05-27 04:48 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.