I Have Successfully Merged Last.fm Accounts – Here is a HOWTO

March 8, 2012

by — Posted in Personal Writing

I managed to do more work importing Last.fm data.  Earlier I posted how nothing was working.  I mentioned how there is no method to do this.  I also mentioned how some of the migration methods available.  Well below are the instructions on how to actually accomplish this. Dealing with the methods listed online, these were the only steps I found to merge two or more last.fm accounts.

There is come caveats.   I was not able to get all of my tracks down from the server.   Most of this is because of bad metadata.  Out of the my 23k submitted tracks I only managed to get about 20k of them downloaded.   In the re-upload I lost another 6k.

The reason for the loss is two-fold.  I think the script has an issue with Kanji characters and skips them.   This removed a few video game sound tracks from my track count.   Other scripts I have found just died when they reached the bad metadata.   Since this is the most data I can get, it is better than nothing.

You will also lose the last play time. If this is important to you then I can’t help you. Last.fm will not accept tracks with a play date of older than fourteen days. The API does not have a way around that restriction that I have seen. I did find a post that mentioned someone created a script that would rescrobble all of your old music and submit it in a manner that new accounts are able to perform, but he never released public.

Let’s move to how to do this (as a side, I performed this on OSX – but this should easily work on Linux or Windows):

Requirements:

  • A last.fm account
  • Python installed
  • Qtscrob
  • A spreadsheet package
  • A text editor

 

1.  Go and download the lastexport.py script from this page

2. Run the command “python ./lastexport.py –user USERNAME”  and replace USERNAME with your account (or any other account) you want to export.

3.  When the script completes it will create a file named exported_tracks.txt, rename the extension to .csv so you can easily open it your spreadsheet.   This file is tab-delimited.

4.  You should now have a spread sheet opened with all the data nicely arranged in columns.   The first column is the timestamp.   The second column is the track name. The third column is the artist name.  The fourth column is the album name.  The fifth column is the Musicbrainz artist ID.  The last Column is the Musicbrainz song ID.


You will now need to rearrange these columns to the following order:

 
 - artist name
 - album name (optional)
 - track name
 - track position on album (optional)
 - song duration in seconds
 - rating (L if listened at least 50% or S if skipped)
 - unix timestamp when song started playing
 - MusicBrainz Track ID (optional)


For the track position column I just auto-filled 1’s in all the cells down the sheet.  For the song duration column I filled in 180 (3 minutes) in all the cells down the sheet.   For the rating columns I filled in L in all the cells down the sheet.

The Unix timestamp is a tricky one.If any tracks on your list are older than fourteen days old you will need to change the time stamp or last.fm will ignore those submissions.

Previously I had a friend generate a list of Unix times 180 seconds apart.  I copied this in, but realized my 20k tracks took the time back older than fourteen days.   I took the latest 2k times and just copy and pasted those 10 times down the list.   To find the latest Unix time and understand the time stamps go to this site.

At this point you should have all the columns filled out in the correct order to create a .scrobbler.log file.   The website everyone points to for the .scrobbler.log file format details seems to be down when I was doing this.  Here is a link to the page in the Internet Archive.

I do have a theory with this method that all the tracks can have the same time stamp.   One of the earlier methods I tried did not allow that, so if you don’t want to figure out a bunch of random time stamps it is something you can test with. The difference in this article is how QTscrob is going to submit these tracks compared to how Libre.fm did in my other article.

5.  Select all the data in the spreadsheet and copy and past it straight into a text editor.   You are going to add the following lines to the very top of the new file you created:

 #AUDIOSCROBBLER/1.0
 #TZ/UTC
 #CLIENT/Rockbox h3xx 1.1

These lines are required for the file to be recognized as a .scrobbler.log file.

