Code Duplication    Length = 28-28 lines in 2 locations

pylast/__init__.py 2 locations

@@ 2769-2796 (lines=28) @@
2766
2767
        return seq
2768
2769
    def get_tracks(self, artist=None, album=None, limit=50, cacheable=True):
2770
        """
2771
        Returns a sequence of Album objects
2772
        If limit==None it will return all (may take a while)
2773
        """
2774
2775
        params = self._get_params()
2776
        if artist:
2777
            params["artist"] = artist
2778
        if album:
2779
            params["album"] = album
2780
2781
        seq = []
2782
        for node in _collect_nodes(
2783
                limit,
2784
                self,
2785
                self.ws_prefix + ".getTracks",
2786
                cacheable,
2787
                params):
2788
            name = _extract(node, "name")
2789
            artist = _extract(node, "name", 1)
2790
            playcount = _number(_extract(node, "playcount"))
2791
            tagcount = _number(_extract(node, "tagcount"))
2792
2793
            seq.append(LibraryItem(
2794
                Track(artist, name, self.network), playcount, tagcount))
2795
2796
        return seq
2797
2798
    def remove_scrobble(self, artist, title, timestamp):
2799
        """Remove a scrobble from a user's Last.fm library. Parameters:
@@ 2718-2745 (lines=28) @@
2715
2716
        self._request(self.ws_prefix + ".addTrack", False, params)
2717
2718
    def get_albums(self, artist=None, limit=50, cacheable=True):
2719
        """
2720
        Returns a sequence of Album objects
2721
        If no artist is specified, it will return all, sorted by decreasing
2722
        play count.
2723
        If limit==None it will return all (may take a while)
2724
        """
2725
2726
        params = self._get_params()
2727
        if artist:
2728
            params["artist"] = artist
2729
2730
        seq = []
2731
        for node in _collect_nodes(
2732
                limit,
2733
                self,
2734
                self.ws_prefix + ".getAlbums",
2735
                cacheable,
2736
                params):
2737
            name = _extract(node, "name")
2738
            artist = _extract(node, "name", 1)
2739
            playcount = _number(_extract(node, "playcount"))
2740
            tagcount = _number(_extract(node, "tagcount"))
2741
2742
            seq.append(LibraryItem(
2743
                Album(artist, name, self.network), playcount, tagcount))
2744
2745
        return seq
2746
2747
    def get_artists(self, limit=50, cacheable=True):
2748
        """