[gnome-music] mrpis: don't crash if some field cannot be found
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] mrpis: don't crash if some field cannot be found
- Date: Fri, 28 Mar 2014 11:45:21 +0000 (UTC)
commit 2142ff6967b7155732b88d10ffd7a072e890b6e6
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Fri Mar 28 12:37:54 2014 +0100
mrpis: don't crash if some field cannot be found
gnomemusic/mpris.py | 51 +++++++++++++++++++++++++++------------------------
1 files changed, 27 insertions(+), 24 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 1ded4c3..916e071 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -82,30 +82,33 @@ class MediaPlayer2Service(dbus.service.Object):
'xesam:userRating': media.get_rating(),
}
- title = AlbumArtCache.get_media_title(media)
- if title:
- metadata['xesam:title'] = title
-
- album = media.get_album()
- if album:
- metadata['xesam:album'] = album
-
- artist = media.get_artist()
- if artist:
- metadata['xesam:artist'] = [artist]
- metadata['xesam:albumArtist'] = [artist]
-
- genre = media.get_genre()
- if genre:
- metadata['xesam:genre'] = [genre]
-
- last_played = media.get_last_played()
- if last_played:
- metadata['xesam:lastUsed'] = last_played
-
- thumbnail = media.get_thumbnail()
- if thumbnail:
- metadata['mpris:artUrl'] = thumbnail
+ try:
+ title = AlbumArtCache.get_media_title(media)
+ if title:
+ metadata['xesam:title'] = title
+
+ album = media.get_album()
+ if album:
+ metadata['xesam:album'] = album
+
+ artist = media.get_artist()
+ if artist:
+ metadata['xesam:artist'] = [artist]
+ metadata['xesam:albumArtist'] = [artist]
+
+ genre = media.get_genre()
+ if genre:
+ metadata['xesam:genre'] = [genre]
+
+ last_played = media.get_last_played()
+ if last_played:
+ metadata['xesam:lastUsed'] = last_played
+
+ thumbnail = media.get_thumbnail()
+ if thumbnail:
+ metadata['mpris:artUrl'] = thumbnail
+ except Exception as e:
+ print("mpris._get_metadata error: %s" + e.message)
return metadata
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]