How to use the lastexport and libreimport scripts to create a dump of your last.fm tracks and importing them to libre.fm
The scripts are hosted on gitorious.org, access the repository through this link or use the direct links to the scripts below.
lastexport.py - Used for exporting your listening history (also loved/banned tracks) from last.fm or libre.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.
libreimport2.py - Used for importing loved/banned tracks to libre.fm or any other service using GNU FM software
You will need to verify that your track history and real-time listening data are both publicly available in your Last.fm Privacy Settings
First go to the folder where you saved lastexport.py:
If the script isn't 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 usually all you need to know.
lastexport.py also recognizes the options --page, --outfile and --server.
--page lets you choose which page to start on.
Let's say you have a total of 300 pages of tracks but lastexport.py fails to download page 123, lastexport.py will then save the 122 pages you already have and quit.
You can then run lastexport.py 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
--server lets you specify which server to export track info from, last.fm is the default but you can also export from libre.fm or any other gnu.fm server.
./lastexport -u your_librefm_username -s libre.fm
./lastexport -u your_gnufm_username -s myowngnufmserver.net
--type lets you specify which type of data you want to export, scrobbles is the default but you can also export loved or banned tracks.
./lastexport.py -u your_librefm_username -s librefm -t loved -o mylovedtracks.txt
First go to the folder where you saved libreimport.py and scrobble.py:
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
First go to the folder where you saved libreimport2.py:
chmod +x libreimport2.py
To import your loved tracks to libre.fm, run:
./libreimport2.py -u your_librefm_username -t loved -f mylovedtracks.txt
or for banned tracks:
./libreimport2.py -u your_librefm_username -t banned -f mybannedtracks.txt
You will be prompted for your libre.fm password and the tracks will then get uploaded.
By default it will import your tracks to libre.fm but you can specify another server to upload to with -s mygnufmserver or --server=mygnufmserver
git.gnu.io is graciously hosted by the Free Software Foundation. https://donate.fsf.org