Ejemplo n.º 1
0
    def get_weekly_track_chart(self, user, start=None, end=None):
        """
        Get an track chart for a user profile, for a given date range. If no
        date range is supplied, it will return the most recent track chart for
        this user.

        http://www.last.fm/api/show/user.getWeeklyTrackChart
        """
        return self._client._request(
            'GET',
            'user.getWeeklyTrackChart',
            unwrap='weeklytrackchart',
            params={'user': user,
                    'from': query_date(start),
                    'to': query_date(end)},
        )['track']
Ejemplo n.º 2
0
    def get_recent_tracks(self, user, start=None, end=None):
        """
        Get tracks recently played by the user. Always returns extended data.

        http://www.last.fm/api/show/user.getRecentTracks
        """
        resp = self._client._paginate_request(
            'GET',
            'user.getRecentTracks',
            'track',
            unwrap='recenttracks',
            params={'user': user,
                    'from': query_date(start),
                    'to': query_date(end),
                    'extended': 1},
        )
        return self.model_iterator(RecentTrack, resp['track'])
Ejemplo n.º 3
0
    def get_artist_tracks(self, user, artist, start=None, end=None):
        """
        Get artist tracks scrobbled by the user

        http://www.last.fm/api/show/user.getArtistTracks
        """
        resp = self._client._paginate_request(
            'GET',
            'user.getArtistTracks',
            'track',
            unwrap='artisttracks',
            params=dict(user=user,
                        artist=artist,
                        start=query_date(start),
                        end=query_date(end))
        )
        return self.model_iterator(ArtistTrack, resp['track'])