LastImport Plugin#

The lastimport plugin downloads play-count data from your library into beets’ database. You can later create smart playlists by querying play_count and do other fun stuff with this field.


The plugin requires pylast, which you can install using pip by typing:

pip install pylast

After you have pylast installed, enable the lastimport plugin in your configuration (see Using Plugins).

Next, add your username to your beets configuration file:

    user: beetsfanatic

Importing Play Counts#

Simply run beet lastimport and wait for the plugin to request tracks from and match them to your beets library. (You will be notified of tracks in your profile that do not match any songs in your library.)

Then, your matched tracks will be populated with the play_count field, which you can use in any query or template. For example:

$ beet ls -f '$title: $play_count' play_count:5..
Eple (Melody A.M.): 60

To see more information (namely, the specific play counts for matched tracks), use the -v option.


Aside from the required lastfm.user field, this plugin has some specific options under the lastimport: section:

  • per_page: The number of tracks to request from the API at once. Default: 500.

  • retry_limit: How many times should we re-send requests to on failure? Default: 3.

By default, the plugin will use beets’s own API key. You can also override it with your own API key:

    api_key: your_api_key