diff --git a/pylast/__init__.py b/pylast/__init__.py index 50d40c7..f593667 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -1928,6 +1928,12 @@ class Artist(_BaseObject, _Taggable): return self.name + def get_correction(self): + """Returns the corrected artist name.""" + + return _extract( + self._request(self.ws_prefix + ".getCorrection"), "name") + def get_cover_image(self, size=COVER_MEGA): """ Returns a uri to the cover image @@ -2947,6 +2953,12 @@ class Track(_Opus): def __init__(self, artist, title, network, username=None): super(Track, self).__init__(artist, title, network, "track", username) + def get_correction(self): + """Returns the corrected track name.""" + + return _extract( + self._request(self.ws_prefix + ".getCorrection"), "name") + def get_duration(self): """Returns the track duration.""" diff --git a/tests/test_pylast.py b/tests/test_pylast.py index 1980e7a..25a9596 100755 --- a/tests/test_pylast.py +++ b/tests/test_pylast.py @@ -1908,6 +1908,25 @@ class TestPyLast(unittest.TestCase): self.assertEqual(str(tracks[0].track.artist), "Johnny Cash") self.assertEqual(str(tracks[0].track.title), "Ring of Fire") + def test_artist_get_correction(self): + # Arrange + artist = pylast.Artist("guns and roses", self.network) + + # Act + corrected_artist_name = artist.get_correction() + + # Assert + self.assertEqual(corrected_artist_name, "Guns N' Roses") + + def test_track_get_correction(self): + # Arrange + track = pylast.Track("Guns N' Roses", "mrbrownstone", self.network) + + # Act + corrected_track_name = track.get_correction() + + # Assert + self.assertEqual(corrected_track_name, "Mr. Brownstone") if __name__ == '__main__': unittest.main(failfast=True)