Last.fm Playcount Import (2010-03-28) [MM3/4]

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Psyker7
Posts: 255
Joined: Sat Mar 03, 2007 8:00 am

Re: Last.fm Playcount Import [MM3]

Post by Psyker7 »

Sammy20 wrote:Hey great script.

Just wondering if the getting the Last Played date from last.fm into Mediamonkey is at all possible?
Havn't really had the time to look at this recently. I think I mentioned previously that some people have specifically requested for this *not* to be added :P
It's going to be a bit complicated as last.fm won't actually save the last played date, just the *week* it was last played in, so there will be some guestimation involved.
Owyn wrote:Thanks for the script. I used it to import play counts for a rebuilt database. Only real problem was where last.fm had "auto-corrected" artist names. No real solution, the auto-correct only applies to recent plays, not track history and no way to rename/correct artist names in last.fm.

One word of warning, I had a podcast update (about 70 subscriptions) trigger in the middle of running this script (106 weeks, 35,000 tracks, about 10,000 play counts updated). Both your script and podcast updates are SQL intensive. Resulted in some munged podcast episodes. Recommend turning off podcast updates in options before running the script.

I re-ran the script after reviewing results and correcting some tag info. Updated just the changes. Nice.
Glad to hear it worked for ya :D
Personally I disabled the auto-correct on last.fm - but I'm not sure if it actually affects results or not to be honest - as it doesn't apply to track history, which is what this script looks up.
Funkafonik
Posts: 58
Joined: Fri Feb 13, 2009 12:33 pm

Re: Last.fm Playcount Import [MM3]

Post by Funkafonik »

Psyker7 wrote:
Sammy20 wrote:Hey great script.

Just wondering if the getting the Last Played date from last.fm into Mediamonkey is at all possible?
Havn't really had the time to look at this recently. I think I mentioned previously that some people have specifically requested for this *not* to be added :P
It's going to be a bit complicated as last.fm won't actually save the last played date, just the *week* it was last played in, so there will be some guestimation involved.
The Track History shows the last played date/time of every track you have ever scrobbled on your profile. I know this script uses the weekly charts but if that new feature was to work, it'd have to use the Track History (http://www.last.fm/user/Funkafonik/tracks). I don't know how hard it'd be, but if updating one's complete mp3 library from the Track History would be too long and tedious, maybe to add an option on the mouse right-click menu to only update the last played date/time of selected tracks? Like only updating an album or artist at a time... I think I'd actually prefer it this way, better control than updating a 20k library in one shot.
Psyker7
Posts: 255
Joined: Sat Mar 03, 2007 8:00 am

Re: Last.fm Playcount Import [MM3]

Post by Psyker7 »

Funkafonik wrote:
Psyker7 wrote:
Sammy20 wrote:Hey great script.

Just wondering if the getting the Last Played date from last.fm into Mediamonkey is at all possible?
Havn't really had the time to look at this recently. I think I mentioned previously that some people have specifically requested for this *not* to be added :P
It's going to be a bit complicated as last.fm won't actually save the last played date, just the *week* it was last played in, so there will be some guestimation involved.
The Track History shows the last played date/time of every track you have ever scrobbled on your profile. I know this script uses the weekly charts but if that new feature was to work, it'd have to use the Track History (http://www.last.fm/user/Funkafonik/tracks). I don't know how hard it'd be, but if updating one's complete mp3 library from the Track History would be too long and tedious, maybe to add an option on the mouse right-click menu to only update the last played date/time of selected tracks? Like only updating an album or artist at a time... I think I'd actually prefer it this way, better control than updating a 20k library in one shot.
The time consuming bit here would actually be the xml downloading.... downloading your entire play history from last.fm is going to take a VERY LONG TIME :P

Actually... and this is odd, the API doesn't seem to have a way to pull down the entire play history anyway, only the weekly playcounts (which is what I use already)
Psyker7
Posts: 255
Joined: Sat Mar 03, 2007 8:00 am

Re: Last.fm Playcount Import [MM3]

Post by Psyker7 »

Well, you all asked for it:

' Changes: 2.0
' - Added support for updating last played times - these will be up to a week out though

It will prompt you with an ugly window to update lastplayed times as well (yes/no)
Seems to work OK for my database, will only update if the timestamp it finds from last.fm is newer than the existing one, and has to assume that tracks where played at 12am on the first day of the week (limitation of the last.fm API)

Let me know how it goes! I'll take a look into getting a better Confirmation box, I havn't really done much in the way of GUI programming.

Download:
http://psykar.com/scripts/LastFmImport.mmip
treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Re: Last.fm Playcount Import [MM3]

Post by treponem »

I'm getting also errors here,the script stops at week #86.
It says: "You have an error: Ein XML-Dokument muss ein Element der obersten Ebene enthalten." (a xml-document must have a top level element).

The problem seems to be this url:

http://ws.audioscrobbler.com/2.0/?metho ... 1226232000

