Lastex.User (Lastex v0.1.0)

Copy Markdown View Source

Functions for the Last.fm User API methods.

Functions returning a user's top items accept a period option — one of "overall", "7day", "1month", "3month", "6month", or "12month".

Summary

Functions

Fetches a user's friends (user.getFriends).

Fetches a user's profile (user.getInfo).

Fetches the tracks a user has loved (user.getLovedTracks).

Fetches the items a user has tagged with a given tag (user.getPersonalTags).

Fetches a user's recent scrobbles (user.getRecentTracks).

Fetches a user's most listened-to albums (user.getTopAlbums).

Fetches a user's most listened-to artists (user.getTopArtists).

Fetches a user's most used tags (user.getTopTags).

Fetches a user's most listened-to tracks (user.getTopTracks).

Fetches a user's album chart for a week (user.getWeeklyAlbumChart).

Fetches a user's artist chart for a week (user.getWeeklyArtistChart).

Fetches the weekly chart periods available for a user (user.getWeeklyChartList).

Fetches a user's track chart for a week (user.getWeeklyTrackChart).

Functions

friends(user, opts \\ [])

Fetches a user's friends (user.getFriends).

Returns a Lastex.Page. Supports limit, page, and recenttracks: 1 to include each friend's latest scrobble.

Lastex.User.friends("rj", limit: 50)

info(user)

Fetches a user's profile (user.getInfo).

Lastex.User.info("rj")

loved_tracks(user, opts \\ [])

Fetches the tracks a user has loved (user.getLovedTracks).

Returns a Lastex.Page. Supports limit and page.

Lastex.User.loved_tracks("rj", limit: 50)

personal_tags(user, tag, taggingtype, opts \\ [])

Fetches the items a user has tagged with a given tag (user.getPersonalTags).

taggingtype is one of "artist", "album", or "track", and determines the shape of the returned data. Returns a Lastex.Page.

Lastex.User.personal_tags("rj", "progressive metal", "artist")

recent_tracks(user, opts \\ [])

Fetches a user's recent scrobbles (user.getRecentTracks).

Returns a Lastex.Page. Supports limit (up to 200), page, and from/to Unix timestamps to bound the range. A currently playing track, if any, is included with a "@attr" => %{"nowplaying" => "true"} marker.

Lastex.User.recent_tracks("rj", limit: 200)

top_albums(user, opts \\ [])

Fetches a user's most listened-to albums (user.getTopAlbums).

Returns a Lastex.Page. Supports period, limit, and page.

Lastex.User.top_albums("rj", period: "6month", limit: 10)

top_artists(user, opts \\ [])

Fetches a user's most listened-to artists (user.getTopArtists).

Returns a Lastex.Page. Supports period, limit, and page.

Lastex.User.top_artists("rj", period: "overall", limit: 10)

top_tags(user, opts \\ [])

Fetches a user's most used tags (user.getTopTags).

Returns a Lastex.Page. Supports limit.

Lastex.User.top_tags("rj", limit: 10)

top_tracks(user, opts \\ [])

Fetches a user's most listened-to tracks (user.getTopTracks).

Returns a Lastex.Page. Supports period, limit, and page.

Lastex.User.top_tracks("rj", period: "1month", limit: 10)

weekly_album_chart(user, opts \\ [])

Fetches a user's album chart for a week (user.getWeeklyAlbumChart).

Returns a Lastex.Page. Pass from and to Unix timestamps from weekly_chart_list/1; the most recent week is used when omitted.

Lastex.User.weekly_album_chart("rj")

weekly_artist_chart(user, opts \\ [])

Fetches a user's artist chart for a week (user.getWeeklyArtistChart).

Returns a Lastex.Page. Pass from and to Unix timestamps from weekly_chart_list/1; the most recent week is used when omitted.

Lastex.User.weekly_artist_chart("rj")

weekly_chart_list(user)

Fetches the weekly chart periods available for a user (user.getWeeklyChartList).

Each entry carries the from and to Unix timestamps accepted by the weekly_*_chart functions.

Lastex.User.weekly_chart_list("rj")

weekly_track_chart(user, opts \\ [])

Fetches a user's track chart for a week (user.getWeeklyTrackChart).

Returns a Lastex.Page. Pass from and to Unix timestamps from weekly_chart_list/1; the most recent week is used when omitted.

Lastex.User.weekly_track_chart("rj")