[gnome-music/wip/mschraal/assorted-cleanups: 29/34] coregrilo: Simplify playlist calls
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/assorted-cleanups: 29/34] coregrilo: Simplify playlist calls
- Date: Sat, 28 Mar 2020 22:15:29 +0000 (UTC)
commit 2c178e81013ea3571608d52c336d326fddacfa89
Author: Marinus Schraal <mschraal gnome org>
Date: Thu Mar 26 15:15:08 2020 +0100
coregrilo: Simplify playlist calls
No need to iterate over the wrappers, only Tracker supports playlists.
gnomemusic/coregrilo.py | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/gnomemusic/coregrilo.py b/gnomemusic/coregrilo.py
index 2e15ef15..47c72383 100644
--- a/gnomemusic/coregrilo.py
+++ b/gnomemusic/coregrilo.py
@@ -209,10 +209,9 @@ class CoreGrilo(GObject.GObject):
:param Playlist playlist: playlist
"""
- for wrapper in self._wrappers.values():
- if wrapper.source.props.source_id == "grl-tracker-source":
- wrapper.stage_playlist_deletion(playlist)
- break
+ if "grl-tracker-source" in self._wrappers:
+ self._wrappers["grl-tracker-source"].stage_playlist_deletion(
+ playlist)
def finish_playlist_deletion(self, playlist, deleted):
"""Finishes playlist deletion.
@@ -220,10 +219,9 @@ class CoreGrilo(GObject.GObject):
:param Playlist playlist: playlist
:param bool deleted: indicates if the playlist has been deleted
"""
- for wrapper in self._wrappers.values():
- if wrapper.source.props.source_id == "grl-tracker-source":
- wrapper.finish_playlist_deletion(playlist, deleted)
- break
+ if "grl-tracker-source" in self._wrappers:
+ self._wrappers["grl-tracker-source"].finish_playlist_deletion(
+ playlist, deleted)
def create_playlist(self, playlist_title, callback):
"""Creates a new user playlist.
@@ -231,7 +229,6 @@ class CoreGrilo(GObject.GObject):
:param str playlist_title: playlist title
:param callback: function to perform once, the playlist is created
"""
- for wrapper in self._wrappers.values():
- if wrapper.source.props.source_id == "grl-tracker-source":
- wrapper.create_playlist(playlist_title, callback)
- break
+ if "grl-tracker-source" in self._wrappers:
+ self._wrappers["grl-tracker-source"].create_playlist(
+ playlist_title, callback)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]