| 1 |
LastImport Plugin |
| 2 |
================= |
| 3 |
|
| 4 |
The ``lastimport`` plugin downloads play-count data from your Last.fm_ library |
| 5 |
into beets' database. You can later create :doc:`smart playlists |
| 6 |
</plugins/smartplaylist>` by querying ``lastfm_play_count`` and do other fun |
| 7 |
stuff with this field. |
| 8 |
|
| 9 |
.. _last.fm: https://www.last.fm/ |
| 10 |
|
| 11 |
Installation |
| 12 |
------------ |
| 13 |
|
| 14 |
To use the ``lastimport`` plugin, first enable it in your configuration (see |
| 15 |
:ref:`using-plugins`). Then, install ``beets`` with ``lastimport`` extra |
| 16 |
|
| 17 |
.. code-block:: bash |
| 18 |
|
| 19 |
pip install "beets[lastimport]" |
| 20 |
|
| 21 |
Next, add your Last.fm username to your beets configuration file: |
| 22 |
|
| 23 |
:: |
| 24 |
|
| 25 |
lastfm: |
| 26 |
user: beetsfanatic |
| 27 |
|
| 28 |
Importing Play Counts |
| 29 |
--------------------- |
| 30 |
|
| 31 |
Simply run ``beet lastimport`` and wait for the plugin to request tracks from |
| 32 |
Last.fm and match them to your beets library. (You will be notified of tracks in |
| 33 |
your Last.fm profile that do not match any songs in your library.) |
| 34 |
|
| 35 |
Then, your matched tracks will be populated with the ``lastfm_play_count`` |
| 36 |
field, which you can use in any query or template. For example: |
| 37 |
|
| 38 |
:: |
| 39 |
|
| 40 |
$ beet ls -f '$title: $lastfm_play_count' lastfm_play_count:5.. |
| 41 |
Eple (Melody A.M.): 60 |
| 42 |
|
| 43 |
To see more information (namely, the specific play counts for matched tracks), |
| 44 |
use the ``-v`` option. |
| 45 |
|
| 46 |
.. versionchanged:: 2.8.0 |
| 47 |
|
| 48 |
The ``play_count`` field was renamed to ``lastfm_play_count`` to avoid |
| 49 |
confusion with ``play_count`` field populated by :doc:`mpdstats` plugin. |
| 50 |
|
| 51 |
Configuration |
| 52 |
------------- |
| 53 |
|
| 54 |
Aside from the required ``lastfm.user`` field, this plugin has some specific |
| 55 |
options under the ``lastimport:`` section: |
| 56 |
|
| 57 |
- **per_page**: The number of tracks to request from the API at once. Default: |
| 58 |
500. |
| 59 |
- **retry_limit**: How many times should we re-send requests to Last.fm on |
| 60 |
failure? Default: 3. |
| 61 |
|
| 62 |
By default, the plugin will use beets's own Last.fm API key. You can also |
| 63 |
override it with your own API key: |
| 64 |
|
| 65 |
:: |
| 66 |
|
| 67 |
lastfm: |
| 68 |
api_key: your_api_key |