Lastex.Track (Lastex v0.1.0)

Copy Markdown View Source

Functions for the Last.fm Track API methods.

Read functions take the artist name first and the track name second. Write functions additionally take a session key obtained via Lastex.Auth.

Summary

Functions

Tags a track with one or more tags (track.addTags).

Returns the canonical track name for a possibly misspelled one (track.getCorrection).

Fetches metadata for a track (track.getInfo).

Loves a track on behalf of the authenticated user (track.love).

Removes a single tag from a track (track.removeTag). Requires a session key.

Searches for tracks by name (track.search).

Fetches tracks similar to the given one (track.getSimilar).

Fetches the tags a user has applied to a track (track.getTags).

Fetches the most popular tags for a track (track.getTopTags).

Removes a track from the authenticated user's loved tracks (track.unlove).

Functions

add_tags(artist, track, tags, sk)

Tags a track with one or more tags (track.addTags).

tags is a comma-separated string of up to 10 tags. Requires a session key.

Lastex.Track.add_tags("Opeth", "Blackwater Park", "progressive metal", session_key)

correction(artist, track)

Returns the canonical track name for a possibly misspelled one (track.getCorrection).

Lastex.Track.correction("opeth", "blackwater park")

info(artist, track, opts \\ [])

Fetches metadata for a track (track.getInfo).

Pass username: "name" to include that user's playcount and loved status, or autocorrect: 1 to correct misspelled names.

Lastex.Track.info("Opeth", "Blackwater Park")

love(artist, track, sk)

Loves a track on behalf of the authenticated user (track.love).

Lastex.Track.love("Opeth", "Blackwater Park", session_key)

remove_tag(artist, track, tag, sk)

Removes a single tag from a track (track.removeTag). Requires a session key.

Lastex.Track.remove_tag("Opeth", "Blackwater Park", "progressive metal", session_key)

search(track, opts \\ [])

Searches for tracks by name (track.search).

Returns a Lastex.Page. Supports limit, page, and artist to narrow the search.

Lastex.Track.search("Blackwater Park", limit: 5)

similar(artist, track, opts \\ [])

Fetches tracks similar to the given one (track.getSimilar).

Returns a Lastex.Page. Supports limit and autocorrect.

Lastex.Track.similar("Opeth", "Blackwater Park", limit: 10)

tags(artist, track, opts \\ [])

Fetches the tags a user has applied to a track (track.getTags).

Returns a Lastex.Page. Pass user: "name" to read another user's tags, or a session key via sk to read your own.

Lastex.Track.tags("Opeth", "Blackwater Park", user: "rj")

top_tags(artist, track, opts \\ [])

Fetches the most popular tags for a track (track.getTopTags).

Returns a Lastex.Page.

Lastex.Track.top_tags("Opeth", "Blackwater Park")

unlove(artist, track, sk)

Removes a track from the authenticated user's loved tracks (track.unlove).

Lastex.Track.unlove("Opeth", "Blackwater Park", session_key)