Trying to make the album caching better

This commit is contained in:
Sumner Evans
2019-10-19 00:43:59 -06:00
parent fbdc8113b7
commit 2deb90f9fa
3 changed files with 15 additions and 10 deletions

View File

@@ -479,7 +479,8 @@ class CacheManager(metaclass=Singleton):
if self.browse_by_tags else self.server.get_album_list) if self.browse_by_tags else self.server.get_album_list)
# TODO make this invalidate instead of delete # TODO make this invalidate instead of delete
if force and self.cache.get(cache_name, {}).get(type_): # TODO invalidate if random as well.
if False and self.cache.get(cache_name, {}).get(type_):
with self.cache_lock: with self.cache_lock:
self.cache[cache_name][type_] = [] self.cache[cache_name][type_] = []
self.save_cache_info() self.save_cache_info()
@@ -494,8 +495,12 @@ class CacheManager(metaclass=Singleton):
yield 'network barrier' yield 'network barrier'
before_download() before_download()
page = ( page = (
server_fn(type_, size=page_size, offset=offset).album server_fn(
or []) type_,
size=page_size,
offset=offset,
**params,
).album or [])
with self.cache_lock: with self.cache_lock:
if not self.cache[cache_name].get(type_): if not self.cache[cache_name].get(type_):

View File

@@ -179,7 +179,7 @@ class AlbumsPanel(Gtk.Box):
self.emit( self.emit(
'refresh-window', 'refresh-window',
{'current_album_sort': new_active_sort}, {'current_album_sort': new_active_sort},
False, True,
) )
def on_alphabetical_type_change(self, combo): def on_alphabetical_type_change(self, combo):
@@ -188,7 +188,7 @@ class AlbumsPanel(Gtk.Box):
self.emit( self.emit(
'refresh-window', 'refresh-window',
{'current_album_alphabetical_sort': new_active_alphabetical_sort}, {'current_album_alphabetical_sort': new_active_alphabetical_sort},
False, True,
) )
def on_genre_change(self, combo): def on_genre_change(self, combo):
@@ -199,7 +199,7 @@ class AlbumsPanel(Gtk.Box):
self.emit( self.emit(
'refresh-window', 'refresh-window',
{'current_album_genre': new_active_genre}, {'current_album_genre': new_active_genre},
False, True,
) )
def on_year_changed(self, entry): def on_year_changed(self, entry):
@@ -212,17 +212,17 @@ class AlbumsPanel(Gtk.Box):
if self.to_year_entry == entry: if self.to_year_entry == entry:
self.grid.update_params(to_year=year) self.grid.update_params(to_year=year)
self.emit('refresh-window', {'current_album_to_year': year}, False) self.emit('refresh-window', {'current_album_to_year': year}, True)
else: else:
self.grid.update_params(from_year=year) self.grid.update_params(from_year=year)
self.emit( self.emit(
'refresh-window', {'current_album_from_year': year}, False) 'refresh-window', {'current_album_from_year': year}, True)
def on_grid_cover_clicked(self, grid, id): def on_grid_cover_clicked(self, grid, id):
self.emit( self.emit(
'refresh-window', 'refresh-window',
{'selected_album_id': id}, {'selected_album_id': id},
False, True,
) )

View File

@@ -158,7 +158,7 @@ class CoverArtGrid(Gtk.ScrolledWindow):
GLib.idle_add( GLib.idle_add(
reflow_grid, reflow_grid,
old_len != len(self.list_store), old_len != len(self.list_store) or force,
selected_index, selected_index,
) )