[gnome-music] mpris: verify that current track is still valid when fetching info
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] mpris: verify that current track is still valid when fetching info
- Date: Tue, 10 Feb 2015 12:11:09 +0000 (UTC)
commit ddf01751201d47884a84e55f1634048565ed9b70
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Tue Feb 10 13:11:03 2015 +0100
mpris: verify that current track is still valid when fetching info
gnomemusic/mpris.py | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 0064a61..2899dd0 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -346,15 +346,16 @@ class MediaPlayer2Service(dbus.service.Object):
@log
def _on_playlist_modified(self, path=None, _iter=None, data=None):
- path = self.player.currentTrack.get_path()
- currentTrack = self.player.playlist[path][self.player.playlistField]
- track_list = self._get_track_list()
- self.TrackListReplaced(track_list, self._get_media_id(currentTrack))
- self.PropertiesChanged(self.MEDIA_PLAYER2_TRACKLIST_IFACE,
- {
- 'Tracks': track_list,
- },
- [])
+ if self.player.currentTrack and self.player.currentTrack.valid():
+ path = self.player.currentTrack.get_path()
+ currentTrack = self.player.playlist[path][self.player.playlistField]
+ track_list = self._get_track_list()
+ self.TrackListReplaced(track_list, self._get_media_id(currentTrack))
+ self.PropertiesChanged(self.MEDIA_PLAYER2_TRACKLIST_IFACE,
+ {
+ 'Tracks': track_list,
+ },
+ [])
@log
def _reload_playlists(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]