Last FM plays import script
#1
Not sure if anyone cares about this... but I thought I might as well post this just in case.
I've been on a mission for a while to make my Kodi music DB more cloud based with the track and album ratings script I previously posted. The next task was to write something that imported my Last.fm play data into Kodi.
I've been using Last.fm for over 10 years now and have a personal history of about 15,000 plays. I wanted to get this synced up with my music DB after I wiped it accidentally during testing.
These instructions are not for normal users, but someone with better Pyton skills than me (its my first attempt) can probably make an Add-on that works more integrated.

Step 1 - export your last.fm music history
I used this site to create a csv of all my plays https://benjaminbenben.com/lastfm-to-csv/

Step 2 - Edit the CSV
We need to add headers to the CSV file, I just added a new text line at the top with 
Code:
Artist,Album,Title,DatePlayed

Step 3 - Import into a sqlite db
I then used db browser for sqlite to import the csv into a database.
Save the DB created as lastfm.db and copy it into a folder called "c:\script\databases"

Step 4 - grab your kodi db
I just copied my raw kodi music database to the same folder as above. in this case its MyMusic72.db

Step 5 - run the python script
Copy the python code into a new file called something like "last_fm_import.py" into "c:\script"
Assuming you have a python 2.x environment setup the script should match songs and update the mymusic72 with all your last.fm plays.
https://gist.github.com/zag2me/9b8625100...bc1c580b50

Step 6 - copy back the kodi music db
Simply copy the database back to kodi userdata folder.

The end result is 10 years of song play history in my Kodi Smile

Image
Reply


Messages In This Thread
Last FM plays import script - by docwra - 2018-09-28, 23:08
RE: Last FM plays import script - by meowmoo - 2018-09-30, 11:00
RE: Last FM plays import script - by docwra - 2018-10-01, 10:22
RE: Last FM plays import script - by meowmoo - 2018-10-07, 18:04
RE: Last FM plays import script - by docwra - 2018-10-07, 19:41
RE: Last FM plays import script - by meowmoo - 2018-10-07, 19:50
RE: Last FM plays import script - by docwra - 2018-10-07, 21:12
RE: Last FM plays import script - by meowmoo - 2018-10-07, 23:53
RE: Last FM plays import script - by meowmoo - 2018-10-10, 22:07
RE: Last FM plays import script - by docwra - 2018-10-10, 22:08
RE: Last FM plays import script - by whoozwah - 2019-01-07, 00:12
RE: Last FM plays import script - by meowmoo - 2018-10-11, 09:59
RE: Last FM plays import script - by docwra - 2019-01-07, 12:11
RE: Last FM plays import script - by xbozzo - 2019-07-29, 04:37
RE: Last FM plays import script - by Karellen - 2019-07-29, 05:13
RE: Last FM plays import script - by xbozzo - 2019-07-29, 11:11
RE: Last FM plays import script - by xbozzo - 2019-07-29, 14:04
RE: Last FM plays import script - by xbozzo - 2019-07-29, 14:19
RE: Last FM plays import script - by xbozzo - 2019-07-29, 14:33
RE: Last FM plays import script - by dm21912 - 2019-11-29, 04:47
RE: Last FM plays import script - by docwra - 2019-07-29, 22:58
RE: Last FM plays import script - by xbozzo - 2019-07-30, 02:23
RE: Last FM plays import script - by dubwat - 2019-10-23, 14:46
RE: Last FM plays import script - by docwra - 2019-10-23, 15:13
RE: Last FM plays import script - by dubwat - 2019-11-26, 20:39
RE: Last FM plays import script - by meowmoo - 2019-11-28, 12:57
RE: Last FM plays import script - by TimeZone - 2021-10-09, 11:21
Logout Mark Read Team Forum Stats Members Help
Last FM plays import script1