[rhythmbox] context: check that the user has a last.fm account before fetching data
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox] context: check that the user has a last.fm account before fetching data
- Date: Sun, 1 Nov 2009 06:01:04 +0000 (UTC)
commit fc4c5cd340c6198f920aaadc6fe72729a5b397ad
Author: Jonathan Matthew <jonathan fibula d14n org>
Date: Sun Nov 1 09:37:09 2009 +1000
context: check that the user has a last.fm account before fetching data
last.fm's terms of service require that we only make last.fm data available
to registered last.fm users. Since any such check that we do can be trivially
removed by any user, we don't put much effort into it.
plugins/context/context/AlbumTab.py | 5 +++++
plugins/context/context/ArtistTab.py | 8 ++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/plugins/context/context/AlbumTab.py b/plugins/context/context/AlbumTab.py
index bda03a9..ff0ae30 100644
--- a/plugins/context/context/AlbumTab.py
+++ b/plugins/context/context/AlbumTab.py
@@ -162,6 +162,11 @@ class AlbumDataSource (gobject.GObject):
return self.error
def fetch_album_list (self, artist):
+ if LastFM.user_has_account() is False:
+ self.error = LastFM.NO_ACCOUNT_ERROR
+ self.emit ('albums-ready')
+ return
+
self.artist = artist
self.error = None
url = "%sartist.gettopalbums&artist=%s&api_key=%s" % (LastFM.URL_PREFIX,
diff --git a/plugins/context/context/ArtistTab.py b/plugins/context/context/ArtistTab.py
index 5d1f776..dad048c 100644
--- a/plugins/context/context/ArtistTab.py
+++ b/plugins/context/context/ArtistTab.py
@@ -199,6 +199,9 @@ class ArtistDataSource (gobject.GObject):
return None
def fetch_top_tracks (self, artist):
+ if LastFM.user_has_account() is False:
+ return
+
artist = artist.replace (" ", "+")
function = self.artist['top_tracks']['function']
cache = self.artist['top_tracks']['cache']
@@ -215,6 +218,11 @@ class ArtistDataSource (gobject.GObject):
before any of the get_* methods.
"""
self.current_artist = artist
+ if LastFM.user_has_account() is False:
+ self.error = LastFM.NO_ACCOUNT_ERROR
+ self.emit ('artist-info-ready')
+ return
+
self.error = None
artist = artist.replace(" ", "+")
for key, value in self.artist.items():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]