From ebc5b29f5cdf719c1a35b4c48deb064a793874b6 Mon Sep 17 00:00:00 2001 From: hugovk Date: Thu, 19 Oct 2017 00:46:23 +0300 Subject: [PATCH] Remove dead or broken Last.fm user functions --- pylast/__init__.py | 44 --------------------------------------- tests/test_pylast_user.py | 17 --------------- 2 files changed, 61 deletions(-) diff --git a/pylast/__init__.py b/pylast/__init__.py index a1a23d2..e74c247 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -1074,37 +1074,6 @@ class _BaseObject(object): return seq - def share(self, users, message=None): - """ - Shares this (sends out recommendations). - Parameters: - * users [User|str,]: A list that can contain usernames, emails, - User objects, or all of them. - * message str: A message to include in the recommendation message. - Only for Artist/Track. - """ - - # Last.fm currently accepts a max of 10 recipient at a time - while len(users) > 10: - section = users[0:9] - users = users[9:] - self.share(section, message) - - user_names = [] - for user in users: - if isinstance(user, User): - user_names.append(user.get_name()) - else: - user_names.append(user) - - params = self._get_params() - recipients = ','.join(user_names) - params['recipient'] = recipients - if message: - params['message'] = message - - self._request(self.ws_prefix + '.share', False, params) - def get_wiki_published_date(self): """ Returns the summary of the wiki. @@ -2538,19 +2507,6 @@ class AuthenticatedUser(User): self.name = _extract(doc, "name") return self.name - def get_recommended_artists(self, limit=50, cacheable=False): - """ - Returns a sequence of Artist objects - if limit==None it will return all - """ - - seq = [] - for node in _collect_nodes( - limit, self, "user.getRecommendedArtists", cacheable): - seq.append(Artist(_extract(node, "name"), self.network)) - - return seq - class _Search(_BaseObject): """An abstract class. Use one of its derivatives.""" diff --git a/tests/test_pylast_user.py b/tests/test_pylast_user.py index 9121dbe..26876bf 100755 --- a/tests/test_pylast_user.py +++ b/tests/test_pylast_user.py @@ -256,23 +256,6 @@ class TestPyLastUser(PyLastTestCase): # Act/Assert self.helper_get_assert_charts(lastfm_user, dates[0]) - # Commented out to avoid spamming - # def test_share_spam(self): - # # Arrange - # users_to_spam = [TODO_ENTER_SPAMEES_HERE] - # spam_message = "Dig the krazee sound!" - # artist = self.network.get_top_artists(limit=1)[0].item - # track = artist.get_top_tracks(limit=1)[0].item - - # # Act - # artist.share(users_to_spam, spam_message) - # track.share(users_to_spam, spam_message) - - # Assert - # Check inbox for spam! - - # album/artist/track/user - def test_user_top_artists(self): # Arrange lastfm_user = self.network.get_user(self.username)