Skip to content

Commit 108b777

Browse files
committed
python-updater: Download thumbs only during a 'full' update, make
sure the cache folders exist every time we try to access them, not just during construction (they may have been deleted).
1 parent b92a488 commit 108b777

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

python3/cinnamon/harvester.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ def __init__(self, spice_type):
155155

156156
self.index_file = os.path.join(self.cache_folder, "index.json")
157157

158-
os.makedirs(self.cache_folder, mode=0o755, exist_ok=True)
159-
160158
if self.themes:
161159
self.install_folder = os.path.join(home, ".themes")
162160
self.spices_directories = (self.install_folder, )
@@ -174,10 +172,14 @@ def __init__(self, spice_type):
174172
except Exception as e:
175173
print(e)
176174

177-
def refresh(self):
175+
def refresh(self, full):
178176
debug("Cache stamp: %d" % get_current_timestamp())
177+
178+
os.makedirs(self.cache_folder, mode=0o755, exist_ok=True)
179179
self._update_local_json()
180-
self._update_local_thumbs()
180+
181+
if full:
182+
self._update_local_thumbs()
181183

182184
self._load_metadata()
183185
self._clean_old_thumbs()

python3/cinnamon/updates.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ def get_updates(self):
2727
updates += self.get_updates_of_type(spice_type)
2828
return updates
2929

30-
def refresh_all_caches(self):
30+
def refresh_all_caches(self, full=False):
3131
for spice_type in SPICE_TYPES:
32-
self.refresh_cache_for_type(spice_type)
32+
self.refresh_cache_for_type(spice_type, full)
3333

34-
def refresh_cache_for_type(self, spice_type):
34+
def refresh_cache_for_type(self, spice_type, full=False):
3535
harvester = self.harvesters[spice_type]
36-
return harvester.refresh()
36+
return harvester.refresh(full)
3737

3838
def get_updates_of_type(self, spice_type):
3939
harvester = self.harvesters[spice_type]

0 commit comments

Comments
 (0)