[gnome-music/gnome-3-10] searchbar: don't crash if track doesn't have artist/album set
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/gnome-3-10] searchbar: don't crash if track doesn't have artist/album set
- Date: Thu, 17 Apr 2014 12:04:10 +0000 (UTC)
commit 3661dbf184cc1879a864d595f8cf587ae9690f22
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Fri Mar 21 13:19:27 2014 +0100
searchbar: don't crash if track doesn't have artist/album set
https://bugzilla.gnome.org/show_bug.cgi?id=726721
gnomemusic/searchbar.py | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/searchbar.py b/gnomemusic/searchbar.py
index 9fb6bd8..f77beec 100644
--- a/gnomemusic/searchbar.py
+++ b/gnomemusic/searchbar.py
@@ -1,4 +1,5 @@
from gi.repository import Gtk, Gd
+from gettext import gettext as _
class Searchbar(Gd.Revealer):
@@ -27,13 +28,14 @@ class Searchbar(Gd.Revealer):
search_string = self._search_entry.get_text().lower()
media = model.get_value(itr, 5)
searchable_fields = []
- artist = None
+ artist = _("Unknown Artist")
+ album = _("Unknown Album")
if media and media.get_url():
- artist = media.get_artist()
- if media and artist:
- searchable_fields = [media.get_artist(),
- media.get_album(),
- media.get_title()]
+ if media.get_artist() is not None:
+ artist = media.get_artist()
+ if media.get_album() is not None:
+ album = media.get_album()
+ searchable_fields = [artist, album, media.get_title()]
else:
searchable_fields = [model.get_value(itr, 2),
model.get_value(itr, 3)]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]