Add library.removeArtist, closes #84
This commit is contained in:
parent
880e160f64
commit
7eb640fa88
11
pylast.py
11
pylast.py
|
@ -2019,6 +2019,15 @@ class Library(_BaseObject):
|
||||||
|
|
||||||
self._request("library.addAlbum", False, params)
|
self._request("library.addAlbum", False, params)
|
||||||
|
|
||||||
|
def remove_album(self, album):
|
||||||
|
"""Remove an album from this library."""
|
||||||
|
|
||||||
|
params = self._get_params()
|
||||||
|
params["artist"] = album.get_artist().get_name()
|
||||||
|
params["album"] = album.get_name()
|
||||||
|
|
||||||
|
self._request("library.removeAlbum", False, params)
|
||||||
|
|
||||||
def add_artist(self, artist):
|
def add_artist(self, artist):
|
||||||
"""Add an artist to this library."""
|
"""Add an artist to this library."""
|
||||||
|
|
||||||
|
@ -3932,7 +3941,7 @@ class Scrobbler(object):
|
||||||
|
|
||||||
def report_now_playing(self, artist, title, album = "", duration = "", track_number = "", mbid = ""):
|
def report_now_playing(self, artist, title, album = "", duration = "", track_number = "", mbid = ""):
|
||||||
|
|
||||||
_deprecation_warning("DeprecationWarning: Use Netowrk.update_now_playing(...) instead")
|
_deprecation_warning("DeprecationWarning: Use Network.update_now_playing(...) instead")
|
||||||
|
|
||||||
params = {"s": self._get_session_id(), "a": artist, "t": title,
|
params = {"s": self._get_session_id(), "a": artist, "t": title,
|
||||||
"b": album, "l": duration, "n": track_number, "m": mbid}
|
"b": album, "l": duration, "n": track_number, "m": mbid}
|
||||||
|
|
|
@ -78,7 +78,30 @@ class TestPyLast(unittest.TestCase):
|
||||||
library.add_album(album)
|
library.add_album(album)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
# Nothing here, just that no exception occurred
|
my_albums = library.get_albums()
|
||||||
|
for my_album in my_albums:
|
||||||
|
value = (album == my_album[0])
|
||||||
|
if value:
|
||||||
|
break
|
||||||
|
self.assertTrue(value)
|
||||||
|
|
||||||
|
|
||||||
|
def test_remove_album(self):
|
||||||
|
# Arrange
|
||||||
|
library = pylast.Library(user = self.username, network = self.network)
|
||||||
|
album = self.network.get_album("Test Artist", "Test Album")
|
||||||
|
library.add_album(album)
|
||||||
|
|
||||||
|
# Act
|
||||||
|
library.remove_album(album)
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
my_albums = library.get_albums()
|
||||||
|
for my_album in my_albums:
|
||||||
|
value = (album == my_album[0])
|
||||||
|
if value:
|
||||||
|
break
|
||||||
|
self.assertFalse(value)
|
||||||
|
|
||||||
|
|
||||||
def test_get_venue(self):
|
def test_get_venue(self):
|
||||||
|
@ -260,10 +283,12 @@ class TestPyLast(unittest.TestCase):
|
||||||
self.assertEqual(str(current_track.artist), "Test Artist")
|
self.assertEqual(str(current_track.artist), "Test Artist")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
# suite = unittest.TestSuite()
|
# suite = unittest.TestSuite()
|
||||||
# suite.addTest(TestPyLast('test_update_now_playing'))
|
# suite.addTest(TestPyLast('test_remove_album'))
|
||||||
# unittest.TextTestRunner().run(suite)
|
# unittest.TextTestRunner().run(suite)
|
||||||
|
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in a new issue