Is this a problem from last.fm? Can I fix it?
Last edited by treponem on Thu Jul 16, 2009 3:43 pm, edited 1 time in total.
hhggrr
Posts: 15
Joined: Thu Aug 24, 2006 5:33 pm
Location: Honduras
Contact:

Re: Last.fm Playcount Import [MM3]

Post by hhggrr »

Getting the same error "XML document must have a top level element"
bbuchi
Posts: 58
Joined: Mon Jan 16, 2006 4:12 am
Location: Germany

Re: Last.fm Playcount Import [MM3]

Post by bbuchi »

works fine by me.

thanks Bernd

(XP, SP3, MM3.1)
Image
Psyker7
Posts: 255
Joined: Sat Mar 03, 2007 8:00 am

Re: Last.fm Playcount Import [MM3]

Post by Psyker7 »

treponem wrote:I'm getting also errors here,the script stops at week #86.
It says: "You have an error: Ein XML-Dokument muss ein Element der obersten Ebene enthalten." (a xml-document must have a top level element).

The problem seems to be this url:

http://ws.audioscrobbler.com/2.0/?metho ... 1226232000

Is this a problem from last.fm? Can I fix it?
Seems as though this page now loads correctly, try again and let me know :)

I would really hate having to code around this one... you would lose a weeks worth of data for every page which doesn't load.
treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Re: Last.fm Playcount Import [MM3]

Post by treponem »

Thanks Psyker7, the page loaded and the script did the work perfectly. :D
Jos

Re: Last.fm Playcount Import [MM3]

Post by Jos »

I'm also getting this "a xml-document must have a top level element" error. The problem is with week #26, the script worked perfect until now.
My last.fm username is: josvleeuwen

Is it fixable?

I really hope so, I completely depend on this script to generate my playlists.
Desertway
Posts: 42
Joined: Fri Sep 18, 2009 2:22 pm

Re: Last.fm Playcount Import [MM3]

Post by Desertway »

Thanks so much for this script. I have a new MM library, but a well used last.fm account. Using this script plus AutoRateAccurate let me jump right into the game instead of starting from "0". It also allows me to keep my home and work playcounts and ratings in sync. Grazi!
thegoldenvision
Posts: 20
Joined: Tue Mar 11, 2008 5:31 am

Re: Last.fm Playcount Import [MM3]

Post by thegoldenvision »

There seems to be an issue with the script importing duplicate playcount. I have recently rebuilt my library and used the script to import the playcounts from my Last.fm account, however, some tracks have a duplicate playcount against them if they appear on multiple albums in the library.
Example:
Foo Fighters - Monkey Wrench appears in the library on the albums The Singles (1995-2008) and The Colour and The Shape. The script has issued a playcount of 109 and a last played date of 16/08/2009 to both tracks.
Psyker7
Posts: 255
Joined: Sat Mar 03, 2007 8:00 am

Re: Last.fm Playcount Import [MM3]

Post by Psyker7 »

Jos wrote:I'm also getting this "a xml-document must have a top level element" error. The problem is with week #26, the script worked perfect until now.
My last.fm username is: josvleeuwen

Is it fixable?

I really hope so, I completely depend on this script to generate my playlists.
Again this looks like it was a last.fm error, try again now!
thegoldenvision wrote:There seems to be an issue with the script importing duplicate playcount. I have recently rebuilt my library and used the script to import the playcounts from my Last.fm account, however, some tracks have a duplicate playcount against them if they appear on multiple albums in the library.
Example:
Foo Fighters - Monkey Wrench appears in the library on the albums The Singles (1995-2008) and The Colour and The Shape. The script has issued a playcount of 109 and a last played date of 16/08/2009 to both tracks.
Unfortunately there is no easy way around this. I figured it was better to update tracks from all albums rather than none. Last.fm's feeds don't display which album an individual track you played was from, rather something like this:

Code: Select all

<track rank="1">
<artist mbid="ad61e25e-5516-41e1-b60d-744e8220986e">Shiny Toy Guns</artist>
<name>Ghost Town</name>
<mbid/>
<playcount>3</playcount>
<url>www.last.fm/music/Shiny+Toy+Guns/_/Ghost+Town</url>
</track>
Funkafonik
Posts: 58
Joined: Fri Feb 13, 2009 12:33 pm

Re: Last.fm Playcount Import [MM3]

Post by Funkafonik »

I've just noticed that in the last update on Last.FM, they have updated their API to add "user.getRecentTracks", allowing to fetch all our listening history to the same level of detail as is available on our profile.

http://www.last.fm/api/show?service=278

This would make this script more precise for the Last Played dates and also playcounts, since the weekly charts don't update if you delete some tracks from your history afterwards.
Psyker7
Posts: 255
Joined: Sat Mar 03, 2007 8:00 am

Re: Last.fm Playcount Import [MM3]

Post by Psyker7 »

Great spotting!
I'll get onto this tonight sometime, shouldn't be too difficult.
Post Reply