6. You can now save the file. You must choose a Unix format or a format that will add hard breaks at the end of each line. I believe this is what caused the file to fail on me earlier. If you editor allows it (mine did not) you can save the file name as .scrobbler.log (remember the “.” at the beginning of the file name.

7. If your text editor did not allow to save the file name as .scrobbler.log you must rename your file to this at the command line or terminal level.

8. Start up QTscrob and select open .scrobbler.log. Browse to the directory where the file is. It is only looking for the containing directory so you will not be opening the file name directly.

9. At this point (if you have done everything correctly and I’m not going to troubleshoot files if you did not) you should see a list of tracks in the QTscrob interface. If everything looks good just click submit.  This may take a few minutes depending on how many tracks you have.

In theory someone could easily change the lastexport.py script so that it directly creates the .scrobbler.log file.   If you are interested in doing this, you would have to change the field order, add the extra columns, and the header in the manner described in steps four and five.

At different points I have spent days trying to find a good way to do this.  With the bad metadata most archiving scripts just failed on me, so I’m quite happy with the lastexport.py script.

I couldn’t find a single place online that told you directly how to make a .scrobbler.log manually.   All the sites seemed to assumed that you must only be using software to do this and the programmers would only look at the file specifications.   I could not even find an example file to compare to.   If the Internet Archive had not mirrored the site with the file specifications I never would have gotten this far.

If this post has been useful to you, just please drop a note and let me know.

23 thoughts on “I Have Successfully Merged Last.fm Accounts – Here is a HOWTO

  1. i have tried your way but it doesn’t work for me. Can you post an example of your .scrobbler.log for me?

  2. do you think you can do this for me? i had someone do it for me but it didn’t work out. ): email me at tightens[@]gmail.com. thanks!

  3. When I get into the excel file, it is not sorted into nice columns, but instead all of the information is in one column (on multiple rows). ( http://i.imgur.com/lnLG7.png )

    Example of A1:

    1343010783 Party Til The Day Comes TOM PEPE CupaTea 72999da9-2ff4-4502-838f-498fa2ffb374 df4729ca-0809-42cd-9c2b-138322af2bfb 1ad80d74-c3b1-4ee9-bed7-

    All of that is in the first row and column.

    If you have any ideas, please help! Thank you!.

  4. Thanks for the quick reply. Sorry I don’t know very much about excel, but I now I got it to open (thanks). However, when I am sorting the columns, I have 7 columns instead of just six ( http://i.imgur.com/jjLkA.png (column G)).

    –Also
    I looked at the Unix timestamp conversion site that you linked, but I’m really new to all of this and I’m not sure how to use it. I have 14937 plays, does this mean that I would have to individually input each mon:day:year:hr:min:sec in that website for each track?

    Sorry for all these questions, I wish last.fm made it possible to change usernames. Thanks for all your effort in finding out how to do this and it’s awesome that you shared your discovery.

  5. I was trying to figure out how to do this for 2-3 years.  Once I finally cracked it for myself it wouldn’t be fair to keep it to myself.  

    First off – make sure you insert the blank columns I have listed in the article otherwise it won’t work.    I’m not typing the exact information – but you can do lookups on the musicbrainz database – http://musicbrainz.org/doc/MusicBrainz_DatabaseCopying and pasting the lookup into the Musicbrainz database should tell you what it is.   It’s possible they updated the script I used and it might be the added the Musicbrainz album ID.   You have two choices. You can either just delete the column.  You search the musicbrainz director to make sure your other columns are in the correct order and try to narrow down if it is a musicbrainz ID by throwing the number into every possible search parameter they have. 

  6. Thanks a lot, again. I think I’m starting to understand the correct format.
    This is what I have so far:
    http://i.imgur.com/ZZFZi.png

    I’m just having issues with the Unix Timestamp, and I’m not sure at all how to continue. I looked at the website you provided, but I don’t really understand what to input. If you could help me out, that would be great.

    -Also quick question, for the time (180), would it be better to put it as 30 seconds so you could scrobble more that way? I think (not sure) that the minimum time needed to record to last.fm is 30 seconds.

    Thanks

  7. Ahh – Unix time.   It’s a pain in the ass.  So for some examples. 

    On July 4, 2012 at 12:00PM the unix time was 1341403200  so if you wanted the time on July 4, 2012 at 11:58AM you would subtract 120 – so unix time would be 1341403080.  

    This is the point where you take todays time at noon July, 24 2012 – 1343131200 and subtract 30 (if you think it will take 30 second songs) and work backwards as many times as you need.  Each time you subtract one from that number you are one second earlier from noon today. 

    I don’t have a good method for generating the number lists, that’s why I bothered a friend.   Anyone with a basic level of programming knowledge should be able to generate the list (I am not a programmer unfortunately). 

  8. Thank you for this! I just did it on OS X (10.8) without any hassle, and now have the 30,000 scrobbles from my earlier account into the new one.

  9. hi,

    this is freaking amazing, it’s been years that i’m looking for a efficient workaround to the no-change-username on last.fm. however, what do you think about creating a new github repo and develop the colum-order and tidying-up functionalities in python? it could be superuseful if the generated output would be ready for the import as it is.

    let me know!

  10. I downloaded python and typed in the command but nothing happens. Where do I need to save the lastexport.py script for it to work. I’m on Windows.

  11. Thanks for this, it didn’t work for me (the step of importing the scrobbler.log file), however it put me on the direction to a step that did work!

    I followed your guide to create the log file, and then used this website to post it to my account: http://scroblr.net/

    Something I found as well – it appears there is a 2,800 track per day limit, so I had to have a timestamp for a different day every 2,800 tracks. I did it every 2,500 tracks just to be safe, and it carried across my entire 20.5k library :)

  12. it is worth noting that this does not work out of the box with any Python version greater than 2.7.4. Hopefully that saves someone else some time.

    just installed python-2.7.4 and now the lastexport.py script is cranking away!

  13. you think you could help me with that? Everytime i type in the command i get invalid syntax

  14. This did not work. QTScrobbler sent 3000 songs but only about 50 ended up in the last.fm account. Ran it multiple times, but the same thing kept occurring.

  15. Hi, friends. I have rewrite this python script, so it generates correct .scrobbler.log file. But.. when I trying to import it to my account, instead full list i see part of it. (e.g. from 900 scrobbled tracks 290 has imported). I think it depends of Unix Timestamps. I have used transparent algorithm. Now timestamp (1391507344558) – track length (18000) -> result Timestmp (1391507326558).

    Who can describe me, why it happens? When this script will work as it should, i’ll share it.

  16. The unix time I had was 180 seconds apart AND I had multiple songs with the same time stamp. All the songs have to have been played within 14 days (hence why I had to use the same timestamp multiple times).

  17. Yea, thanks. Looks like my issue happened because I have used brand new account to merge in. But, when I tried this on old account – all looks fine.
    I have shared this script here https://github.com/leukhin/lastexport . Unfortunately still have no time to write up manual and test it enough.

    You can try it on your own risk.

  18. when I enter the first command line with my username it says “user name not specified?” help?? x

Leave a Reply