https://bugs.kde.org/show_bug.cgi?id=470044

            Bug ID: 470044
           Summary: Bing enging retrieve title from copyright (includes
                    solution)
    Classification: Plasma
           Product: kdeplasma-addons
           Version: master
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: wishlist
          Priority: NOR
         Component: Picture of the Day
          Assignee: plasma-b...@kde.org
          Reporter: stuntel-tablette...@icloud.com
                CC: i...@guoyunhe.me, qydwhotm...@gmail.com
  Target Milestone: ---

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;
        }

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to