[gnome-music/wip/mschraal/grltrackerwrapper-small-optimization: 1/2] grltrackerwrapper: Minor artist albums filter optimization
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/grltrackerwrapper-small-optimization: 1/2] grltrackerwrapper: Minor artist albums filter optimization
- Date: Sun, 1 May 2022 14:08:00 +0000 (UTC)
commit 19948a4a7757a194d78997c60c2c86d35f0733ee
Author: Marinus Schraal <mschraal gnome org>
Date: Sun May 1 15:35:12 2022 +0200
grltrackerwrapper: Minor artist albums filter optimization
More pythonic and faster.
gnomemusic/grilowrappers/grltrackerwrapper.py | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 680ba409f..28c3eb76b 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -710,7 +710,7 @@ class GrlTrackerWrapper(GObject.GObject):
'location_filter': self._tracker_wrapper.location_filter()
}
- albums: List[Grl.Media] = []
+ albums: List[str] = []
def query_cb(
source: Grl.Source, op_id: int, media: Optional[Grl.Media],
@@ -727,15 +727,10 @@ class GrlTrackerWrapper(GObject.GObject):
self._notificationmanager.pop_loading()
return
- albums.append(media)
+ albums.append(media.get_id())
- def albums_filter(
- corealbum: CoreAlbum, albums: List[Grl.Media]) -> bool:
- for media in albums:
- if media.get_id() == corealbum.props.media.get_id():
- return True
-
- return False
+ def albums_filter(corealbum: CoreAlbum, albums: List[str]) -> bool:
+ return corealbum.props.media.get_id() in albums
self.props.source.query(
query, [Grl.METADATA_KEY_TITLE], self._fast_options, query_cb)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]