Overview

How to use the lastexport and libreimport scripts to create a dump of your last.fm tracks and importing them to libre.fm

Getting the scripts

 lastexport.py - Used for exporting your tracks from last.fm to a text file.

 libreimport.py and  scrobble.py - Used for importing your tracks from a text file (created with lastexport.py) to libre.fm or any other service using GNU FM software.

Using lastexport

First go to the folder where you saved lastexport:

cd /path/to/lastexport/

If the script isnt already executable, you might want to run:

chmod +x lastexport.py

To export all your tracks from last.fm, run:

./lastexport.py --user your_lastfm_username

The tracks will be exported to exported_tracks.txt by default, where each line represents a track with the following entries (if they exist), separated by a tab:

date    trackname    artistname    albumname    trackmbid    artistmbid    albummbid

That is usally all you need to know.

Additional options

lastexport.py also recognise the options --page and --outfile.

--page lets you choose which page to start on.

Lets say you have a total of 300 pages of tracks but lastexport fails to download page 123, lastexport will then save the 122 pages you already have and quit.

You can then run lastexport again with:

./lastexport.py -u your_lastfm_username --page 123

And it will continue downloading tracks starting at page 123 and save them in the same file as the other 122 pages of tracks.

--outfile lets you specify a file name where the exported tracks will be saved, instead of the default exported_tracks.txt:

./lastexport.py -u your_lastfm_username --outfile mytracks.txt

Using libreimport

First go to the folder where you saved libreimport.py and scrobble.py:

cd /path/to/libreimport/

If the script isnt already executable, you might want to run:

chmod +x libreimport.py

To import all your tracks to libre.fm, run:

./libreimport.py your_librefm_username exported_tracks.txt

You can also specify which server to upload to with -s.

./libreimport.py -s http://mygnufmserver.com/ your_username