The lastfm Reference Manual

This is the lastfm Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed May 15 05:43:14 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 lastfm

Interface for the Last.fm API (https://www.last.fm/api/)

Author

Mihai Olteanu

License

GPLv3

Version

0.1

Dependencies
  • drakma (system).
  • plump (system).
  • lquery (system).
  • defmemo (system).
  • alexandria (system).
  • ironclad (system).
  • trivial-open-browser (system).
  • generators (system).
Source

lastfm.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 lastfm/lastfm.asd

Source

lastfm.asd.

Parent Component

lastfm (system).

ASDF Systems

lastfm.


3.1.2 lastfm/package.lisp

Source

lastfm.asd.

Parent Component

lastfm (system).

Packages

lastfm.


3.1.3 lastfm/lastfm.lisp

Dependency

package.lisp (file).

Source

lastfm.asd.

Parent Component

lastfm (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 lastfm

Source

package.lisp.

Use List
  • common-lisp.
  • defmemo.
  • drakma.
  • generators.
  • lquery.
  • plump.
  • trivial-open-browser.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: album-getinfo (artist album)
Package

lastfm.

Source

lastfm.lisp.

Function: album-songs (artist album)

Return a generator with all the songs on the artist’s album.

Package

lastfm.

Source

lastfm.lisp.

Function: artist-getinfo (artist)
Package

lastfm.

Source

lastfm.lisp.

Function: artist-getsimilar (artist limit)
Package

lastfm.

Source

lastfm.lisp.

Function: artist-gettopalbums (artist limit)
Package

lastfm.

Source

lastfm.lisp.

Function: artist-gettoptags (artist)
Package

lastfm.

Source

lastfm.lisp.

Function: artist-gettoptracks (artist limit)
Package

lastfm.

Source

lastfm.lisp.

Function: artist-search (artist limit)
Package

lastfm.

Source

lastfm.lisp.

Function: artist-similar-artists-songs (artist nartists nsongs)

Return an infinite songs generator. Every new song is picked by first selecting a random artist from the first nartists similar to the given artist, according to the last.fm info. From this random artist a random song is picked from the first best nsongs according to the last.fm info. When called, the generator returns a list of two items, an artist and a song.

Package

lastfm.

Source

lastfm.lisp.

Function: artist-songs (artist nsongs random)

Return an infinite songs generator. If random is T, every new song is picked at random from the artists’ first best nsongs of all time, as seen on the artist’s last.fm page. If random is nil, the songs are picked in order. After the last song, the first song is returned again, ad infinitum.

Package

lastfm.

Source

lastfm.lisp.

Function: auth-getsession (token)
Package

lastfm.

Source

lastfm.lisp.

Function: auth-gettoken ()
Package

lastfm.

Source

lastfm.lisp.

Function: generate-session-key ()

Fetch a token, and then let the user authorize the application in his browser. Only after the user authorizes the application can the session key fetching continue. Thus, we wait until a return from the breakpoint is signaled by the user. After that, call last.fm again to fetch the session key, save it to the rc-file and reload the rc-file.

Package

lastfm.

Source

lastfm.lisp.

Function: my-loved-songs (nsongs random)

Return a generator with the current user loved songs. The username is the one specified in the .lastfmrc config file.

Package

lastfm.

Source

lastfm.lisp.

Function: random-artist-song (artist &optional limit)
Package

lastfm.

Source

lastfm.lisp.

Function: random-similar-artist (artist &optional limit)
Package

lastfm.

Source

lastfm.lisp.

Function: random-tag-artist (tag &optional limit)
Package

lastfm.

Source

lastfm.lisp.

Function: random-tag-song (tag &optional limit)
Package

lastfm.

Source

lastfm.lisp.

Function: random-user-loved-song (user &optional limit)
Package

lastfm.

Source

lastfm.lisp.

Function: song-youtube-url (artist song)

Since there is no youtube link available through the last.fm API, try and get it from the last.fm song’s page.

Package

lastfm.

Source

lastfm.lisp.

Function: tag-getinfo (tag)
Package

lastfm.

Source

lastfm.lisp.

Function: tag-gettopartists (tag limit)
Package

lastfm.

Source

lastfm.lisp.

Function: tag-gettoptracks (tag limit)
Package

lastfm.

Source

lastfm.lisp.

Function: tag-similar-artists-songs (tag nartists nsongs)
Package

lastfm.

Source

lastfm.lisp.

Function: tag-songs (tagname nsongs random)
Package

lastfm.

Source

lastfm.lisp.

Function: track-love (artist track)
Package

lastfm.

Source

lastfm.lisp.

Function: track-scrobble (artist track timestamp)
Package

lastfm.

Source

lastfm.lisp.

Function: track-unlove (artist track)
Package

lastfm.

Source

lastfm.lisp.

Function: user-getlovedtracks (user limit)
Package

lastfm.

Source

lastfm.lisp.

Function: user-songs (username nsongs random)

Return a generator with songs from a user of your choice.

Package

lastfm.

Source

lastfm.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *api-key*
Package

lastfm.

Source

lastfm.lisp.

Special Variable: *base-url*
Package

lastfm.

Source

lastfm.lisp.

Special Variable: *methods*
Package

lastfm.

Source

lastfm.lisp.

Special Variable: *shared-secret*
Package

lastfm.

Source

lastfm.lisp.

Special Variable: *sk*
Package

lastfm.

Source

lastfm.lisp.

Special Variable: *username*
Package

lastfm.

Source

lastfm.lisp.


5.2.2 Macros

Macro: build-lastfm-functions ()

Create all the last.fm functions.

Package

lastfm.

Source

lastfm.lisp.


5.2.3 Ordinary functions

Function: add-sk-to-rcfile (sk)

Add the session key to the user config file.

Package

lastfm.

Source

lastfm.lisp.

Function: auth-needed-p (method)
Package

lastfm.

Source

lastfm.lisp.

Function: authorize-user (token)

Ask the user to authorize the application.

Package

lastfm.

Source

lastfm.lisp.

Function: build-lastfm-function (method)

Create and export a function for the last.fm method and memoize it if it doesn’t need authentication.

Package

lastfm.

Source

lastfm.lisp.

Function: config (&key api-key shared-secret username sk)

This function is called from the user config file once it is loaded.

Package

lastfm.

Source

lastfm.lisp.

Function: create-double-generator (artist-fn name nartists nsongs)
Package

lastfm.

Source

lastfm.lisp.

Function: create-generator (fn name nitems random &key yield-name)
Package

lastfm.

Source

lastfm.lisp.

Function: find-method-entry (name)
Package

lastfm.

Source

lastfm.lisp.

Function: lfm-request (method &rest param-values)
Package

lastfm.

Source

lastfm.lisp.

Function: load-rc-file ()

Load the config file. Create it with empty strings if the file does not exist. The user will have to update this file, otherwise, all calls willl return NIL.

Package

lastfm.

Source

lastfm.lisp.

Function: method-name (method)
Package

lastfm.

Source

lastfm.lisp.

Function: method-name-string (method)

A method name string in the format requested by the Last.fm API parameters

Package

lastfm.

Source

lastfm.lisp.

Function: method-parameters (method)
Package

lastfm.

Source

lastfm.lisp.

Function: multi-query-p (query)

CSS selectors with ’,’ allow retrieving multiple tags in the same request

Package

lastfm.

Source

lastfm.lisp.

Function: param-value-list (method param-values)

Build the parameter/value list according to the given method and the user supplied values.

Package

lastfm.

Source

lastfm.lisp.

Function: parameter-string (param)
Package

lastfm.

Source

lastfm.lisp.

Function: parse-request-results (html query)
Package

lastfm.

Source

lastfm.lisp.

Function: query-string (method)
Package

lastfm.

Source

lastfm.lisp.

Function: request-method (method param-values &key retries)

Make the request through the Last.fm API

Package

lastfm.

Source

lastfm.lisp.

Function: request-string (params)

The signing procedure for authentication needs all the parameters and values lumped together in one big string without equal or ampersand symbols between them, and with the shared secret appended to the end of this string.

Package

lastfm.

Source

lastfm.lisp.

Function: session-key-p (method)
Package

lastfm.

Source

lastfm.lisp.

Function: sign (str)
Package

lastfm.

Source

lastfm.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   B   C   F   G   L   M   P   Q   R   S   T   U  
Index Entry  Section

A
add-sk-to-rcfile: Private ordinary functions
album-getinfo: Public ordinary functions
album-songs: Public ordinary functions
artist-getinfo: Public ordinary functions
artist-getsimilar: Public ordinary functions
artist-gettopalbums: Public ordinary functions
artist-gettoptags: Public ordinary functions
artist-gettoptracks: Public ordinary functions
artist-search: Public ordinary functions
artist-similar-artists-songs: Public ordinary functions
artist-songs: Public ordinary functions
auth-getsession: Public ordinary functions
auth-gettoken: Public ordinary functions
auth-needed-p: Private ordinary functions
authorize-user: Private ordinary functions

B
build-lastfm-function: Private ordinary functions
build-lastfm-functions: Private macros

C
config: Private ordinary functions
create-double-generator: Private ordinary functions
create-generator: Private ordinary functions

F
find-method-entry: Private ordinary functions
Function, add-sk-to-rcfile: Private ordinary functions
Function, album-getinfo: Public ordinary functions
Function, album-songs: Public ordinary functions
Function, artist-getinfo: Public ordinary functions
Function, artist-getsimilar: Public ordinary functions
Function, artist-gettopalbums: Public ordinary functions
Function, artist-gettoptags: Public ordinary functions
Function, artist-gettoptracks: Public ordinary functions
Function, artist-search: Public ordinary functions
Function, artist-similar-artists-songs: Public ordinary functions
Function, artist-songs: Public ordinary functions
Function, auth-getsession: Public ordinary functions
Function, auth-gettoken: Public ordinary functions
Function, auth-needed-p: Private ordinary functions
Function, authorize-user: Private ordinary functions
Function, build-lastfm-function: Private ordinary functions
Function, config: Private ordinary functions
Function, create-double-generator: Private ordinary functions
Function, create-generator: Private ordinary functions
Function, find-method-entry: Private ordinary functions
Function, generate-session-key: Public ordinary functions
Function, lfm-request: Private ordinary functions
Function, load-rc-file: Private ordinary functions
Function, method-name: Private ordinary functions
Function, method-name-string: Private ordinary functions
Function, method-parameters: Private ordinary functions
Function, multi-query-p: Private ordinary functions
Function, my-loved-songs: Public ordinary functions
Function, param-value-list: Private ordinary functions
Function, parameter-string: Private ordinary functions
Function, parse-request-results: Private ordinary functions
Function, query-string: Private ordinary functions
Function, random-artist-song: Public ordinary functions
Function, random-similar-artist: Public ordinary functions
Function, random-tag-artist: Public ordinary functions
Function, random-tag-song: Public ordinary functions
Function, random-user-loved-song: Public ordinary functions
Function, request-method: Private ordinary functions
Function, request-string: Private ordinary functions
Function, session-key-p: Private ordinary functions
Function, sign: Private ordinary functions
Function, song-youtube-url: Public ordinary functions
Function, tag-getinfo: Public ordinary functions
Function, tag-gettopartists: Public ordinary functions
Function, tag-gettoptracks: Public ordinary functions
Function, tag-similar-artists-songs: Public ordinary functions
Function, tag-songs: Public ordinary functions
Function, track-love: Public ordinary functions
Function, track-scrobble: Public ordinary functions
Function, track-unlove: Public ordinary functions
Function, user-getlovedtracks: Public ordinary functions
Function, user-songs: Public ordinary functions

G
generate-session-key: Public ordinary functions

L
lfm-request: Private ordinary functions
load-rc-file: Private ordinary functions

M
Macro, build-lastfm-functions: Private macros
method-name: Private ordinary functions
method-name-string: Private ordinary functions
method-parameters: Private ordinary functions
multi-query-p: Private ordinary functions
my-loved-songs: Public ordinary functions

P
param-value-list: Private ordinary functions
parameter-string: Private ordinary functions
parse-request-results: Private ordinary functions

Q
query-string: Private ordinary functions

R
random-artist-song: Public ordinary functions
random-similar-artist: Public ordinary functions
random-tag-artist: Public ordinary functions
random-tag-song: Public ordinary functions
random-user-loved-song: Public ordinary functions
request-method: Private ordinary functions
request-string: Private ordinary functions

S
session-key-p: Private ordinary functions
sign: Private ordinary functions
song-youtube-url: Public ordinary functions

T
tag-getinfo: Public ordinary functions
tag-gettopartists: Public ordinary functions
tag-gettoptracks: Public ordinary functions
tag-similar-artists-songs: Public ordinary functions
tag-songs: Public ordinary functions
track-love: Public ordinary functions
track-scrobble: Public ordinary functions
track-unlove: Public ordinary functions

U
user-getlovedtracks: Public ordinary functions
user-songs: Public ordinary functions