summaryrefslogtreecommitdiff
blob: 8cc7f7fb91a0e27fef2e0129d4a7bd88e9c745aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From d5f9e6af9f9cda210b15d5c10b370006c86bd7ad Mon Sep 17 00:00:00 2001
From: Guo Yunhe <i@guoyunhe.me>
Date: Thu, 23 Apr 2020 22:36:34 +0300
Subject: [PATCH] Fix POTD in lock screen

Summary:
2. Flickr and APOD(NASA) providers cannot cache pictures in `PNG` but
`JPEG` works. So I simply changed the cache format to `JPEG`. Most POTD
are photos. JPEG saves more spaces.

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D29140

Merge Request: https://invent.kde.org/plasma/kdeplasma-addons/-/merge_requests/3

BUG: 389962

FIXED-IN: 5.20

* asturm 2020-09-04: Backported to 5.19.5, including merged commits e7c51a04 and
* e6472153, shortened summary to relevant bits, dropped unrelated hunks.
---
 dataengines/potd/PoTD-list.txt      |  1 +
 dataengines/potd/cachedprovider.cpp | 14 +++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/dataengines/potd/PoTD-list.txt b/dataengines/potd/PoTD-list.txt
index 53b0fe02a..c74316614 100644
--- a/dataengines/potd/PoTD-list.txt
+++ b/dataengines/potd/PoTD-list.txt
@@ -5,6 +5,7 @@ LIST OF POSSIBLE PROVIDERS
 http://antwrp.gsfc.nasa.gov/apod/astropix.html
 Each day can be reached via the URL http://antwrp.gsfc.nasa.gov/apod/apYYMMDD.html
 where YY is the 2 digits year, MM is the 2 digits month and DD is the 2 digits day.
+Note: sometimes, the webpage shows a YouTube video and picture cannot be fetched.
 
 * Flickr Interestingness  ----------------------------  DONE
 http://www.flickr.com/explore/interesting/
diff --git a/dataengines/potd/cachedprovider.cpp b/dataengines/potd/cachedprovider.cpp
index 476a7c253..d6fb63fe9 100644
--- a/dataengines/potd/cachedprovider.cpp
+++ b/dataengines/potd/cachedprovider.cpp
@@ -51,13 +51,13 @@ SaveImageThread::SaveImageThread(const QString &identifier, const QImage &image)
 void SaveImageThread::run()
 {
     const QString path = CachedProvider::identifierToPath( m_identifier );
-    m_image.save(path, "PNG");
+    m_image.save(path, "JPEG");
     emit done( m_identifier, path, m_image );
 }
 
 QString CachedProvider::identifierToPath( const QString &identifier )
 {
-    const QString dataDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1String("/plasma_engine_potd/");
+    const QString dataDir = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1String("/plasma_engine_potd/");
     QDir d;
     d.mkpath(dataDir);
     return dataDir + identifier;
-- 
GitLab