focus for this week: aspects of neuroscience
(popular pages, total: 2,361, >2 mio views)

Export and reimport Last.fm data

From I ask questions
Jump to: navigation, search

Here you find some ways to:

  • export your last.fm scrobbles
    • for ca. 1500-1700 tracks it takes 1 min
  • the import section: shows a method to import your scrobbles back to last.fm
    • in 1 min ca. 1320 tracks imported to libre.fm


Contents



backup

You want to backup your data from last.fm? Then I'd recommend the script by libre.fm


lastexport.py by the libre.fm team

Libre.fm logo.png


my last.fm library
(pages)
pages shown in
python script
my total plays
on last.fm
size of exported file time to export
1050 52k plays 4.4 MB
2054 102k plays
(28333 unique songs
with 12525 artists in total)
8.5 MB
729 2280 113k plays
(30450 unique songs
with 13111 artists in total)
9.4 MB 66 mins
(ca. 1700 tracks in 1 min)
761 2370 118k plays
(31540 unique songs
with 13683 artists in total)
10.5 MB 77 mins
(ca. 1539 tracks in 1 min)
806 2599 129.9k plays
(35194 unique songs
with 13683 artists in total)
11.2 MB 108 mins
(ca. 1202 tracks in 1 min)
989 3118 155.8k plays
(41703 unique songs
with 16154 artists in total)
15.6 MB 132 mins
(ca 1181 tracks in 1 min)
  • the command to export is like this (adapt to your last.fm username):
python ./lastexport.py --user Erkan-Yilmaz

notes

  • in case export stops in between:
    • a. this command lets you restart the export at e.g. page 400 into file output2.txt (adapt to your username please):
python ./lastexport.py -u Erkan-Yilmaz --outfile output2.txt --page 400

  • b. if you want to use import from below: you can concentate the output files with:
    • copy (for Windows)
    • cat (for Linux)
  • the exported file contains:
    • date trackname artistname albumname trackmbid artistmbid albummbid
  • time to export
    • varies depending on your internet connection
    • in the case with the 66 mins (for 2280 pages):
      • after 34 mins: 1010 pages were processed
  • last.fm library: refers to the python script's counting
    • e.g. for the case with 2280 pages above:
      • my last.fm account showed 729 library pages (each containing 18 artists)

last.fm Data Collector

for 139 library pages (ca. 2500 artists) I got a 5.3 MB xml file with:
perl lfmCOL.pl -xmlfile=Erkan.xml method=library.getTracks user=Erkan-Yilmaz

perceived problems:

a. missing packages at first start:
Can't locate XML/Simple.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at lfmCOL.pl line 52.
BEGIN failed--compilation aborted at lfmCOL.pl line 52.

solvable with: perl -MCPAN -e 'install XML::Simple'

b. not complete library exported (?)
atm I have 144 pages, but the tool just read 139
I guess this may be due to a database not being yet synced? must check


test system:
lfmCOL.pl - Generic last.fm Data Collector (last.fm -> xml), Rel. 0.4.0 - 2010-02-10
Debian 5.0.5 (lenny64)
perl 5.10.0


Last.fm library export

+: online
-: only artist names

other tools

see last.fm forum Request: Library Export Feature

reimport your data to Last.fm

With this way:

  • you have your data also backup'd on libre.fm
  • (though personally I also run my own libre.fm server + backup there as well)

Howto

a. make an account at libre.fm
b. activate in options of the libre.fm website (menu Edit > "Connections to other services") your last.fm account
c. say yes to "Forward Scrobbles?"
d. now import the scrobbles to libre.fm which sends them to your last.fm account
e.g. with this command for your username (more info here):
python ./libreimport.py Erkan_Yilmaz exported_tracks.txt
e. though this bug was fixed, I've had similar bugs which increased the playcount different than originally :-(


Did this help you? Write a "thank you" here :-)

How long does this take?

import to libre.fm: in 1 min ca. 1320 tracks

This depends on:

  • your internet connection
  • if you have already imported to libre.fm (then it may be slower for tracks already there, since the operation needs to do more operations)
    • it took 53 mins to import 70k tracks to libre.fm - which I had already imported there (tracks: #34748 - #104715)
  • of course libre.fm has to forward to last.fm: time for that will come soon

see also

external

internal wiki


Personal tools