Hydrogenaudio Forums

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: MordredKLB on 2018-01-03 20:16:39

Title: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2018-01-03 20:16:39
Note: Do NOT uninstall foo_playcount! This component does not replicate all that component's functionality, and actually performs better if foo_playcount is also installed.

I wrote a little component to record the timestamp of every play of every song (after the component was installed). This component provides many new fields to expose this data including play counts, and played times. Some of these fields return JSON formatted data, and therefore are best consumed in a JScript or Spidermonkey panel.

v2.0.0 released and Last.fm support is here!

New fields provided:

To retrieve last.fm scrobbles correctly, head to the component properties page and enter your last.fm username. No authentication is required. Last.fm interaction is fairly complex, there is detailed help on the configuration page and more descriptions in this thread if you need them.

Unfortunately, there's no way to write a component that honors the $meta_num/$meta(prop, index) standard (because it's not a meta field) so to maximize use of this component you will really need to have a JScript/WSH panel where you can actually loop through the JSON arrays and do fancy things. IMO, %played_times_js% and %lastfm_played_times_is by far the most useful because you can actually do stuff with it, i.e. after retrieving the value, looping through and calling new Date() on it. Will add some example code for that.

Note: If you have foo_playcount installed already, then the first time the song is played after adding this component, it will also append the %first_played% and %last_played% values to the array. Sorry if you've already played a song 68 other times, there's no way of knowing when those times were. Edit: If you were scrobbling those songs, now there is!

Note: If you have a version installed prior to v.1.0.2, you will have to manually delete it from your components folder! The filename has changed from foo_enhanced_playback_statistics to foo_enhanced_playcount. Foobar will fail to launch if both are installed at the same time. Please delete the entire foo_enhanced_playback_statistics folder.

Latest version can be obtained from the official component registry (http://www.foobar2000.org/components/view/foo_enhanced_playcount).
Title: Re: foo_enhanced_playcount - Record every time a song plays (JScript/WSH)
Post by: MordredKLB on 2018-01-03 20:59:23
You can use any of the fields exposed by this plugin without using JScript Panel, however any of the date lists (%played_times%, %lastfm_played_times_js%, etc.) will be mostly useless unless you're using JScript panel as there's no way to iterate over values in title formatting expression.

How to consume the date lists in a JScript Panel:
Code: [Select]
var raw = fb.TitleFormat('[%played_times_js%]').Eval();
var playedTimes = [];
try {
playedTimes = JSON.parse(raw); // this is required because the value is a string
} catch (e) {
fb.trace('<<< ERROR parsing JSON >>>');  // you probably don't need this try/catch, but it was helpful in my debugging
}
for (i=0; i < playedTimes.length; i++) {
var p = new Date(playedTimes[i]);
// do something with this value
}

Just as an example of what you can do, I'm taking the individual play times and plotting them on a song "lifecycle" timeline where it starts at the date the song was added, and runs to the present. I calculate each play's "age" by subtracting it from the current time (new Date() ), and then use the ratio of age / added to determine where to draw the line.

In your theme you might want to display a playcount using either the highest value between %play_count% and %lastfm_play_count%. That can be done with:
Code: [Select]
$max(%play_count%,%lastfm_play_count%)

For the record, you can convert a Foobar string timestamp ("2018-01-04 00:36:15") into a string you can pass into new Date() by doing the following:
Code: [Select]
var added = fb.TitleFormat('%added%').Eval().replace(' ','T');
Title: Re: foo_enhanced_playcount - Record every time a song plays (JScript/WSH)
Post by: MordredKLB on 2018-01-04 07:04:47
CHANGELOG
v3.0.7 - 2019-01-25

v3.0.6 - 2019-01-10

v3.0.4 - 2018-09-03

v3.0.2 - 2018-08-07

v3.0.1 - 2018-05-23

v3.0.0 - 2018-05-11

v2.5.1 - 2018-04-16

v2.1.1 - 2018-04-11

v2.1.0 - 2018-04-07

v2.0.4 - 2018-03-27
 - Fixed issue where if "Compare Album fields" was unchecked but the album field was missing in the file tag, the component was not pulling scrobbles.

v2.0.3 - 2018-03-01
 - Fixed crash in foobar if artist/album/title tags were missing from media and checking scrobbles.

v2.0.2 - 2018-02-24
 - Add "compare album fields" option in preferences. Disabling this will not consider album titles when checking scrobbles.

v2.0.0
 - Now retrieving scrobbles from last.fm
 - Right click-menu options
 - New preferences page

v1.0.2
 - Changed name to foo_enhanced_playcount

v.1.0.1
 - Updated the component so that it returns an empty JSON array if no playtimes have been saved so far.
Title: Re: foo_enhanced_playcount - Record every time a song plays (JScript/WSH)
Post by: MordredKLB on 2018-01-10 18:56:05
So, I know I said I wouldn't query last.fm, but now I'm considering querying last.fm when we're about to record a new play. When saving this data to the component's index db, I plan to remove all plays that the component already knows about. That means this would only record last.fm plays with a timestamp the component didn't record or can't find from %first_played%/%last_played%.

There are some issues with this, namely that last.fm does not differentiate beyond "artist - album - tracktitle" where foo_playcount and this component also use %date% %discnumber% and %tracknumber% to differentiate songs.

For example:
I've played the song "Battery" from the original Master of Puppets release in 1986 five times.
I just got the 10 disc Master of Puppets reissue which came out in 2017. Last.fm will report plays of "Battery" from disc 1 and also the 1986 release.
Even worse, Battery appears 4 other times in different live recordings on the 10 disc reissue. Because my tagging does not separate out all those discs (i.e. for one of the live discs, album is tagged "Master of Puppets" and not "Live at Solnahallen, Stockholm, Sweden - September 26th, 1986") if I play "Battery" from that live disc, it will also count as a play of the song on the 1986 release, which is very obviously wrong.

last.fm does include MBID's for releases and recordings, but in my testing they are very often wildly wrong (when they are even present) and it seems every version of "Battery" will map to the same MBID, regardless of whether they really are different or not.

Is this a limitation people are willing to live with? Does a system that works perfectly 98% of the time, but drastically overcounts plays the other 2% of the time okay? Should last.fm plays be mixed in with the standard calls, or separated from the other plays (i.e. adding a %played_times_lastfm_js% field)?
Title: Re: foo_enhanced_playcount - Record every time a song plays (JScript/WSH)
Post by: loz on 2018-01-10 19:38:28
Is this a limitation people are willing to live with?
Yes. Absolutely. Either in this component or another separate playcount component.

And in case you missed it,Last.fm is planning on revamping their api in the coming months according to the devs posting on the getsatisfaction.com/lastfm board. What that means at this point I couldn't tell you, but hopefully they'll add some new endpoints. Thanks.
Title: Re: foo_enhanced_playcount - Record every time a song plays (JScript/WSH)
Post by: jazzthieve on 2018-01-11 05:15:31
Is this a limitation people are willing to live with? Does a system that works perfectly 98% of the time, but drastically overcounts plays the other 2% of the time okay? Should last.fm plays be mixed in with the standard calls, or separated from the other plays (i.e. adding a %played_times_lastfm_js% field)?

I'd say no. This would be a reason for me to avoid it completely. Most scrobbles on last.fm that are not from the user itself come from either youtube or spotify and spotify in particular is a complete mess with its tagging. The more someone uses other sources to scrobble which they didn't tag themselves the more there will be a disconnection between the "real" plays and the ones reported. What loz is saying about lastfm revamping their api in the coming months should be taken with a serious grain of salt as the site has been in beta since september 2015 and new implementations are moving on with a snail pace (and getting slower).
Title: Re: foo_enhanced_playcount - Record every time a song plays (JScript/WSH)
Post by: MordredKLB on 2018-01-11 08:02:07
I'd say no. This would be a reason for me to avoid it completely. Most scrobbles on last.fm that are not from the user itself come from either youtube or spotify and spotify in particular is a complete mess with its tagging. The more someone uses other sources to scrobble which they didn't tag themselves the more there will be a disconnection between the "real" plays and the ones reported. What loz is saying about lastfm revamping their api in the coming months should be taken with a serious grain of salt as the site has been in beta since september 2015 and new implementations are moving on with a snail pace (and getting slower).
Yeah, I'm not holding my breath on the API changing anytime soon.

You're actually bringing up a second issue. I was only referencing the first where an album with the same song on multiple tracks (live versions/demos etc.) could show up all together (assuming the song isn't tagged differently for whatever reason). That's the overcounting problem.

When you're scrobbling songs you haven't tagged, then there's a possibility it won't show up in the list. I tag using an edition field because I don't want the album title to be "Master of Puppets [2017 Deluxe Remaster]". If Spotify or whoever has that as the album title then when I look for plays with an album exactly matching "Master of Puppets" then it won't show up. That's the undercounting problem and one that I can happily live with. Sorry it didn't count the one time you played it on YT from some guy's sketchy upload.

Now, maybe that truly is a dealbreaker, but you'll easily be able to stop pulling last.fm plays just by not entering in your Username.

That said I think you're pushing me towards having a separate blob in the index_data which would keep last.fm plays from getting intermixed with the foobar recorded plays. Not sure if that means having a checkbox to check when you want it to return last.fm plays in the list as well, or having just another field which will return those and allow the user to dedupe as needed.
Title: Re: foo_enhanced_playcount - Record every time a song plays (JScript/WSH)
Post by: MordredKLB on 2018-01-11 21:30:23
v.1.0.2 release notes
 - File name change from foo_enhanced_playback_statistics to foo_enhanced_playcount
 - In preparation for retrieving last.fm playtimes, js playtimes now return timestamps rounded to the nearest second.

Note: If you have a version installed prior to v.1.0.2, you will have to manually delete it from your components folder! The filename has changed from foo_enhanced_playback_statistics to foo_enhanced_playcount. Foobar will fail to launch if both are installed at the same time. Please delete the entire foo_enhanced_playback_statistics folder.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-02-15 00:13:33
I've spent the last moth hard at work on last.fm support. I'm happy to say that it's finally in a state where I'm comfortable releasing a beta version to the public. This has not been an easy project, mainly because last.fm kind of sucks. Also, if you haven't switched to using foo_scrobble (https://hydrogenaud.io/index.php/topic,114979.25.html) from foo_audioscrobbler, you ought to do that immediately. A note on terminology, I use "plays" to refer to a recorded play (from foobar or last.fm) that the component knows about and "scrobble" to refer to a play in last.fm.

Here's the skinny. New fields:

New functionality:
Two new right-click menu options, "clear saved last-fm plays" and "retrieve last.fm scrobbles." You cannot retrieve scrobbles for more than 50 songs at once. Also, 50 is probably a really bad idea unless they're all from the same artist. More on that in a bit.

There's a new preferences pane with a bunch of complicated preferences on it. The reasons and explanations for these preferences are in nifty tooltips. Read them and ask questions. Last.fm scrobbling will not work unless you first go to preferences and enter your last.fm username.

Now the bad news. Last.fm's values for artist/album/title often suck (particularly if you're using foo_audioscrobbler... seriously switch to foo_scrobble immediately). This component requires exact but case-insensitive matches between all of these fields to know whether to count a scrobble last.fm reports as being one for the current track. If there's the slightest mismatch, it won't be counted. This component currently makes no assumptions or guesses. Example: If you are checking for plays from Kesha, last.fm will return them all with the artist named "Ke$ha". %lastfm_play_count% will always show 0. Sorry. Edit: I no longer compare artist strings as I already queried last.fm with the artist. If album and title don't match you'll still have problems though.

If you tag according to musicbrainz and are using foo_scrobble you should typically have a high rate of success though. I've pulled scrobbles for well over 1000 tracks at this point, and I would say 95% returned values correctly.

Unfortunately, Last.fm is slow. I must query by Artist, and can only pull 200 scrobbles at a time. For the first last.fm check of a song, I will pull up to 1000 scrobbles (5 API calls) and then attempt to match them. For all subsequent calls for songs by that artist the API responses are placed in an LRU cache, meaning they should be essentially instantaneous. By default I store up to 20 API responses, although this number can be increased to 50 in the preferences.

At the moment Last.fm calls are blocking on the UI. Yes, I realize this sucks.

I should also say that processing any of the fields this component provides are probably slower than typical. I have not noticed any issues with this, but you might see odd things happen if you add one or more of these fields to a column and try and display 1000 items. This isn't a use case I've tried, so that's why this is still considered beta.

All feedback welcome.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-02-15 00:23:01
Todo list:
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-02-15 07:11:06
Releasing beta 4. Realized after typing up all that stuff that I have no reason to compare artist with last.fm's artist string. We're querying for artist already, so if last.fm returns results it's got to be for that artist.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-02-18 05:52:12
Beta 5:
These new changes did break the reporting of the amount of memory the cache is consuming. Not sure I can fix it ever, and not sure it really matters that much since we're really only talking about 7.5MBs of memory absolute worst case (50 cached pages, each the max 200 songs for ~150kB each).

This was a pretty substantial change, so please report any issues you find.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-02-23 07:04:59
v2.0.0 has officially been released. See the first post or get it from the components page:
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-02-23 10:45:26
I'm a bit puzzled as to the use of %lastfm_play_count%, is this supposed to display the scrobble count of the song retrieved from last.fm? If yes, under what circumstances would that be the case because I don't seem to notice much consistency in what is shown. At what point is lastfm queried? At the start? When the song gets scrobbled?  I would expect a song that has been played and scrobbled, then restarted to display %lastfm_play_count% as 1 but it doesn't, then again if I replay a song I played and scrobbled from the day before %lastfm_play_count% shows the correct amount of plays.
I also have noticed for example a song which has 1 playcount and one scrobble starts out as 1 displayed local play count and 0 displayed %lastfm_play_count%. It gets scrobbled at the halfway point, local play count increments to 2 and then suddenly %lastfm_play_count% turns from 0 to 2.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Anakunda on 2018-02-23 12:32:02
Hi, if I install foo_enhanced_playcount, should I remove foo_playcount, or do they coexist?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-02-23 13:19:49
foo_playcount really has nothing to do with last.fm.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-02-23 13:38:28
One other question, is it retrieving the scrobble count of artist-title or artist-album-title?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-02-23 17:01:20
Hi, if I install foo_enhanced_playcount, should I remove foo_playcount, or do they coexist?
They coexist. Do NOT remove foo_playcount. It will actually improve your experience with foo_enhanced_playcount (and I don't track %added% or provide %first_played%/%last_played% fields either)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-02-23 17:11:12
I'm a bit puzzled as to the use of %lastfm_play_count%, is this supposed to display the scrobble count of the song retrieved from last.fm? If yes, under what circumstances would that be the case because I don't seem to notice much consistency in what is shown. At what point is lastfm queried? At the start? When the song gets scrobbled?  I would expect a song that has been played and scrobbled, then restarted to display %lastfm_play_count% as 1 but it doesn't, then again if I replay a song I played and scrobbled from the day before %lastfm_play_count% shows the correct amount of plays.
I also have noticed for example a song which has 1 playcount and one scrobble starts out as 1 displayed local play count and 0 displayed %lastfm_play_count%. It gets scrobbled at the halfway point, local play count increments to 2 and then suddenly %lastfm_play_count% turns from 0 to 2.
The component retrieves last.fm plays when foobar marks a song as played, i.e. 60 seconds in. This component does NOT scrobble, and scrobbles happen after a song is played. So, %lastfm_play_count% will always be 1 behind the %play_count% if you don't manually pull scrobbles from the right click menu.

There's an option in the preferences which will attempt to keep %lastfm_play_count% in sync with %play_count% by adding 1 to the total if the last foobar play is later than the last scrobble we have recorded. This +1 only happens if we have at least one scrobble recorded. So the first time you play a song %play_count% goes to 1, we see no scrobbles and leave lastfm_play_count at 0 (because I can't differentiate between never scrobbled and never checked for scrobbles). The 2nd time you play a song, play_count goes to 2, we see 1 scrobble (the previous one because again the current play hasn't scrobbled) and then we add 1 because we assume the song is about to be scrobbled.

I can play around with this logic, or figure out a way to mark whether we've already checked and the song just has zero scrobbles.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-02-23 17:14:15
One other question, is it retrieving the scrobble count of artist-title or artist-album-title?
Artist-album-title, and remember it requires an exact (case-insensitive) match. I can play around with that test if you can show me songs you've scrobbled that aren't showing up. The component logs the last.fm API calls it makes so you can see them yourself and determine where potential mismatches are.

If you're diligent with tagging songs and albums correctly, and you're using foo_scrobble to record scrobbles it works >99% of the time in my experience.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-02-23 17:58:51
Thanks for the explanation. The artist-album-title makes sense and clarifies the play count -vs scrobble discrepancies I was seeing. I was working under the assumption artist-title. It's too bad really it's not artist-title based because spotify with its louzy album naming throws a wrench into making my foobar plays and scrobbles be more in sync.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-02-23 19:02:44
Uploaded v2.0.1 but it was just a version bump so update check could differentiate from the 2.0.0betas.

Thanks for the explanation. The artist-album-title makes sense and clarifies the play count -vs scrobble discrepancies I was seeing. I was working under the assumption artist-title. It's too bad really it's not artist-title based because spotify with its louzy album naming throws a wrench into making my foobar plays and scrobbles be more in sync.
I think I'll add a property in the dialog that would disable album title checking (disabled by default). Would you be cool with that? Would still require exact title match, and I won't change that.
Pros: Your spotify scrobbles would get counted more reliably.
Cons: Every play of a song from a live album, or single, or whatever would all get lumped together into one.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-02-23 19:14:13
Disable album title checking would be great. The con is a non issue to me since I already lump them together anyway.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-02-24 03:10:57
Disable album title checking would be great. The con is a non issue to me since I already lump them together anyway.
Update should pull v2.0.2 with the new setting. Can you go into preferences and verify that the Compare Album setting is checked for you by default? Uncheck it and your problem should be gone. Thanks for the idea!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-02-24 13:11:37
Album settings is indeed checked by default. After unchecking it %lastfm_play_count% is what I'm expecting it to be. Thanks for the update.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: annalise on 2018-02-24 14:22:07
Thank you for this component, it's greatly appreciated! :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: annalise on 2018-03-01 05:06:15
Hi everyone,

Just wanted to see if anyone else was having issues with this component crashing when playing MP4 files (or any other file type).

Thanks!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-03-01 07:59:01
annalise, can you try this version and let me know if it fixes your problem? If so I'll push it to the registry. I didn't have a check to ensure a song had all the required fields needed to retrieve last.fm playcounts. I'm guessing your videos had artist and title set, but probably not album (or something along those lines).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: annalise on 2018-03-02 09:09:04
hiya, everything seems to be good now, no more crash! thanks!

edit: good guess on the artist/title bit!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: vogueblackheart on 2018-03-12 01:49:22
This is awesome. Thanks!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: aloola on 2018-03-15 17:11:37
the %lastfm_play_count% returns incorrect value when you listen to a lot of songs of one artist ? anyone has the same problem ?

one of the song I had the problem with, it only returns ~20 times playcount
https://www.last.fm/user/trungdaibang/library/music/Fear,+and+Loathing+in+Las+Vegas/_/Chase+the+Light!

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-03-19 17:37:26
the %lastfm_play_count% returns incorrect value when you listen to a lot of songs of one artist ? anyone has the same problem ?

one of the song I had the problem with, it only returns ~20 times playcount
https://www.last.fm/user/trungdaibang/library/music/Fear,+and+Loathing+in+Las+Vegas/_/Chase+the+Light!
Yeah, currently the script only queries the last 1000 songs of a given artist (that'd be 5 last.fm requests) to avoid hammering last.fm and getting banned. If you've listened to an artist a lot more than 1000 times (I see 6k+ plays of Fear, and Loathing for you) then it won't get most of them.

If I get around to making the last.fm queries happen in a separate thread I can probably delay them and this won't be a problem. I haven't had much time to work on this lately though.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-03-21 16:21:59
one of the song I had the problem with, it only returns ~20 times playcount
https://www.last.fm/user/trungdaibang/library/music/Fear,+and+Loathing+in+Las+Vegas/_/Chase+the+Light!
Was thinking about this issue this morning and remembered one other thing: you might want to uncheck the setting to "Remove duplicate scrobbles" then clear the saved last.fm plays, and repull. That might give you different results.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Smakaveli on 2018-03-22 07:54:17
This plugin has so much potential!! Unfortunately in my opinion it's too unstable for using it yet. But I'm hoping for further improvements both on the part of the last.fm api and on developing the app.

Kind regards
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-03-23 08:38:34
This plugin has so much potential!! Unfortunately in my opinion it's too unstable for using it yet. But I'm hoping for further improvements both on the part of the last.fm api and on developing the app.
What do you mean by "unstable?" Is it causing crashes? Is something not working correctly? I appreciate the feedback, but you haven't provided me any information on what can be improved.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Smakaveli on 2018-03-23 14:02:35
This plugin has so much potential!! Unfortunately in my opinion it's too unstable for using it yet. But I'm hoping for further improvements both on the part of the last.fm api and on developing the app.
What do you mean by "unstable?" Is it causing crashes? Is something not working correctly? I appreciate the feedback, but you haven't provided me any information on what can be improved.

Hey MordredKLB,
thanks for responding that quickly.

I had it installed for a few days and was very happy with it. It was the perfect app for enhancing my media library, cause I am a data and last.fm addict. I also got along with a not 100% accuracy. Unfortunately foobar began to crash from time to time, resulting in a loss of playback statistics and changes in my media library (everything was lost, since foobar was opened the last time). Dunno what caused this. I had the feeling it depended on the tags of specific songs, I was able to replicate the crash, when I listened to these specific songs. It could be that this was triggered when last.fm autocorrected for example the artist or the song title, but that's just a guess! The crash happened when the last.fm play count was counted +1 (at 1:00min of listening).

Hope this can help.

Greets
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-03-24 03:50:25
I had it installed for a few days and was very happy with it. It was the perfect app for enhancing my media library, cause I am a data and last.fm addict. I also got along with a not 100% accuracy. Unfortunately foobar began to crash from time to time, resulting in a loss of playback statistics and changes in my media library (everything was lost, since foobar was opened the last time). Dunno what caused this. I had the feeling it depended on the tags of specific songs, I was able to replicate the crash, when I listened to these specific songs. It could be that this was triggered when last.fm autocorrected for example the artist or the song title, but that's just a guess! The crash happened when the last.fm play count was counted +1 (at 1:00min of listening).

Hope this can help.

Greets
First of all, you should install foo_jesus. That'll at least help you out when foobar crashes and you won't lose "everything."

Secondly, was it crashing on every song, or just specific ones? Can you upload a sample mp3 here that has that issue? I also might need a copy of the database from the index-data folder (it's named 0C1BD000-43E7-4078-B885-48EE4249DEC2). Really do not want this thing causing any crashes.

BTW, just to double check, you were using v2.0.3 right? That fixed a crash when a file was missing required tags.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Smakaveli on 2018-03-27 09:13:26
My Bad. Actually I'm quite sure, I was using Version 2.02 (the one in the first post). I'm now convinced that those tracks crashed, in which the album tag was completly missing.
After testing it the last couple of days with Version 2.03 there were no crashes at all.

But to me there are 2 more questions.
Songs, in which the tag for album is missing still didn't get the right number, the count stays by 0. But this shouldn't be the case when unselecting "Compare Album field when retrieving scrobbles" shouldn't it? Maybe I miss the point with this option. There are other examples, where this problem occures, can't figure out why though.
Second : In my last.fm beginnings I wasn't that accurate with my tags, especially with the album tags. I had a lot of songs without an indicated album. In some cases
the enhanced play count seems to only count the ones in the beginnings until the point where I filled in the album tag.

e.g. I listened to phil collins - in the air tonight 6 times without an album tag between 2005-2007.
From there on, I was listening to it with the album tag "greatest hits" 27 times.
The enhanced play count retrieved the play count 6.


Is there maybe a way to manually edit the last.fm play count in foobar for those ones which get not the right number in the first place? Can you explain for which songs the issue with the wrong retrieved play count might occur (I'm aware of the issue, which was mentioned in reply #31)?

Thanks and sincere apologies for the inconvenience.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-03-27 17:38:00
Songs, in which the tag for album is missing still didn't get the right number, the count stays by 0. But this shouldn't be the case when unselecting "Compare Album field when retrieving scrobbles" shouldn't it? Maybe I miss the point with this option. There are other examples, where this problem occures, can't figure out why though.
Good catch! I actually was wondering last week if I'd done this, but forgot to check the code. Just uploaded v2.0.4 which should fix this issue. You can update from inside foobar.

Quote
Second : In my last.fm beginnings I wasn't that accurate with my tags, especially with the album tags. I had a lot of songs without an indicated album. In some cases
the enhanced play count seems to only count the ones in the beginnings until the point where I filled in the album tag.

e.g. I listened to phil collins - in the air tonight 6 times without an album tag between 2005-2007.
From there on, I was listening to it with the album tag "greatest hits" 27 times.
The enhanced play count retrieved the play count 6.
So that seems weird. I'm assuming you had the "Compare Album Field" setting checked, yes?

There are two possible scenarios here:
1) Some tab besides just the album tag changed in either the song you are playing, or in the data last.fm is storing for that song. Sometimes last.fm will store very wrong information for the album, which will lead to those scrobbles not being counted (particularly if you're using foo_audioscrobbler).

2) While you were messing with settings, or different versions of the plugin, it recorded scrobbles from back in 2007, but also one recently. After adjusting settings/versions of the plugin, when you attempt to get the list of last.fm scrobbles it stops checking at the most recently recorded scrobble and never picks up the other 27.

To determine if the problem is #2, right click and clear the last.fm scrobbles for that song, and then repull them again. If that fixes the problem, then hooray. If not, can you reply with your last.fm username? I can check the json last.fm is returning and see if I can spot where the mismatch might be.

BTW, thanks for the helpful feedback!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: radecke on 2018-03-30 15:43:05
this is great! I was looking to get my last.fm playback statistics back into foobar and now someone finally made it happen :-)
For now it's just not very accurate. I've been testing it out and got a playcount of 19 in foobar and when I checked on last.fm I listened to that track 45 times. I guess this is the same problem you pointed out earlier, because I have 1900 scrobbles for that artist.

looking forward to the next versions. Thanks for your work!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: radecke on 2018-03-30 15:49:01
would it also be possible to add a feature to scan you whole library for last.fm scrobbles and maybe force the user to get his own api key to not get the plugin banned by last.fm?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-03-30 16:44:30
would it also be possible to add a feature to scan you whole library for last.fm scrobbles and maybe force the user to get his own api key to not get the plugin banned by last.fm?
I don't think an API key would matter. You'd still be doing 1000s of API requests. I have over 3k different artists in my library and 130k scrobbles. For me, with perfect caching that'd require roughly 5k API calls. With rate limiting of 1 a second that'd take almost 90 minutes to run through, which is obviously not ideal... and there'd be no way of knowing what the progress of that was. If you had to restart, or just clicked the button again, it would have to requery every single artist.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Smakaveli on 2018-04-02 10:20:36
Hey,

I was testing version 2.0.4 over the holidays and I must say that nine times out of ten I get discrepancies between the retrieved scrobble and the actual one for my top artists in my charts. The thing is I'm scrobbling since 2005, with 277.000 scrobbles and 7.336 various artists. As You can imagine there a plenty of artists which burst the dubious 2.000 scrobbles (I also noticed discrepancies for artists with less than 2.000 scrobbles, but still with a great amount of scrobbles).

My username on last.fm is also "Smakaveli". If you want to checkout my site for further investigations :)

Besides this the app now runs very stable. The first bug was removed with the latest update, the second bug I mentioned in my latest posting must be coincidence or misinterpretation by me, cause it only happened with songs from these "2k-scrobble-artists" and it seems to have nothing to do with changing the album tag in the past.

Keep up the good work, thanks and regards!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: nikolai4ik on 2018-04-02 17:47:53
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Arthurrr&artist=Wavves&limit=200&format=json&page=1
Found 34 plays in last.fm (since last recorded scrobble) of Tarantula
--> populate
JSB POPULATE: init groups delay = 18 /handleList count=403
--> populate
JSB POPULATE: init groups delay = 14 /handleList count=403


I get this during playback (just found this component). Is it supposed to update my play_count? It just increases by 1 instead of copying the number from last.fm
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-03 17:37:18
(I also noticed discrepancies for artists with less than 2.000 scrobbles, but still with a great amount of scrobbles).
The current limit is actually 1000 scrobbles so it's even worse for you. I'll try and see what I can do, but no promises :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-03 17:44:01
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Arthurrr&artist=Wavves&limit=200&format=json&page=1
Found 34 plays in last.fm (since last recorded scrobble) of Tarantula
--> populate
JSB POPULATE: init groups delay = 18 /handleList count=403
--> populate
JSB POPULATE: init groups delay = 14 /handleList count=403


I get this during playback (just found this component). Is it supposed to update my play_count? It just increases by 1 instead of copying the number from last.fm

For the record those JSB POPULATE lines in the console aren't from my component.

It does not (and cannot) alter %play_count%. It provides an entirely new field %lastfm_play_count% which you can use. I use the following TF code to display play counts:
Code: [Select]
$max(%play_count%,%lastfm_play_count%)

Also, in my jscript theme I use a display a little lastfm logo if %lastfm_play_count% is > 0.

(https://i.imgur.com/tyNowQR.png)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: nikolai4ik on 2018-04-03 19:10:18
For the record those JSB POPULATE lines in the console aren't from my component.

It does not (and cannot) alter %play_count%. It provides an entirely new field %lastfm_play_count% which you can use. I use the following TF code to display play counts:
Code: [Select]
$max(%play_count%,%lastfm_play_count%)

Also, in my jscript theme I use a display a little lastfm logo if %lastfm_play_count% is > 0.

(https://i.imgur.com/tyNowQR.png)
Ah I see, thanks.
I'm also using playback statistics custom (writing to tags), can I make your component write to tags too? foo_playcount is not an option for me.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: al3x on 2018-04-05 01:39:32
Hello! I won't add something useful here, but this foobar component seemed like the absolute solution to salvaging my fading memory and reconstruct my past, and validating my persistent scrobbling for all these years. Thank you, developer, that's a really good thing you're making for us!
Yet... I can't seem to make it work for me. Foobar2000 just crashes as soon as I start it with this component. I figured I should first install Foo_playcount , but that didn't solve it. Should I do something else before installing Foo_enhanced_..? I am running Foobar2000 on Linux (Ubuntu-based, if it matters), with Wine. Hasn't crashed on me before. I'm copy-pasting the crash report I get:
Spoiler (click to show/hide)
Thank you in advance for any help you might be able to give me, anyone.
And, again, thank you developer! :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-05 16:54:50
Hello! I won't add something useful here, but this foobar component seemed like the absolute solution to salvaging my fading memory and reconstruct my past, and validating my persistent scrobbling for all these years. Thank you, developer, that's a really good thing you're making for us!
Yet... I can't seem to make it work for me. Foobar2000 just crashes as soon as I start it with this component. I figured I should first install Foo_playcount , but that didn't solve it. Should I do something else before installing Foo_enhanced_..? I am running Foobar2000 on Linux (Ubuntu-based, if it matters), with Wine. Hasn't crashed on me before. I'm copy-pasting the crash report I get:
Oh man, that sucks. Unfortunately I don't have a Linux box to test this out on. Presumably the same thing happens in OSX under Wine, but I don't have that setup either.

There's no obvious problem here unfortunately:
Code: [Select]
Illegal operation:
Code: C0000005h, flags: 00000000h, address: 03876221h
Access violation, operation: read, address: 00000000h

Call path:
entry=>component_manager::on_app_init
That code is showing that it's crashing inside the component_manager as it's trying to initialize foobar. My guess is that something about how the component is configured it doesn't like. However when I register the component I literally don't do anything other than log to the console that it's registered.

That makes me wonder if you're using the latest version of Foobar? It should work with v1.3.x (the 1.4 SDK is backwards compatible). Might also be worth trying with a 1.4 beta? Have you installed any other components built against 1.4 SDK? jscript_panel is one I know about, but it requires 1.4. Do you need to install any .NET runtimes for WINE to work properly?

Hopefully we can get this working for you, but it might be a challenge :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: al3x on 2018-04-05 18:05:00
That makes me wonder if you're using the latest version of Foobar? It should work with v1.3.x (the 1.4 SDK is backwards compatible). Might also be worth trying with a 1.4 beta?
[...]
Hopefully we can get this working for you, but it might be a challenge :)
Updating foobar from v1.3.17 to v1.4 beta 11 just did the trick! Thankfully, it wasn't a challenge :)
As for .NET runtimes installed, hmm, not sure. I followed the standard procedure using a Wine GUI frontend, Playonlinux, and that offers a preconfigured installation of Foobar2000. But I guess that's not relevant, because it's probably that thing with the SDK's, your first guess.
Thank you for being eager to help me out, and thanks for your component!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-06 04:31:03
Awesome!

Is anyone actually using this component with v1.3 on windows? If it doesn't work anymore, I want to update the component registry to make that clear.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-07 19:56:16
Just uploaded version 2.1.0 to the component registry.

Changelog:
Added three new properties:
%lastfm_added%
%lastfm_first_played%
%lastfm_last_played%

All return a date/time string like "2018-03-04 12:34:56" exactly the same as their counterparts from foo_playcount. If the time doesn't exist, "N/A" is returned, but $if2, or the bracket format ([%lastfm_added%]) will not display the N/A.

%lastfm_added% and %lastfm_first_played% both return the exact same value, but I created both for convenience. If you'd like to use the most recent date between your foobar library and last.fm you can use this TF code:

Code: [Select]
$ifgreater(%lastfm_last_played%,%last_played%,%lastfm_last_played%,%last_played%)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: al3x on 2018-04-07 22:18:18
Just uploaded version 2.1.0 to the component registry.

Changelog:
Added three new properties:
%lastfm_added%
%lastfm_first_played%
%lastfm_last_played%
Thank you!!! The time I first listened to the songs is the most important information for me.
One question, and apologies if the answer exists already, but I'm not very tech-savvy and I didn't get much of what you describe on the first page that your component does:
is this data stored somewhere locally, in a database or so,
or is the component requesting this information from Last.fm every time it is asked by foobar2000?
In other words, can I retrieve this information (gradually - I got that it can't be done at one go) for all my files permanently?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-08 17:52:00
Thank you!!! The time I first listened to the songs is the most important information for me.
One question, and apologies if the answer exists already, but I'm not very tech-savvy and I didn't get much of what you describe on the first page that your component does:
is this data stored somewhere locally, in a database or so,
or is the component requesting this information from Last.fm every time it is asked by foobar2000?
In other words, can I retrieve this information (gradually - I got that it can't be done at one go) for all my files permanently?
Yes. The information is stored in a database inside the index-data folder. It will persist even if you delete your last.fm account (so long as you don't delete the database or clear the records for those files).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Zaidel on 2018-04-08 21:53:02
So first of all, thanks for the awesome plugin! I've been using it only for a little while but it works great!
I was wondering if it would be possible to add another field to display the total number of plays an album has according to LastFM (the number of scrobbles on the album page), or if that would be too complicated.
I've been trying to display the total number of plays every album has under each album using Facets and your plugin but the way Facets works it creates separate entries of the same album for every track with a different number of plays.

If this is already doable somehow please feel free to enlighten me.
Cheers!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-04-09 04:20:31
Hi.

I have a little problem with my username in last.fm and your plugin.

My username is "lovecraft_last" and when I used "Get last.fm scrobbles" the terminal said:

Code: [Select]
http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=lovecraft%255flast&artist=David+Lee+Roth&limit=200&format=json&page=1
Found 0 plays in last.fm (since last recorded scrobble) of Yankee Rose

When I put this link in the web browser it say:

Code: [Select]
error	6
message "User not found"
links []

As you can see the component change the "_" of my username for "%255f".

If I change "%255f" for "_" in the link http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=lovecraft_last&artist=David+Lee+Roth&limit=200&format=json&page=1 I get the correct data for the song:

Code: [Select]
	
artisttracks
track
0
artist
#text "David Lee Roth"
mbid "802d37d5-0aaa-492e-b366-99f75e5a196f"
name "I'm Easy"
streamable "0"
mbid "c40a07d1-7268-4c66-8eb0-5bef550c6e13"
album
#text "Eat 'em and Smile"
mbid "63730b4d-81fd-41b7-89d8-392b5fb34787"
url "https://www.last.fm/music/David+Lee+Roth/_/I%27m+Easy"
image
0
#text "https://lastfm-img2.akamaized.net/i/u/34s/5202c3c6fc7245dca1432869601c3286.png"
size "small"
1
#text "https://lastfm-img2.akamaized.net/i/u/64s/5202c3c6fc7245dca1432869601c3286.png"
size "medium"
2
#text "https://lastfm-img2.akamaized.net/i/u/174s/5202c3c6fc7245dca1432869601c3286.png"
size "large"
3
#text "https://lastfm-img2.akamaized.net/i/u/300x300/5202c3c6fc7245dca1432869601c3286.png"
size "extralarge"
date
uts "1523073904"
#text "07 Apr 2018, 04:05"
1
artist
#text "David Lee Roth"
mbid "802d37d5-0aaa-492e-b366-99f75e5a196f"
name "Tobacco Road"
streamable "0"
mbid "e8954075-2f0d-4482-94e2-432bfe9197e2"
album
#text "Eat 'em and Smile"
mbid "63730b4d-81fd-41b7-89d8-392b5fb34787"
url "https://www.last.fm/music/David+Lee+Roth/_/Tobacco+Road"
image
0
......

Hope you can find a way to fix this, the component seems pretty usefull
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-10 06:45:53
My username is "lovecraft_last" and when I used "Get last.fm scrobbles" the terminal said:
Nice catch! Fixed now.

If that resolves your problem (and nobody else reports an issue) I'll put it up in the official component registry.

BTW: Big changes are coming soon. Almost finished multi-threading and removing all restrictions on amount of scrobbles to retrieve and the max 50 tracks to retrieve from. I haven't seen any issues in 24 hours, but I need to refine a few things still. With any luck I'll have it out for beta by the end of this week.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-04-10 07:03:47
Yeah, it works now  8)

Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=lovecraft_last&artist=David+Lee+Roth&limit=200&format=json&page=1
Found 3 plays in last.fm (since last recorded scrobble) of Yankee Rose

Thanks man !!!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Smakaveli on 2018-04-11 16:46:37
BTW: Big changes are coming soon. Almost finished multi-threading and removing all restrictions on amount of scrobbles to retrieve and the max 50 tracks to retrieve from. I haven't seen any issues in 24 hours, but I need to refine a few things still. With any luck I'll have it out for beta by the end of this week.

hey,

that sounds fantastic! looking forward for it and cant wait to test the beta  :o
Right On.

Kind regards
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-12 07:33:05
that sounds fantastic! looking forward for it and cant wait to test the beta  :o
Right On.

Kind regards
v2.5.0beta1

If I don't see any issues or complaints, I'll probably make this official at the end of the weekend.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Smakaveli on 2018-04-16 17:08:31
v2.5.0beta1
  • All last.fm calls are now handled outside the main thread, so the UI doesn't block
  • Progress dialog is displayed if all scrobbles aren't retrieved in 500ms
  • Number of scrobbles retrieved per artist no longer limited to 1000, but rather 200 * (maxCacheSize - 1)
  • maxCacheSize value is reset to 40 if the previous value was less than 40 (used to default to 20)
  • Can now retrieve scrobbles on up to 1000 tracks at a time

If I don't see any issues or complaints, I'll probably make this official at the end of the weekend.

I just came by to say thank you for the latest version.
It runs very reliably, even with the large number of scrobbles I've collected over the years.

To the point where the max. retrieved scrobble per artists will be reached (currently 9,999?), I'm going to use it with great pleasure.
My top artist leads the way with currently 9,485 scrobbles, so this will not be the case in the next weeks.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-16 17:42:38
Officially released v2.5.1 in the official registry. Just a version bump from the beta for auto-update purposes; no other changes.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-16 17:45:16
I just came by to say thank you for the latest version.
It runs very reliably, even with the large number of scrobbles I've collected over the years.

To the point where the max. retrieved scrobble per artists will be reached (currently 9,999?), I'm going to use it with great pleasure.
My top artist leads the way with currently 9,485 scrobbles, so this will not be the case in the next weeks.
You shouldn't run into any issues. After we have scrobbles for an artist, the next plays only checks scrobbles up to the last recorded scrobble of that song. So if you last scrobbled the song 250 scrobbles ago, it would pull the last 400 scrobbles (we pull 200 at a time) and stop checking for new scrobbles once the timestamp is older than the last scrobble.

If you want to make extra sure you don't miss anything, just select all songs by your artist with the most scrobbles, and then right-click and retrieve scrobbles.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: arch21 on 2018-04-16 18:11:19
I still see and get version 2.1.1.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-16 18:18:56
I still see and get version 2.1.1.
Whoops. Try now.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: arch21 on 2018-04-16 18:20:18
Yep, got it. Thank you :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-28 02:49:47
I got a mildly disturbing message today from one of the last.fm devs. Apparently they are considering removing the user.getArtistTracks method from their API which would completely break this component's last.fm functionality. As far as I can see there's no other method to retrieve scrobbles of a particular song, so we'd be SOL. The dev wasn't quite sure what I was using the method for though, so hopefully I made my case. I'll let you know if I hear back more info.

Changes currently being worked on:
Adding %first_played_enhanced%, %last_played_enhanced% and %added_enhanced% methods. These would compare (for example) the %first_played% and %lastfm_first_played% fields and return the oldest, etc. Are you guys okay with those field names? I couldn't think of anything better.

I also think I'm going to move the last.fm retrieval to when a song initially starts playing, and not just at the time %play_count% gets increased. I think that will provide a better user experience.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: TheQwertiest on 2018-04-28 11:36:44
Hm... %lastfm_play_count% always returns 0 for me. Is there any way to enable logs to diagnose the problem?

PS: Internet is accessed via proxy, so if foo_enhanced_playcount does not use fb2k network settings, this might be the cause.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-28 19:00:39
Hm... %lastfm_play_count% always returns 0 for me. Is there any way to enable logs to diagnose the problem?

PS: Internet is accessed via proxy, so if foo_enhanced_playcount does not use fb2k network settings, this might be the cause.
last.fm information is not retrieved automatically. You'll need to first play a song for 1 minute or right click on a track/tracks and retrieve scrobbles. Also make sure you set your username correctly in the settings. You might also need to uncheck the "compare album" option.

If you've done all of those things and are still seeing only zeroes, manually attempt to pull scrobbles and paste what's in the console. I use foobar's HTTP method so it should respect the fb2k settings.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-04-30 07:17:33
New beta release.

Change list:

Please try it out and let me know if there are any issues. If not it'll be officially released end of this week.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-01 05:04:15
Whoops, I changed the Album/Title strings to strip out punctuation, and then still was doing comparisons with the old strings. Beta 2 fixes it, and removes an unnecessary code path when last.fm retrieval is disabled.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: nikolai4ik on 2018-05-01 09:45:09
This means you will occasionally briefly see a popup when you begin playing a new track and scrobbles are requested. I wish I could suppress it but it doesn't seem possible.[/li][/list]
Unfortunately it's more frequent than occasionally for me and sometimes it stays for up to 20 seconds. I use displayfusion though and made it so this popup immediately minimizes to tray so it won't bother me.

Love that it requests the data when a track starts now.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-01 17:05:35
Yeah, if you're pulling 10k scrobbles, it could take awhile :) I'd recommend you finding your most frequently scrobbled artists and doing a manual pull on them. Should only take 20 seconds or so for the very first song and then the others should happen more or less instantly as the results are cached. Then when it pulls scrobbles on play it'll only be making one or two requests from last.fm.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: TheQwertiest on 2018-05-03 13:44:01
last.fm information is not retrieved automatically. You'll need to first play a song for 1 minute or right click on a track/tracks and retrieve scrobbles.
Yup, that was it, thanks!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: nikolai4ik on 2018-05-04 09:58:12
Yeah, if you're pulling 10k scrobbles, it could take awhile :) I'd recommend you finding your most frequently scrobbled artists and doing a manual pull on them. Should only take 20 seconds or so for the very first song and then the others should happen more or less instantly as the results are cached. Then when it pulls scrobbles on play it'll only be making one or two requests from last.fm.
Obviously I was talking about a single track fetch :P It's not necessary your component's issue, last.fm or my internet connection could be slow.

The only issue I have is that it's missing some scrobbles sometimes:
Top text is info from your component, it's 11 instead of 18.
Somehow my ancient last.fm WSH panel shows the correct amount.
https://i.imgur.com/hChDnha.jpg
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-04 16:42:33
Can you paste the URL from the console that it's hitting for that track? I'll need to inspect the JSON.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: nikolai4ik on 2018-05-04 17:58:32
Can you paste the URL from the console that it's hitting for that track? I'll need to inspect the JSON.
Code: [Select]
Opening track for playback: "D:\123\Music\The Kooks\Inside In-Inside Out (2006)\08 - Matchbox.mp3"
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=123&artist=The+Kooks&limit=200&format=json&page=1
Musicbrainz: Invalid/missing MBID
Found 1 plays in last.fm (since last recorded scrobble) of Matchbox

I think the issue is in updating the value or an older version bug, because if I clear saved last.fm plays and refetch the info it gets the correct amount, just tested on some songs.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-04 18:21:03
I think the issue is in updating the value or an older version bug, because if I clear saved last.fm plays and refetch the info it gets the correct amount, just tested on some songs.
That could be. With the relaxed pattern matching of song titles/albums now in the latest beta it should pick up more scrobbles than it did before, and since it only checks up to the last scrobble you might need to clear and repull for songs with special characters in the name (such as the / in "Inside In/Inside Out").
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-05-05 05:57:49
%added_enhanced% works as expected [returns earliest of %added% and %lastfm_first_played%] but %first_played_enhanced% and  %last_played_enhanced% doesn't returns the values of %first_played% and %last_played% until the file is played.

(https://i.imgur.com/CLf2KKe.png)

The album is played and registered in foo_playcount but never scrobbled to last.fm.
The code used for columns has this format:

Code: [Select]
$if2($left(%last_played_enhanced%,10),<<<n/a>>>)

Once I play the file again %first_played_enhanced% and  %last_played_enhanced% returns a value just before the component looks for last.fm data.

Code: [Select]
Found 0 plays in last.fm (since last recorded scrobble) of Horde

(https://i.imgur.com/yChY0Wd.png)




Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-05-05 06:17:59
Also I found a problem with the characters ê and Ê but I don't know if is a problem of last.fm or the component.

The song "Café De L'Enfer - Je Ne Veux Plus Être Pieux" only return the last.fm data if is renamed as "Café De L'Enfer - Je Ne Veux Plus être Pieux"

Code: [Select]
Found 0 plays in last.fm (since last recorded scrobble) of Je Ne Veux Plus Être Pieux

Code: [Select]
Found 1 plays in last.fm (since last recorded scrobble) of Je Ne Veux Plus être Pieux

The song is named " Café de l'enfer — Je ne veux plus être pieux " in last.fm

Edit:

The problem is not only with "^", if I change "Café" for "Cafe" the data is not returned.

Code: [Select]
Found 0 plays in last.fm (since last recorded scrobble) of Je Ne Veux Plus être Pieux

Could you add and exception for acute, thick, diacritic, ... accents in Album/Title comparisons like the one with '(', ')', and '&'?

If 'á', 'à', 'ä', 'â' equal 'a' the positives matches will increase a lot.



Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-07 05:48:24
%added_enhanced% works as expected [returns earliest of %added% and %lastfm_first_played%] but %first_played_enhanced% and  %last_played_enhanced% doesn't returns the values of %first_played% and %last_played% until the file is played.
First off, thanks for testing the component! Secondly, god damnit... you discovered a major bug. :(

I have fixed the first issue with first_played_enhanced and last_played_enhanced not returning anything until the song is played. Really good catch. It's fixed in the beta 3 version attached below.

Your second problem is actually pretty huge, although it doesn't seem like it would be. What your propose (mapping 'á', 'à', 'ä', 'â' to 'a') is the perfect solution... there's just one problem, and it's how foobar handles multi-byte characters. Turns out that foobar takes those characters from the tags, which I'm 100% positive are not multi-byte and munges them internally so that they are. Therefore the string:
"Écailles de lune" becomes "Écailles de lune". The strings returned from last.fm are similarly converted, so as long as they have the name as "Écailles de lune" then the match will work correctly, however if the name in last.fm is "écailles de lune" instead, that string will become "écailles de lune" in foobar, and the match will fail.

Now you might think the solution would be to just skip all multibyte characters, but then we can't do comparisons on songs like "『眩暈』。" by the band té.

As of this moment, I have no idea how to fix this issue. I'm going to need to go back to the drawing board and re-examine foobar's string datatypes and see if there's something else I can do instead. Right now I'm seeing a bunch of my French songs in particular being caught up by this with diacritic comparisons failing because last.fm has a different capitalization case then my library does.


Turns out foobar has a stringCompareCaseInsensitive method which handles this issue just perfectly. Beta 4 below has the fix in it. Let me know if you're still seeing issues.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-05-07 06:30:36
%added_enhanced% works as expected [returns earliest of %added% and %lastfm_first_played%] but %first_played_enhanced% and  %last_played_enhanced% doesn't returns the values of %first_played% and %last_played% until the file is played.
First off, thanks for testing the component! Secondly, god damnit... you discovered a major bug. :(

I have fixed the first issue with first_played_enhanced and last_played_enhanced not returning anything until the song is played. Really good catch. It's fixed in the beta 3 version attached below.

Your second problem is actually pretty huge, although it doesn't seem like it would be. What your propose (mapping 'á', 'à', 'ä', 'â' to 'a') is the perfect solution... there's just one problem, and it's how foobar handles multi-byte characters. Turns out that foobar takes those characters from the tags, which I'm 100% positive are not multi-byte and munges them internally so that they are. Therefore the string:
"Écailles de lune" becomes "Écailles de lune". The strings returned from last.fm are similarly converted, so as long as they have the name as "Écailles de lune" then the match will work correctly, however if the name in last.fm is "écailles de lune" instead, that string will become "écailles de lune" in foobar, and the match will fail.

Now you might think the solution would be to just skip all multibyte characters, but then we can't do comparisons on songs like "『眩暈』。" by the band té.

As of this moment, I have no idea how to fix this issue. I'm going to need to go back to the drawing board and re-examine foobar's string datatypes and see if there's something else I can do instead. Right now I'm seeing a bunch of my French songs in particular being caught up by this with diacritic comparisons failing because last.fm has a different capitalization case then my library does.


Turns out foobar has a stringCompareCaseInsensitive method which handles this issue just perfectly. Beta 4 below has the fix in it. Let me know if you're still seeing issues.

Goddam you're fast !!!

I don't even have time to download the beta 3 and test the first fix  ;)
All of them working perfect right now.

Thanks to you for the component and the quick fix.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-07 19:27:24
Haha, I decided I was just going to stop messing with it and go to bed, and so of course I spent another 20 minutes going through SDK header files trying to find something that solved the problem. Fortunately I lucked out :)

Gonna give this beta a few days and then officially release version 3.0.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-05-08 07:09:52
Gonna give this beta a few days and then officially release version 3.0.

Happy to make all the posible test to improve it.

I have a big library with a lot of diferents player used along the years and diferents scenarios.

This plugin is a great oportunity to consolidate the playcount and use it with dinamics fields autorating and make it more acurate.

I think I found another discrepancy in %last_played_enhanced%.

Cleaning lastfm data to test again from the begining.

(https://i.imgur.com/o3vKU2i.png)

Then I run get lastfm scrobbles in the files

(https://i.imgur.com/Cz5idcS.png)

As you can see %last_played_enhanced% doesn't honor the latest value of %last_played% in the foo_playcount db and return the %lastfm_last_played%

(https://i.imgur.com/4tCGTuN.png)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-05-08 08:04:26
For some reason this component stopped working and only displaying 0 for last.fm play counts. This was several component versions ago and I stopped using it. I tried the latest version now but still the same, only 0 no matter how many times something is played, older or recent scrobbles. My lastfm user name is set correctly. None of the other fields seem to work either. They either show N/A or nothing at all.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-08 16:27:20
For some reason this component stopped working and only displaying 0 for last.fm play counts. This was several component versions ago and I stopped using it. I tried the latest version now but still the same, only 0 no matter how many times something is played, older or recent scrobbles. My lastfm user name is set correctly. None of the other fields seem to work either. They either show N/A or nothing at all.
Is it making calls to last.fm? Can you clear a scrobble for a song, and then repull and then paste one of the URLs here please? Also let me know if the console says it found any scrobbles for the song.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-05-08 16:36:38
It is indeed making calls. Console mentions
Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=jazzthieve&artist=Nick+Drake&limit=200&format=json&page=1
Found 11 plays in last.fm (since last recorded scrobble) of Day Is Done

I've cleared last.fm saved plays and then tried get last.fm scrobbles. Console gives the same again:

Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=jazzthieve&artist=Nick+Drake&limit=200&format=json&page=1
Found 11 plays in last.fm (since last recorded scrobble) of Day Is Done
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-08 16:47:17
As you can see %last_played_enhanced% doesn't honor the latest value of %last_played% in the foo_playcount db and return the %lastfm_last_played%
Okay, that's weird. I had tested this during development, and just retested now and I can't reproduce it.

Only thing I could think of that would maybe effect it, do those files have last_played information written to them?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-08 17:07:47
It is indeed making calls. Console mentions
Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=jazzthieve&artist=Nick+Drake&limit=200&format=json&page=1
Found 11 plays in last.fm (since last recorded scrobble) of Day Is Done
Hmmmm. So the component is working correctly, but it looks like it can't write/read to the database properly. Do you mind uploading a copy of the database somewhere where I can figure out what's going wrong?

Close foobar and then the file is 0C1BD000-43E7-4078-B885-48EE4249DEC2 and It's located in index-data/

Also, if you could take a screen shot of the properties for that Nick Drake song (so I can tag an mp3 the same to match) that would be helpful.

Your other option is to close foobar, backup the database file somewhere, delete it from index-data, then restart and see if the component starts working for you again.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-05-08 18:11:03
I tried your suggestion of deleting the database and restarting. It works again and the component receives the scrobbles correctly now. Following your suggestion I have hunch that perhaps it had something to do with me running foobar portable on a ramdisk. Runs fine but ever since I'm doing that the recycle bin is acting a bit funky with files deleted from that ramdisk location.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-08 18:16:20
I tried your suggestion of deleting the database and restarting. It works again and the component receives the scrobbles correctly now. Following your suggestion I have hunch that perhaps it had something to do with me running foobar portable on a ramdisk. Runs fine but ever since I'm doing that the recycle bin is acting a bit funky with files deleted from that ramdisk location.
Good deal. If you aren't using foo_jesus, you should be, and make sure index-data is in the backup list. If things go sideways with any databases you won't have to restart from scratch.

Also just to check, that database wasn't some crazy size was it? I might be concerned if it was over 10MB or something.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-05-08 18:41:42
Nope, was 64kb. Don't have foo_jesus, perhaps time to set that one up. Thanks for the help.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-05-08 22:52:42
Okay, that's weird. I had tested this during development, and just retested now and I can't reproduce it.

Only thing I could think of that would maybe effect it, do those files have last_played information written to them?

No, the only reference of last played is in the "details" tab.

(https://i.imgur.com/zS8dGfp.png)
(https://i.imgur.com/tmGRsCE.png)
(https://i.imgur.com/bYKx7dN.png)

And the behavior is the same with other files in the same situation.

for example:

(https://i.imgur.com/a0mAuYD.png)
(https://i.imgur.com/Z3CH9uI.png)



Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-09 03:14:54
Just curious, if you play one of those Corcobado songs for a minute does the %last_played_enhanced% value correct itself?

Can you copy your database online for me to download? It's the index-data/0C1BD000-43E7-4078-B885-48EE4249DEC2 file. Could also use foo_playcount's db as well (C653739F-14B3-4EF2-819B-A3E2883230AE). Feel free to PM me or whatever. I have that Mer de Noms album so I won't have trouble matching the tracks up. Preferably leave that album in the state where the values are incorrect :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-05-09 03:22:24
Just curious, if you play one of those Corcobado songs for a minute does the %last_played_enhanced% value correct itself?

The value correct itself at the moment the file start playing, doesn't even need a minute

Can you copy your database online for me to download? It's the index-data/0C1BD000-43E7-4078-B885-48EE4249DEC2 file. Could also use foo_playcount's db as well (C653739F-14B3-4EF2-819B-A3E2883230AE). Feel free to PM me or whatever. I have that Mer de Noms album so I won't have trouble matching the tracks up. Preferably leave that album in the state where the values are incorrect :)

No problem, I try to PM you right now


Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-09 03:30:38
The value correct itself at the moment the file start playing, doesn't even need a minute
Haha, I don't even see how this could be possible. You're on v3.0.2 of foo_playcount right?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-05-09 03:38:08
The value correct itself at the moment the file start playing, doesn't even need a minute
Haha, I don't even see how this could be possible. You're on v3.0.2 of foo_playcount right?

Correct

PD:
I PM you the files

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-09 04:07:48
Okay, I've been able to reproduce the problem on my own database. I do my development and testing in a portable install of foobar to avoid cluttering up my actual databases, so I had no songs with playcounts before I started development on this component which is why I never ran into this. I should have a fix shortly.

Of course, while looking at paregistrase's DB, I realized that my hashes were case sensitive. If my song title was "When The Levee Breaks" and I used a tagger outside foobar to correct it to "When the Levee Breaks" the component will lose the value in the database. That leaves me three options:
1) I can force everyone to start over with a brand new database (far from ideal)
2) figure out someway to migrate all the old hashes to case-insensitive hashes (this may not be possible)
3) I live with a component that can't tell that "The" and "the" should hash to the same value (I will hate myself)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-05-09 04:17:05
Okay, I've been able to reproduce the problem on my own database. I do my development and testing in a portable install of foobar to avoid cluttering up my actual databases, so I had no songs with playcounts before I started development on this component which is why I never ran into this. I should have a fix shortly.

Of course, while looking at paregistrase's DB, I realized that my hashes were case sensitive. If my song title was "When The Levee Breaks" and I used a tagger outside foobar to correct it to "When the Levee Breaks" the component will lose the value in the database. That leaves me three options:
1) I can force everyone to start over with a brand new database (far from ideal)
2) figure out someway to migrate all the old hashes to case-insensitive hashes (this may not be possible)
3) I live with a component that can't tell that "The" and "the" should hash to the same value (I will hate myself)

If the new database is the component database it is not a big deal, only have to get the last.fm scrobbles again.

If it is the play_count db could be a problem  :P
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-09 04:48:20
Don't worry, I don't own foo_playcount, so I can't mess with that DB. It looks like it's possible to migrate the hashes to a new DB and delete the old one so I guess that's what I'll be playing with over the next day or so.

Beta 5 fixing the %first/last_played_enhanced% issue:
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-05-09 04:59:22
Beta 5 fixing the %first/last_played_enhanced% issue:

Tested in the problematic files, problem solved.

really appreciate your post-sale service ;)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-10 05:20:27
Wait, I'm supposed to be getting paid for this?

Beta 6 changelist:

BTW, the conversion stuff was such a pain in the ass because I made a stupid typo and it took me 6+ hours of fiddling and trying 50 different ways to get it to work before I realized what my mistake was.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: paregistrase on 2018-05-10 06:23:50
Wait, I'm supposed to be getting paid for this?

Of course, with eternal love and honey ;)


Beta 6 changelist:
  • index-db will be automatically converted to new format, and the old database will be deleted. You might want to back up 0C1BD000-43E7-4078-B885-48EE4249DEC2 just in case, or at least have foo_jesus installed. To test that everything is kosher, startup foobar, see that the console reports how many records were converted. Close foobar, see that the ...EC2 db is gone (new file is ...EC3), restart foobar and you should still have your lastfm playcounts. Then you can delete your backup if you like.

The process was perfect:
Code: [Select]
foo_enhanced_playcount: on_init()
foo_enhanced_playcount: Converted 23405 records. Deleted old database.

The ...EC2 was gone and only left a brand new ...EC3 with all the data in place.

  • Files now pinned to the following hash string, lowercased: "%artist% - $year($if2(%date%,%original release date%)) - %album% $if2(%discnumber%,1)-%tracknumber% %title%". This means you can change capitalization with foobar closed, and your hashes won't get lost. This exactly mirrors the hash string that foo_playcount uses, except Peter doesn't toss in a $year() around %date%.

Cool  8)

Thank you very much MordredKLB, now my dinamic rating is more accurate than never.



Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-12 04:54:17
Officially released v3.0.0 in the component registry. The only changes from beta6 are a version bump and some minor code cleanup. Nothing functional, so feel free to skip it if you have beta6.

Thanks everybody for all the help testing things. I'm feeling pretty good about the component and at the moment I can't think of anything else I want to add. Feel free to make suggestions if there's something you feel is missing.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-23 21:55:06
Releasing v3.0.1

Changelog:
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-05-23 22:36:11
I preferred it showing 0. Now I would just have  blank, no fun. Showing 0 is more meanigful while a blank is just that.
With playcount I could get around with $if, but not with this.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-23 23:06:00
I preferred it showing 0. Now I would just have  blank, no fun. Showing 0 is more meanigful while a blank is just that.
With playcount I could get around with $if, but not with this.
You don't need to surround it with brackets. %lastfm_playcount% will still show 0.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-05-24 00:04:17
Good to know, thanks.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Smakaveli on 2018-05-29 19:12:10
Runs like clockwork, I would like to thank you very much for this usefül component again!

I got a mildly disturbing message today from one of the last.fm devs. Apparently they are considering removing the user.getArtistTracks method from their API which would completely break this component's last.fm functionality. As far as I can see there's no other method to retrieve scrobbles of a particular song, so we'd be SOL. The dev wasn't quite sure what I was using the method for though, so hopefully I made my case. I'll let you know if I hear back more info.

Btw.. any (let's hope good) new information on this?

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-05-31 04:29:05
Btw.. any (let's hope good) new information on this?
Not really.

I explained my case, and he replied along the lines of "oh, that's great! you can just use method ____." To be sure, I tried whatever method it was out, verified that it did NOT work for our use case, and explained why it didn't and how even if it did work, it would require way more last.fm calls than the component currently does. Never got a response back.

Honestly I think the best thing to be done is to get as many people as possible using the component so that they see a lot of demand for the current user.getArtistTracks method and then hopefully they won't remove it. Those guys seem to move at a glacial pace though, so who knows what'll end up happening.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: annalise on 2018-05-31 18:03:47
Thanks for the update Mordred!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Sickid on 2018-06-10 14:47:11
no pop-up window?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-06-11 01:28:58
no pop-up window?
When you right click a song/songs and pull scrobbles from last.fm there should always be a popup. When a song is playing and it attempts to check last.fm it will display a popup if that operation lasts longer than 500ms. Usually that only happens if the artist has been played more than 200 times. After the first song from an artist has been played, the last.fm results are cached and you shouldn't see any more popups while playing that artist, unless you play a song again, or the response falls out of the cache.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Sickid on 2018-06-11 18:20:15
A lot of the data is inaccurate.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Sickid on 2018-06-11 18:36:06
This plug-in is very useful. Thank you very much.
But two things I think need to be improved.
1、Pop-ups are intolerable. I hope not.
2、I found that A lot of the data(playcount) is inaccurate.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-06-11 21:37:44
This plug-in is very useful. Thank you very much.
But two things I think need to be improved.
1、Pop-ups are intolerable. I hope not.
2、I found that A lot of the data(playcount) is inaccurate.
I don't like the popups either, but there's no way to suppress them using the sdk. Be glad that they only appear after 500ms.
I'm assuming you mean the count of scrobbles is inaccurate? I can only use the data that last.fm gives me. If you've renamed tracks while scrobbling there's no way for this component to know that. It already ignores all punctuation and capitalization, but outside that it can't tell that "Take me to Church" and "Take me too Church" are probably referring to the same song.

If you have examples you think are wrong, share the URL being retrieved (it's in the console) and the song title you think the count is off for.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Sickid on 2018-06-12 06:19:41
This plug-in is very useful to me because I've got more than 110,000+ plays on lastfm and I never back up local playback data.
My tags is normalized by foo_musicbrainz and foo_discogs. The plays are scrobbled to Last.fm by foo_audioscrobbler.

some examples:
ARTIST - TITLE - (%lastfm_play_count%/plays from lastfm album page) (These songs have been successfully identified by lastfm )
Arctic Monkeys - No.1 Party Anthem - (0/6plays)
Daft Punk feat. Julian Casablancas - Instant Crush - (0/44)
Daft Punk feat. Paul Williams - Touch - (0/25)
Daft Punk feat. Todd Edwards - Fragments of Time - (0/32)
Daft Punk feat. Panda Bear - Doin' It Right - (0/26)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Sickid on 2018-06-12 08:03:07
~These songs have been successfully identified by lastfm but Slightly different.
Daft Punk - Motherboard - (26/25)
Daft Punk feat. DJ Falcon - Contact - (22/25)

~These songs have NOT been successfully identified by lastfm (lastfm):
Daft Punk feat. Giorgio Moroder - Giorgio by Moroder - (50/NO RECORD)
Daft Punk feat. Pharrell Williams & Nile Rodgers - Lose Yourself to Dance - (39/NO RECORD)
Daft Punk feat. Pharrell Williams & Nile Rodgers - Get Lucky - (34/NO RECORD)

~I can make some adjustments about ARTIST to scrobble. so lastfm can identifie them.
$if($stricmp(%album artist%,Various Artists),$meta(artist,0),$if2($meta(album artist,0),$meta(artist,0)))

THE CONFLICT IS OBVIOUS.
This plug-in shoud only retrieves the data and gives the user a definition of how to match it.
To reduce the pop-ups, I'm trying to get a lot of data at once, FB got stuck.

I think it should be:
1. Get all the original playback data back at once, then no longer connect lastfm.
2. Tell users how the data is stored and let them customize how they use it.

This plugin is fucking useful, but it's really hard to use. thank you all the same,
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-06-12 17:47:17
Before I address your comments, a couple things.
1) Stop using foo_audioscrobbler. Switch to foo_scrobble (https://github.com/gix/foo_scrobble/releases), it's world's better and your scrobbles will be a lot more accurate making them work much better with my component. It can't go back in time and fix your old scrobbles but at least it fix them going forward.
2) Can you post the URL posted to the foobar console when you start playing "Daft Punk feat. Giorgio Moroder - Giorgio by Moroder". It will look like "Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=...." post that here so I can see exactly what the component is seeing.

I'll be able to explain what's going wrong once you post that URL.

Also, what do you mean FB got stuck? When you're pulling multiple data for multiple songs at once, the progress bar will appear, and should continue updating. If an artist has a ton of scrobbles, it might take some time to pull all of them so you might see it pause movement for 30s or so, but it'll continue moving again after that. If you have 100k scrobbles, and the average artist in last.fm has 75 scrobbles this could take 5+ minutes to pull them all. It'd take a lot more time than that if that average drops considerably (i.e. you've got hundreds of artists with only a few plays each).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Sickid on 2018-06-12 19:26:47
http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Sickid&artist=Daft+Punk+feat%252e+Giorgio+Moroder&limit=200&format=json&page=1

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Sickid on 2018-06-12 19:41:23
Daft Punk feat. Todd Edwards - Fragments of Time

Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Sickid&artist=Daft+Punk+feat%252e+Todd+Edwards&limit=200&format=json&page=1
Found 0 plays in last.fm (since last recorded scrobble) of Fragments of Time

this song can not get scrobbles from lastfm. but On lastfm's album page, there are 32 plays。
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Sickid on 2018-06-12 20:02:16
I mean, no response,I had to turn off FB in the task manager。
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Sickid on 2018-06-12 20:16:04
(https://preview.ibb.co/neSHNy/2.png)
It's been an hour and I've had to turn it off from the task manager.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-06-12 21:00:04
Thanks. So yeah, if foobar is freezing up like that then something is clearly wrong. The progress bar should continue to move noticeably every few minutes. Unfortunately it's not crashing so there's no crash log to go off of. How many songs are you trying to retrieve scrobbles for at once there?


Regarding your 0 scrobbles issues, those are most likely all related to song/artist mismatches between what you have in foobar and what last.fm has. For the "Giorgio by Morodor" you have 50 scrobbles under the artist "Daft Punk feat. Giorgio Moroder". You also have 1 scrobble very recently of that song with the artist "Daft Punk". If that's the artist listed for that song, it'll never get those other scrobbles. You can force it to retrieve by changing the artist field to be "Daft Punk feat. Giorgio Moroder", then clearing saved scrobbles for that song, and repulling them. That should get the 50 missing scrobbles.

For Daft Punk feat. Todd Edwards - Fragments of Time, last.fm has the artist listed as "Daft Punk feat. Todd Edwards" and the song title as "Fragments of Time (feat. Todd Edwards)". You listed the song title as "Fragments of Time" which wouldn't match obviously. I'm wondering if maybe foo_audioscrobbler is scrobbling that file weirdly (seriously switch to foo_scrobble!), or last.fm is automatically updating the song title based on some internal rules. There's nothing I can do there either. Clearing the saved last.fm plays in the component, changing the track name to "Fragments of Time (feat. Todd Edwards)", and then repulling should get the missing scrobbles assuming the artist also matches perfectly. You'll notice a pattern here. Almost all the songs you're complaining about not getting scrobbles for have a "feat." artist on them. The best way to avoid these issues is to be extremely consistent in your tagging, and don't add featured artists in the artist name (I'd tag that artist as Daft Punk and tag Todd Edwards in a featured artist field for display purposes but that's just me).

Your suggestion that I retrieve all the data from last.fm and then let the user query it doesn't make any sense, and isn't how the foobar sdk database structure works, where data must be pinned to a hash based off actual files in your library. Even if you could arbitrarily store that data dump, there's no fast or efficient way to query the data using fields that the component provides. i.e. I want to get the number of last.fm scrobbles for Giorgio on Morodor, how do I specify that I want it to find every scrobble by any artist that starts with "Daft Punk" inside a simple %lastfm_playcount% style title-formatting field?

PLUS, I'd still need to requery last.fm whenever you started playing a song (which could display a popup if that query is slow!) because I have no way of knowing if you've scrobbled it from your phone using Spotify or whatever since the scrobbles were downloaded, without checking again, which could require redownloading 100k scrobbles again if the last scrobble you recorded for that track was years ago.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: Sickid on 2018-06-13 14:00:45
You don't seem to understand. You need to test yourself and you'll know. Thank you.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-06-13 14:23:22
A user says to the dev he doesn't "understand' about his own work. Now that's funny.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-06-13 16:06:56
You don't seem to understand. You need to test yourself and you'll know. Thank you.
I've done over a hundred hours of development and testing and mucking about with the weirdness that is last.fm's stored data. I also spent 30 minutes yesterday looking at what you posted and the last.fm responses. I'd say I have a fairly good idea of what's happening. Without your actual files that you can't retrieve scrobbles for, I can't say more.

Regarding foobar freezing, can you please tell me how many files you were trying to pull last.fm data for at the same time? Was it 100? 1000? 10k? I can't test that without more information on your end.

A user says to the dev he doesn't "understand' about his own work. Now that's funny.
I'm being incredibly nice because that hang worries me.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-08-07 07:01:56
Just released v3.0.2

Changelog

I also tested the component by retrieving scobbles for 5k different songs (encompassing 500 different artists) and could not replicate any crash. Seems pretty damn solid to me. Unless there's a bug or extra functionality that someone wants, this might be the last release for a while.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-08-07 13:22:58
Thanks for the update.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: localstorage on 2018-08-10 08:13:34
Hi, I love the component. It's very important to me so I'd like to say thanks for all the work you put into it.

I have a question: where is the playback data stored? I know I can retrieve it like a tag, but doesn't seem to be stored like a tag or a file property. I would like to know how to back up this data so I don't lose it. Thanks again for all the work you did on the component.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: jazzthieve on 2018-08-10 15:40:41
I think MordredKLB already mentioned it in this thread. It's stored in Index-data folder, file name 0C1BD000-43E7-4078-B885-48EE4249DEC3.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-08-10 16:54:20
I think MordredKLB already mentioned it in this thread. It's stored in Index-data folder, file name 0C1BD000-43E7-4078-B885-48EE4249DEC3.
That's it! I recommend using foo_jesus to backup the entire index-folder.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: WalterPeck on 2018-08-10 23:35:04
Edit: Doh. Just moved the data as referenced in the posts above and it works now.

Hello. I've noticed that this plug-in appears to have broken for me.

When I first installed it many months ago I setup a playlist column to display %lastfm_play_count% which worked fine; however, now all of my tracks simply show 0. Clearing the cache or trying to force a new last.fm query doesn't resolve this.

I'm using Foobar 1.4 with version 3.0.2 of the plugin. My lastfm username is still present and the plugin is set to retrieve scrobbles etc.

Any advice with regards to troubleshooting? Many thanks for your time and and efforts in creating this software.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-08-11 01:16:25
Edit: Doh. Just moved the data as referenced in the posts above and it works now.
Glad it's working for you again, but I'm not sure what you mean by this line. Did you manually move the db file from index-data?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: WalterPeck on 2018-08-11 07:56:43
Edit: Doh. Just moved the data as referenced in the posts above and it works now.
Glad it's working for you again, but I'm not sure what you mean by this line. Did you manually move the db file from index-data?

Yes, sorry. I moved the file and it regenerated in a working state. I didn't delete in case it made no difference, in which case I would have put it back.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-08-11 23:34:49
Gotcha. Sounds like it got corrupted due to a partial write or crash or something.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-09-04 00:04:38
Released v3.0.3

Changelog
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-09-04 04:05:42
v3.0.4 fixes the previous problem in a slightly smarter way.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: DVS on 2018-09-05 23:04:54
Please, show an example of a working script for JScript. I copy the text from the first post, but only the white window as a result.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: MordredKLB on 2018-09-06 03:12:19
Please, show an example of a working script for JScript. I copy the text from the first post, but only the white window as a result.
It doesn't require JScript, but to do fancier things (like listing out all played dates) requires JScript. The code in the first just shows how you can iterate over the array of values returned by the component, but doesn't actually display them or do anything fancy -- that'd be up to the you or the theme you're using. You can just use the fields provided in the first post without JScript if you want.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: DVS on 2018-09-06 21:05:00
like listing out all played dates requires JScript.
Yes, this I would like to implement.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: fuffi on 2018-11-27 21:06:26
Please, show an example of a working script for JScript. I copy the text from the first post, but only the white window as a result.
Exactly my question/problem/situation, why I came here in the second place :-)

But first things first:

Hello,
thanks a lot for this interesting component. Reading the Wiki and this 6 pages short thread, I've learned a lot (not only useful for this component) and it seems that this component could be of good statistical use, which I -from time to time- like to view.

Now the nagging :-)

I have installed JScript/JSPanel (running some nice little scripts which are working good), but I have no idea/knowledge of how to set up a nice lookin panel to view the information provided by this component.

So whats now?
I'd love to see someone (else than me) who is eager to enhance the Wiki with a Startup-Guide, á la:
Ok, now you have it installed, but what can you do with it?
Give us some screenshots with example-code and a nice litte description how to implement it in DUI/CUI. How ppl. using it, etc.

Otherwise I'm lost. (The white window effect" DVS talked about.)

You (or someone else) wrote in the wiki "More code samples in the official thread." but I did not found anything.

So, can anybody reading/writing here, give us their settings/jscode/screenshots, so nobrainers like me can just copy/paste and learn ? That would be great.

EDIT:
Ah, I forgot:
from the console
Code: [Select]
[22:04:50]  hasNonPunctChars = false 
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50]  hasNonPunctChars = false
[22:04:50] Found 0 plays in last.fm (since last recorded scrobble) of Mod East
Why so many "hasNonPunctChars" entries?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2018-11-29 22:31:27
I have installed JScript/JSPanel (running some nice little scripts which are working good), but I have no idea/knowledge of how to set up a nice lookin panel to view the information provided by this component.

So whats now?
I'd love to see someone (else than me) who is eager to enhance the Wiki with a Startup-Guide, á la:
Ok, now you have it installed, but what can you do with it?
Give us some screenshots with example-code and a nice litte description how to implement it in DUI/CUI. How ppl. using it, etc.

Otherwise I'm lost. (The white window effect" DVS talked about.)
First off, I think I made a mistake by including JScript in the title of this thread. I've removed that now to avoid confusion. JScript isn't needed at all, although some of the data this component returns can only be easily consumed in JScript because normal title formatting scripts don't have loops.

If you're not using JScript the simplest thing to do is just display the playcount using this component.
That's easily done with:
Code: [Select]
$max(%play_count%,%lastfm_play_count%)

You can replace any reference to %play_count% in your themes with the above and now you'll have more accurate play counts.  You can just drop this as a column in your DUI playlists if you like.

Now, if you have a JScript panel, you can get really fancy and use the %lastfm_played_times_js% to iterate over the played times and do cool stuff like I do in my Georgia theme (https://hydrogenaud.io/index.php/topic,116190.0.html):
(https://i.imgur.com/DuftBCj.png)
There I'm plotting every play of a song on a timeline. This is obviously a pretty complex process, and a lot of code is involved, so it's beyond the scope of this thread. I'd recommend checking out the Georgia thread and downloading the code (https://github.com/kbuffington/Georgia) if you'd like to know more.

Quote
Why so many "hasNonPunctChars" entries?
Ack! That code is called a bunch and can get triggered easily. That little debug log was left in by accident. I'll release a new version shortly to stop spamming the console.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: mjm716 on 2018-11-30 05:21:39
Ack! That code is called a bunch and can get triggered easily. That little debug log was left in by accident. I'll release a new version shortly to stop spamming the console.
[/quote]

pet peeve for awhile now - I always thought I had some errant JSpanel spamming a service. It's great to finally know where it's coming from.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2018-11-30 17:27:15
pet peeve for awhile now - I always thought I had some errant JSpanel spamming a service. It's great to finally know where it's coming from.
Really sorry about that. Just uploaded v3.0.5 which should stop the spam!

Turns out I never noticed because on my primary playback machine I was still on v3.0.2 haha :/
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2018-12-05 09:34:17
If you're not using JScript the simplest thing to do is just display the playcount using this component.
That's easily done with:
Code: [Select]
$max(%play_count%,%lastfm_play_count%)

You can replace any reference to %play_count% in your themes with the above and now you'll have more accurate play counts.  You can just drop this as a column in your DUI playlists if you like.

Now, if you have a JScript panel, you can get really fancy and use the %lastfm_played_times_js% to iterate over the played times and do cool stuff [...]
Hey, thank you very much for clearing this out to me 8-)

I checked your really eyecatching images of your fine theme and it is really impressive to me (also the good understandable documentation!), but decided not to try it, because I'm more a "technical" user which "needs" no visual eyecandy, but purely text information to easy recognize on the screen 8-)

So, if not using JScript panel, I only can show the playount (fetched from last.fm) ?
forget about that, I have tried the variables from the wiki...
Code: [Select]
$char(10)#####$char(10)
$rgb(255,0,0)$char(10)lastfm_played_times: $rgb(0,0,0)%lastfm_played_times%
$rgb(255,0,0)$char(10)lastfm_added: $rgb(0,0,0)%lastfm_added%
$rgb(255,0,0)$char(10)lastfm_last_played: $rgb(0,0,0)%lastfm_last_played%
$char(10)#####$char(10)
(I have followed your advice with the column in CUI and it worked good, thanks!)

I was wondering, if I just can simply show the dates when the current playing song was played, but this seems only possible with JScript, which, lets face it, I'm only able to copy and paste code into, but cannot iterate over an array or just show a dumb line of text ;-/  yeah, embarassing, but true :-)

Maybe someone can contribute a small script for the wiki page, for copy/paste-users like me, which shows a simple text list with the last played dates of the current selected song?  (This could be the first easy usable script on the wiki, users can grip, and the more scripts on the wiki, the more users might try and experiment with you fine component.)


Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2018-12-05 11:55:37
Another (dumb) question:
in f2k, if we don't want to show an empty string/variable, we enclose it in [brackets].
And it greatly works with %lastfm_first_played%, but [%lastfm_played_times%] shows [] if its empty.
How can I suppress the [] ?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2018-12-05 12:22:22
aaaaaand another question:
(f2k 1.4.1, component 3.0.5)

to check the output of your fine component, I've played "funky town" some times in a row.
this is my code which I put into an Items Detail Panel via CUI.
Code: [Select]
$rgb(255,0,0)lastfm_play_count: $rgb(0,0,0)$max(%play_count%,%lastfm_play_count%)$char(10)
$rgb(255,0,0)lastfm_added: $rgb(0,0,0)%lastfm_added%$char(10)
$rgb(255,0,0)lastfm_last_played: $rgb(0,0,0)%lastfm_last_played%$char(10)
$rgb(255,0,0)lastfm_first_played: $rgb(0,0,0)%lastfm_first_played%$char(10)
$rgb(255,0,0)lastfm_played_times: $rgb(0,0,0)%lastfm_played_times%$char(10)
$rgb(255,0,0)played_times: $rgb(0,0,0)[%played_times%]$char(10)

I don't get why all of the lastfm_*-variables are empty.
The "normal" variables (%play_count% and %played_times%) work fine.

Please see the attached screenshots (unfortunately, I'm not able to add them visible inside this post).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2018-12-05 13:24:04
Me, again,

I have set a Column in CUI and it works fine.
Code: [Select]
$puts(T,[%lastfm_last_played%])
$puts(TT,
$year($get(T)).
$month($get(T)).
$day_of_month($get(T))
$left($time($get(T)),5)
)
$if($get(T),$get(TT),)

Unfortunately the %lastfm_last_played% and %lastfm_first_played% and %lastfm_added% return 2011.02.23 21:08, which is the date, I scrobbled it the first time (I guess).
%lastfm_last_played% is not correct, because I played it some times last month. (Its on page 11 on the last.fm website and I played a lot of songs in the meantime).

I guess, this is because?
Unfortunately, Last.fm is slow. I must query by Artist, and can only pull 200 scrobbles at a time. For the first last.fm check of a song, I will pull up to 1000 scrobbles (5 API calls) and then attempt to match them. For all subsequent calls for songs by that artist the API responses are placed in an LRU cache, meaning they should be essentially instantaneous. By default I store up to 20 API responses, although this number can be increased to 50 in the preferences.

At the moment Last.fm calls are blocking on the UI.

I have set the size of the last.fm response cache to 40.

What would be a reasonable size to set it up?
(So the last.fm server is not annoyed *and* I'm getting at least the last 3 months reflected)
I don't want to set it to something I don't understand and cause bad results...
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2018-12-05 13:44:13
Please ignore this question, because after a f2k restart it shows all the variables content, if any. Dunno why and what that caused... (sometimes, the data seems not to be realtime, but a play behind)
aaaaaand another question:
(f2k 1.4.1, component 3.0.5)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2018-12-06 19:16:45
Another (dumb) question:
in f2k, if we don't want to show an empty string/variable, we enclose it in [brackets].
And it greatly works with %lastfm_first_played%, but [%lastfm_played_times%] shows [] if its empty.
How can I suppress the [] ?
Yeah, I do this on purpose because I mainly use it in JScript and the '[]' is needed to show that it's an empty array.

If you don't want to show anything in that case you could do:
Code: [Select]
$iflonger(%lastfm_played_times%,2,%lastfm_played_times%,)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-01-10 06:51:18
Uploaded v3.0.6 to the components registry. Don't think there's a reason to force an upgrade as the functionality is identical, only change is that the component was compiled with the release 1.4 SDK instead of the Beta, and the component size was cut in half.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Awesomeo on 2019-01-11 18:14:03
Do you ever plan to implement manual importing (and exporting to xml too) of statistics?

I know there's the last.fm import option, but it doesn't really do much for me as my early years on last.fm are a mess. A couple of years ago I downloaded all my last.fm data and with some help of excel I managed to weed out outliers and finally adopt it for original playback statistics component. But it took time and manual tinkering and I'm 100% sure no automation can manage to do that without my own input. Also, you know, maybe one day sites like YouTube or Soundcloud will allow downloading user history through API - another case where manual import would prove useful.

There's also the second reason, a bit more idealistic - the ability to import/export the stats would give me a sense of much more freedom and 'ownership' of my personal data.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-01-11 18:49:02
Do you ever plan to implement manual importing (and exporting to xml too) of statistics?
I hadn't considered it before. If I were to ever do something like this, I'd probably export to JSON because it's easier to work with IMO.

Just to be clear, this component doesn't really backup the data from last.fm, it just backs up the data from last.fm for songs that you select (either manually or by playing them) so long as the data in last.fm matches one of the selected songs. So I pull plays for "Song A" from a particular artist, and I get back all the values for "Song A" and "Song B", but only those plays for "Song A" are saved... at least until "Song B" is played. Also, if last.fm has records of plays of "Song C" but it's not in your library (maybe the song title is mispelled locally) then you'll never see those plays recorded. It's not a great way to mirror the last.fm data which I think somewhat limits the value of exporting/importing.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Awesomeo on 2019-01-11 22:14:11
If I were to ever do something like this, I'd probably export to JSON because it's easier to work with IMO.
And same with importing, I suppose? Well, JSON importer would be fine, because there's a lot of converters out there (even online like this: http://shancarter.github.io/mr-data-converter), so I could easily transform my xml/xls data.

so long as the data in last.fm matches one of the selected songs
Yeah and that's a problem. When I was importing my last.fm to foo_playcount a few years ago, I only had ~80% of my foobar library tracks matching exactly my last.fm scrobbles. And these should be identical! But last.fm used to have the metadata correction option and also my library was constantly updating thanks to musicbrainz. So yeah, in the end I had to make manual changes in excel (for example: I had to swap all the last.fm's "Florence and The Machine" to stylised name "Florence + The Machine" to match my foobar library).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-01-16 16:55:35
Yeah and that's a problem. When I was importing my last.fm to foo_playcount a few years ago, I only had ~80% of my foobar library tracks matching exactly my last.fm scrobbles. And these should be identical! But last.fm used to have the metadata correction option and also my library was constantly updating thanks to musicbrainz. So yeah, in the end I had to make manual changes in excel (for example: I had to swap all the last.fm's "Florence and The Machine" to stylised name "Florence + The Machine" to match my foobar library).
That's why I relaxed pattern matching in this component from it's initial release. It wouldn't solve your "Florence and The Machine" to "Florence + The Machine" problem, but if your original artist name was "Florence & the Machine" that would have matched.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Saulo-Aredes on 2019-01-24 22:17:24
Hi.

I have a little problem with my username in last.fm and your plugin.

My username is "Saulo-Aredes" and when I used "Get last.fm scrobbles" the terminal said:


Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Saulo%252dAredes&artist=Anti%252dFlag&limit=200&format=json&page=1
Found 0 plays in last.fm (since last recorded scrobble) of Liar

Hope you can help, the component seems great
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-01-25 17:08:51
Hi.

I have a little problem with my username in last.fm and your plugin.

My username is "Saulo-Aredes" and when I used "Get last.fm scrobbles" the terminal said:
Good catch. last.fm expects that usernames are not escaped (they only allow a-Z, '_', and '-'). I've stopped escaping usernames and things seem to work now.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-01-25 17:10:14
Released v3.0.7

Changelog
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: PrimulaRosea on 2019-01-29 02:28:28
hey, I have a little problem with this plugin and I'm sorry if this already asked before

(https://i.imgur.com/YLlcECQ.png)
can I suppress that message? it usually is fine but sometimes it stealing focus when I'm gaming or watching videos and it's getting annoying when it happens too often
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-01-29 16:28:39
hey, I have a little problem with this plugin and I'm sorry if this already asked before

(https://i.imgur.com/YLlcECQ.png)
can I suppress that message? it usually is fine but sometimes it stealing focus when I'm gaming or watching videos and it's getting annoying when it happens too often
Unfortunately no. It's a requirement when using a separate thread to avoid blocking the main foobar UI. Foobar lets you delay it showing up for 500ms, so if the request completes in less than that time you won't see it. I've asked if there was a way to further delay or completely suppress that dialog and it appears the answer is no.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: PrimulaRosea on 2019-01-31 05:08:30
hey, I have a little problem with this plugin and I'm sorry if this already asked before

(https://i.imgur.com/YLlcECQ.png)
can I suppress that message? it usually is fine but sometimes it stealing focus when I'm gaming or watching videos and it's getting annoying when it happens too often
Unfortunately no. It's a requirement when using a separate thread to avoid blocking the main foobar UI. Foobar lets you delay it showing up for 500ms, so if the request completes in less than that time you won't see it. I've asked if there was a way to further delay or completely suppress that dialog and it appears the answer is no.
oh so the problem is because my internet connection is trash?
damnit, the problem of living in a 3rd world country lol
thanks for the answer!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: TheQwertiest on 2019-01-31 09:08:18
oh so the problem is because my internet connection is trash?
That or you have a big LastFM playback history - AFAIK the component has to go through all the pages to find the play count and play times (it caches pages for some time, so it much faster afterwards though).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-01-31 23:51:44
That or you have a big LastFM playback history - AFAIK the component has to go through all the pages to find the play count and play times (it caches pages for some time, so it much faster afterwards though).
It goes through all the pages for the currently playing artist, at 200 scrobbles per page. With a full 200 scrobble request, it takes last.fm about 100-150ms to start returning a response, and then however long it takes to your internet to receive 150-200kb of data. On a slow connection it's possible even a single page could take longer than 500ms unfortunately. The less scrobbles you have with an artist the faster it'll go.

The component also minimizes requests by caching (if you're playing only songs by one artist you should never see the popup until you restart foobar), and also checking the last recorded scrobble we know about. So you might have 1000 scrobbles from an artist, but if the component has a record of the scrobble from yesterday it will stop making requests to last.fm if it finds scrobbles before that date in the last response.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: kode54 on 2019-02-01 00:19:40
The only workaround to doing it in the background would be to implement the full threading model of the background request manually, and avoid using the SDK's convenient threaded background process interface.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-02-05 23:08:54
The only workaround to doing it in the background would be to implement the full threading model of the background request manually, and avoid using the SDK's convenient threaded background process interface.
For the record, I do not have the knowledge or skills required to do this. Frankly I'm amazed I was able to write this component to begin with :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: ben-xo on 2019-02-26 10:38:20
Hi there! I've just come across this thread when searching for "user.getArtistTracks". I'm the Last.fm dev who sent the "mildly disturbing" message last year.

Based on the use case presented to me by MordredKLB last year, I have a different suggestion for a replacement API method when user.getArtistTracks goes away, which is that we'll create a new method to retrieve all scrobbles of a specific track.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: davideleo on 2019-02-26 20:30:11
I'm giving a try to this component. I couldn't find any reference in the wiki, nor in this thread about the "Remove duplicate scrobbles", though. I'm not sure I want to remove anything. What exactly is a duplicate scrobble?

EDIT: Sorry I just noticed the tooltip with the explanation.

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: davideleo on 2019-02-26 21:39:16
Apparently it's not working by me, but maybe I misunderstood the purpose of the component. I was expecting to retrieve the whole scrobbling history of the played track. I tested it with a playlist where all tracks have a few scrobbles, because I play it very often. I can see the popup showing up, but all lastfm fields remain empty. I tried with and without album, and with and without removing duplicates. The console log confirms that the query has been submitted, but the result is always "Found 0 plays in last.fm (since last recorded scrobble)".
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: loz on 2019-02-26 21:56:09
Apparently it's not working by me, but maybe I misunderstood the purpose of the component. I was expecting to retrieve the whole scrobbling history of the played track. I tested it with a playlist where all tracks have a few scrobbles, because I play it very often. I can see the popup showing up, but all lastfm fields remain empty. I tried with and without album, and with and without removing duplicates. The console log confirms that the query has been submitted, but the result is always "Found 0 plays in last.fm (since last recorded scrobble)".
It's on last.fm api's end. I noticed an issue earlier today and it seems the API isn't returning data. There's a thread here: https://getsatisfaction.com/lastfm/topics/the-api-doesnt-seem-to-return-data-anymore
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-02-28 18:50:21
Hi there! I've just come across this thread when searching for "user.getArtistTracks". I'm the Last.fm dev who sent the "mildly disturbing" message last year.

Based on the use case presented to me by MordredKLB last year, I have a different suggestion for a replacement API method when user.getArtistTracks goes away, which is that we'll create a new method to retrieve all scrobbles of a specific track.
Yup, I've been in discussions with Ben over on Reddit the last couple days. I really appreciate his willingness to work with me/us on keeping this component alive.

In the next few days I'll be releasing an updated version of this component that will only retrieve scrobbles for a single song, and not an artist's entire scrobble history. This should be seamless to users, but will hopefully have the effect of reducing/eliminating the popups that are sometimes seen when pulling scrobbles. That's a good thing.

However, when retrieving multiple scrobbles for an artist/library it could potentially take a lot longer and will most likely require rate limiting built in to avoid hammering their servers. What this means for you as users is that if you want to pull all scrobbles for a specific artist, the next few days is the best time to do this.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: ZevenMortem on 2019-03-09 02:14:42
Is there a way to add a field like... I don't know % lastfm_last_loved%, which returns one for loved track and 0 for unloved?
(I know there is a script to synchronize the lastfm loved songs, but i can't find a tag field)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (JScript)
Post by: davideleo on 2019-03-10 14:57:38
Also, what do you mean FB got stuck? When you're pulling multiple data for multiple songs at once, the progress bar will appear, and should continue updating. If an artist has a ton of scrobbles, it might take some time to pull all of them so you might see it pause movement for 30s or so, but it'll continue moving again after that.

I managed to pull all of my scrobbles (about 80k out of a 230k tracks library) in less than an hour, but at first I had this freezing issue, too. Eventually I found the cause was not in the component itself, but in scripts triggered by the on_metadb_changed() event.
Usually these scripts were flawless, because even a massive tag update triggers the on_metadb_changed() event once only, whereas if you have many scrobbles of the same artist, foo_enhanced_playcount will fire a continuous series of on_metadb_changed() events. In my case, one of the scripts in question would run four queries if triggered, and by the time the memory used was released, the script might have been triggered several times more by the subsequent scrobbles imports, fast approaching foobar2000's memory cap.
I was able to handle the issue with the fromhook argument, which is always true when the metadb is changed by foo_enhanced_playcount (I was not as lucky with third party applications, such as beaTunes, but this is OT).

I'm still a newbie when it comes to JScript, but I found other scripts by more skilled users did not take this circumstance into account, all the same. So, my advise to who is having foobar2000 freeze while downloading the scrobbling history, is to check whether your scripts have demanding performances triggered by the on_metadb_changed() event.


P.S.
@MordredKLB not a feature request, just curious: have you thought of downloading other lastfm data, such as tags and similar artists?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-03-12 18:07:53
I managed to pull all of my scrobbles (about 80k out of a 230k tracks library) in less than an hour, but at first I had this freezing issue, too. Eventually I found the cause was not in the component itself, but in scripts triggered by the on_metadb_changed() event.
Usually these scripts were flawless, because even a massive tag update triggers the on_metadb_changed() event once only, whereas if you have many scrobbles of the same artist, foo_enhanced_playcount will fire a continuous series of on_metadb_changed() events. In my case, one of the scripts in question would run four queries if triggered, and by the time the memory used was released, the script might have been triggered several times more by the subsequent scrobbles imports, fast approaching foobar2000's memory cap.
I was able to handle the issue with the fromhook argument, which is always true when the metadb is changed by foo_enhanced_playcount (I was not as lucky with third party applications, such as beaTunes, but this is OT).

I'm still a newbie when it comes to JScript, but I found other scripts by more skilled users did not take this circumstance into account, all the same. So, my advise to who is having foobar2000 freeze while downloading the scrobbling history, is to check whether your scripts have demanding performances triggered by the on_metadb_changed() event.
I run FB on a VM at work, and I found that when I tried to pull scrobbles for somewhere between 3-4k songs at once FB would freeze up and I'd have to kill it (this losing any scrobbles pulled since the last time FB was exited). On my home PC I could pull scrobbles for 20k songs at a much faster speed, with no issues at all.

I suspected the issue was my JScript foobar theme's on_metadb_changed callback, but I didn't bother making any changes. If you're trying to pull your entire library at once, for maximum safety I'd switch to a default UI theme with nothing loaded other than a playlist panel with your entire library (sorted by artist!). That takes poorly written scripts out of the mix.

Quote
@MordredKLB not a feature request, just curious: have you thought of downloading other lastfm data, such as tags and similar artists?
I haven't since there are other components that I assume do the same thing, and the original intent of this wasn't to be just a last.fm component.

Given the less than ideal changes (IMO) that are about to be added in the new version, I might look at adding some more stuff though.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: davideleo on 2019-03-12 18:31:11
I haven't since there are other components that I assume do the same thing, and the original intent of this wasn't to be just a last.fm component.

I only know of softplaylists which still works, but is not being developed anymore. It actually builds playlists based on tags and similar artists, rather than making the data available for titleformatting (or JScript). Anyway - again not a feature request - but in my ideal world there would be a separate plug-in all about lastfm  ;)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: lostcpu on 2019-03-13 10:46:32
is it possible to offer a enhanced %played_per_day% to show  3 or 4 digits after the decimal point?
now  %played_per_day% shows only 2 digits is meaningless for most songs, as I have 10k songs with more than 10 years in library.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-03-13 16:29:25
I only know of softplaylists which still works, but is not being developed anymore. It actually builds playlists based on tags and similar artists, rather than making the data available for titleformatting (or JScript). Anyway - again not a feature request - but in my ideal world there would be a separate plug-in all about lastfm  ;)
Haha, yeah. The problem as I see it is there's a way to get the list of all Loved tracks, but it's not possible to take that list and apply it back to all songs in your library.

i.e. I can start playing "Song 1" which is loved in last.fm, pull the list of loved tracks from last.fm and mark "Song 1" in the library as loved.
I can't pull the list of all last.fm loved tracks and then find "Song 1", "Song 2", "Song 3" in the library and mark them as loved. The comparison has to be done for each track in the library to determine whether it is loved or not.

That seems to limit the usefulness a little bit.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-03-13 17:04:25
is it possible to offer a enhanced %played_per_day% to show  3 or 4 digits after the decimal point?
now  %played_per_day% shows only 2 digits is meaningless for most songs, as I have 10k songs with more than 10 years in library.
I didn't even know this was a thing. Seems like very low utility, but I can add that and at least another decimal point. When you're getting into < 1 play every 3 years I'm not sure .0001 is much more useful than just calling it 0 :D
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: lostcpu on 2019-03-14 03:37:58
Thx very much.
I don't care about those  0.0001 and 0.
a lot of songs with even 90 counts showed with all same 0.01 and 0.02 really disappointed me, you know I just found out how useful %played_per_day% is yesterday but my foo_playcount first run is in 2008

is it possible to offer a enhanced %played_per_day% to show  3 or 4 digits after the decimal point?
now  %played_per_day% shows only 2 digits is meaningless for most songs, as I have 10k songs with more than 10 years in library.
I didn't even know this was a thing. Seems like very low utility, but I can add that and at least another decimal point. When you're getting into < 1 play every 3 years I'm not sure .0001 is much more useful than just calling it 0 :D
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: davideleo on 2019-03-14 14:58:41
The problem as I see it is there's a way to get the list of all Loved tracks, but it's not possible to take that list and apply it back to all songs in your library.

Yes, for this very special case, returning lastfm info as a playlist makes more sense. That's what I did with softplaylist at the beginning, and than mass-edited the playlist tracks (I store this information in a real custom id3 field, because I want it to be file-related). Since then, I only use softplaylists to synchronize my loves and bans from player to web and not viceversa.

Retrieving lastfm data as a playlist doesn't make sense for similar artists and tags, though, not for me at least. These should rather be stored in tag-related virtual fields and formatted as JSON objects, like the %lastfm_played_times%. It really looks like a natural addition to your component.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Smakaveli on 2019-03-14 20:19:30
Good evening,

I might have a challenge for you :P

I'm in love with the new last.fm feature (subscribers only) to manually edit scrobbles (possible since yesterday?) and I was wondering how the component's dealing with those manual edits.

Unfortunately it seems like the data cannot be received for the edit songs. For example: I've edited 32 scrobbles of one song, which had an annoying typo all the time. On last.fm the correct change was smoothly taking into account, but after I used the functions to clear and get the last.fm scrobbles with your component in foobar, I just have gotten the value 0.

Do you know why this is happening? Is it possible to programm a work around in this case? How do you plan to deal with it in the future?

Thanks for your advice in advance!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-03-15 21:46:30
@Smakaveli I'm 99% positive this is because this component currently relies on hitting an endpoint which uses a legacy backend database that does not replicate those edits. When I release the updated version of this component (it's basically ready to go, but I want to clean up some stuff) it should work seamlessly.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-03-16 05:00:10
Beta 1 version using the new last.fm API. Please let me know any issues you find here.

Changelog

Right now there's no throttling other than the natural throttling due to slow API calls. Please don't hammer Last.fm by requesting scrobbles for 10k songs at once. I'll build throttling in if it's a problem. I'll add some restrictions and throttling as needed once I figure out the best course of action there.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Smakaveli on 2019-03-17 18:38:38
thank you once again for your quick support. The beta works like a charm and fixes my problem I've had. :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: loz on 2019-03-18 01:11:57
Playcounts for Artists or Tracks with '&' in the name/title are not updating properly in Beta 1 when importing.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-03-22 05:30:11
Playcounts for Artists or Tracks with '&' in the name/title are not updating properly in Beta 1 when importing.
Great catch. It looks like '&' and '#' are the only characters that need to be escaped. Tried it out with a bunch of other common punctuation, and multibyte characters and had no issue.

See if you have any problems with this version:
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: loz on 2019-03-22 14:09:54
I figured it was something simple like that. I'll let you know if I have any issues with it when I install it later today. Thanks.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-03-26 05:04:01
You guys have complained about the occasional popups when playing a new track, and marc2k3 decided to step in and save you guys by using a background thread pool which doesn't block the UI, and doesn't display a popup. We're all in his debt.

Let me know if you guys experience any issues with this latest beta.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jazzthieve on 2019-03-26 08:23:33
Emigrating from an early version 3 to the newest I seem to have some troubles getting my scrobble playcount. Console says last.fm Error: Login: User required to be logged Found 0 plays in last.fm (since last recorded scrobble) when trying to get last.fm scrobbles. My last.fm username is filled in, is there another login procedure that needs to be done?

The earlier version has no issues getting the data but it's not always correct in getting the right numbers.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-03-26 16:46:23
Emigrating from an early version 3 to the newest I seem to have some troubles getting my scrobble playcount. Console says last.fm Error: Login: User required to be logged Found 0 plays in last.fm (since last recorded scrobble) when trying to get last.fm scrobbles. My last.fm username is filled in, is there another login procedure that needs to be done?

The earlier version has no issues getting the data but it's not always correct in getting the right numbers.
I had talked to @ben-xo about this issue a couple weeks back and this is what he told me:
Quote
"User required to be logged in" means the user has their recent scrobble history set to private. I think that may be a bug for this new method, though - thanks for bringing it up.
Guess they haven't fixed that.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jazzthieve on 2019-03-26 16:57:50
Yep, mine were set to private. No more issues when disabling private scrobbling. Do wish to be able to use private in the future (along with this component).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-03-26 21:34:25
Yep, mine were set to private. No more issues when disabling private scrobbling. Do wish to be able to use private in the future (along with this component).
Agreed. If for whatever reason last.fm can't or won't make the change, I might need to replicate the last.fm authorization that foo_scrobble uses. Presumably that would prevent the API calls from failing even if set to private.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: スラッシュ on 2019-04-04 11:39:52
Hi MordredKLB! Thanks for this excellent plugin, it works a charm!

I think the checkbox for "compare album fields" doesn't work when you disable it. I have at least one song that has scrobbles from both the single and the album version (with the single version receiving significantly more plays)--but regardless of whether I check the box or not, it will only give me the album plays when I attempt to update the playcount. Unless I'm misunderstanding how it works? I'm using v4.0.0b3.

EDIT: I just realized I needed to clear the plays and re-get the data. False alarm!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jazzthieve on 2019-04-04 17:35:15
I noticed I seem to be getting the wrong amount om retrieved scrobbles so I did some checks. Just to be clear with "wrong amount" I mean the scrobbles returned are more than what is shown on the last.fm track page. Here's a screen shot of a sample of 28 tracks.

(https://i.imgur.com/81DnYAq.jpg)

Look at the relevant set of 4 numbers to the right. The first number represent local playcount, the second number is the last.fm playcount (ignore the third and fourth numbers, they are irrelevant to this problem). Those highlighted in red are all wrong retrievals meaning the scrobble number on the track page are actually equal to the local playcount but for some reason when importing using "get last.fm scrobbles" it increments the scrobble with 1. As seen this doesn't happen with all tracks. Of this sample of 28 tracks 12 are wrong. The only consistency is that's always a wrong increment by 1. If the difference between local playcount and scrobble count is +2 and I check the track page the scrobble count is correct.
With this sample about 40% of tracks have wrong scrobble imports. When I clear the scrobbles and do an import again the same tracks have the same issues.
I can't fully trust foo_enhanced_playcount to represent the correct scrobbles since in about 40% of cases it doesn't show the actual scrobble count but always one too high on the bad ones.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-04 21:42:43
Can you uncheck the option "Increment Last.fm playcount when %play_count% increments"? It uses some logic that says if the %last_played% > %lastfm_last_played% add 1 to %lastfm_playcount%. The idea is that %lastfm_playcount% would always lag behind %play_count% (which gets incremented 1 minute into a song) so try to keep them in sync.

Could very well be a timezone issue or something though. If disabling that option fixes the problem, can you show me the output of one of the incorrect songs for these values:

%last_played%, %lastfm_last_played%, and %last_played_enhanced%
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jazzthieve on 2019-04-04 21:51:49
I'm ahead of you there, I tested it both with the increment option on and off. Each time clearing it and then again applying get scrobbles. It seems to not make a difference. If the update happens while playing it seems to go ok but I can only check a limited number of tracks like that as it requires a listen of the track. When a track with a bad import, lets say it has 3 actual scrobbles but the import says 4, when it updates (with increment on) it becomes 4 without incrementing to 5  which is then correct.

Also some tracks I have are double (or more) and the +1 import only happens on one version of a particular track. Lets say I have 3 tracks with the exact same tag name. I import the scrobbles and they all say 3 scrobbles, which is correct, except one which says 4. Btw, I leave compare album field uncheck always; never use that option.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jazzthieve on 2019-04-04 22:29:23
Just tried it again without increments checked but this time on a smaller batch of files (couple of hundreds instead of 3000+). On smaller batches it seems to be way,more correct but I need to check the tracks individually with the corresponding track page and check for doubles with extra plays to see if it's really correct.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-04 22:34:47
That's super weird. Are you using the latest beta or v3.x?

Also, are you saying that the clearing and repulling the values for songs changes the value reported for %lastfm_play_count%? (i.e. sometimes it's correct, sometimes it's not?)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jazzthieve on 2019-04-04 22:50:39
Yes sometimes it's correct and sometimes it's not. But it does seem like increments have something to do with it. Leaving it on and doing mass import does indeed create wrong numbers on %lastfm_play_count% and there seems to be no consistency between which tracks get +1 added and which ones don't.

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jazzthieve on 2019-04-04 23:06:05
I think I found it but now I would like to know if this is normal behavior. These are comparisons between the same tracks. First is with increments off, second it with increments on.

Off:
(https://i.imgur.com/fa54wyh.jpg)
Note: on this one the few instances where the last.fm playcount is higher it's indeed the correct number if I check the track page.

On:
(https://i.imgur.com/YOa4VIk.jpg)

There was no re-import or clearing. This is just selecting increments and restarting foobar. It was my understanding selecting increments meant the last.fm playcount would increment when it's played. Here it seems to show the incrementation happens on tracks even when they aren't played at all (the fourth number in the set of 4 indicates the amount of days ago it was last played, third one is the amount of days since first played i.e. the age of the track...so all of those tracks haven't been played in a while). So is this normal behavior to increment for some reason without track being played?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-05 07:21:13
It was my understanding selecting increments meant the last.fm playcount would increment when it's played.
Well, the way it works right now is that it adds 1 to %lastfm_play_count%, whenever %last_played% is more than 5 minutes greater than %lastfm_last_played%. This will have the effect of bumping the %lastfm_play_count% once the song reaches 1 minute elapsed and %play_count% increments, but it also will bump %lastfm_play_count% if for whatever reason foobar counted a play, but it was never recorded in lastfm (scrobble was ignored/lost, didn't play 50% of the song, etc.). This makes %lastfm_play_count% behave more as a super conservative "guess" at total active playcount: i.e. we know lastfm has 14 scrobbles of this song, and there's at least one we don't know about.

With the option enabled, could you play Stories From the Streets all the way through (and make sure it gets scrobbled), and then see if the numbers sync back up?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jazzthieve on 2019-04-05 08:15:34
I played said track with increments enabled. It was at 14 actual plays and 14 actual scrobbles but %lastfm_play_count%, indicated 15 plays as seen in the previous screenshot. When played fully it changed to 15 actual plays and thus equals %lastfm_play_count%, the actual checked scrobble is also 15. So now I have this particular track correct while all other are off by 1.
If I disable increments, restart foobar all other tracks are correct but now it's Stories From the Streets that's wrong. %lastfm_play_count% is at 14 and only when I import it gets corrected to 15.
I played the same track again this time with increments disabled and the %lastfm_play_count% doesn't increment. Again, only when importing does it sync back up.
I can see why you'd implement the increment option. It's ok for as long you don't create a full comparison list like I did. The numbers didn't make sense to me. Some were right, some were not and always off by 1.  I think I'll be handling this differently, I have a dynamic playlist of recently played tracks of the last 24hours and just gonna update them with an import and sync them back up that way.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: スラッシュ on 2019-04-09 15:23:50
I have a request: would it be possible that if the track is less than 30 seconds, to have %lastfm_play_count% simply show the %play_count% amount? Or alternatively make something like %play_count_enhanced% if that feels too inconsistent. This is because last.fm doesn't keep track of tracks less than 30 seconds long, I have to add:
Code: [Select]
$ifgreater(%length_seconds%,30,%lastfm_play_count%,%play_count%)
a bunch of times which is a bit awkward. Also, thank you again for this plugin, it's really great!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-09 20:51:03
I have a request: would it be possible that if the track is less than 30 seconds, to have %lastfm_play_count% simply show the %play_count% amount? Or alternatively make something like %play_count_enhanced% if that feels too inconsistent. This is because last.fm doesn't keep track of tracks less than 30 seconds long, I have to add:
Code: [Select]
$ifgreater(%length_seconds%,30,%lastfm_play_count%,%play_count%)
a bunch of times which is a bit awkward. Also, thank you again for this plugin, it's really great!
Unfortunately, I don't want to include %play_count% in the component itself because that relies on foo_playcount and doesn't come from this component. Probably 90% of users have that installed, but I still run into some who don't, and because I don't control foo_playcount it's hard to define a perfect solution there.

What I use everywhere in my personal theme is:
Code: [Select]
$max(%play_count%,%lastfm_play_count%)

// or
$puts(PC,$max(%play_count%,%lastfm_play_count%))
// combined with
$get(PC)
Using those is a little better for the use case where scrobbles were lost/missing/couldn't be found in last.fm.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: スラッシュ on 2019-04-10 01:25:30
Oh yeah that makes sense!  :D

I have another thing I noticed--a few tracks I have don't seem to give the right amount of scrobbles (even with the album tag turned off). For example this one:
(https://i.imgur.com/q4RtGeW.png)
Returns 0 plays even though you can see on my profile I have 43: https://www.last.fm/user/surasshu/library/music/ビートまりお/_/デスレーベル+95-97-02

A few other songs by this artist also give incorrect amounts, not always 0. This one gave me 25:
(https://i.imgur.com/liBlPUU.png)
But on last.fm it lists 52 scrobbles: https://www.last.fm/user/surasshu/library/music/ビートまりお/_/サイドストームあらし

Any ideas what might be causing this, something I missed?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-13 19:46:21
I have another thing I noticed--a few tracks I have don't seem to give the right amount of scrobbles (even with the album tag turned off). For example this one:
(https://i.imgur.com/q4RtGeW.png)
Returns 0 plays even though you can see on my profile I have 43: https://www.last.fm/user/surasshu/library/music/ビートまりお/_/デスレーベル+95-97-02
As you might imagine, the Japanese characters make it impossible for me to tell what's going because I can't really distinguish differences between them :D

Not sure what's happening here, but for debug purposes the best thing you can do is open up the console, start playback of a song having this issue, and then copy the last.fm URL that's shown in the console and paste it here. That'll enable me to debug.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-13 19:49:17
New Beta v4.0.0b4:

Changelog:
When playing a new song, add a 2 second delay before pulling scrobbles to prevent hammering and stop spurious requests for songs that no longer exist in your library [defeatable]

This feature was added by marc2k3, so more thanks to him for his continued contributions!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: スラッシュ on 2019-04-13 23:31:40
Understandable! I found another song with a special character in it that isn't getting the correct playcount: 5% TINT by Travis Scott. Also for デスレーベル 95-97-02 (for reference it's called "beatmario - death label 95-97-02") I noticed I was missing a space between the name and the dates, so with that fixed I somehow got 19 plays out of the 43 on last.fm.

Here's the URLs from the console for those songs:
Travis Scott - 5% TINT: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=surasshu&artist=Travis Scott&track=5% TINT&limit=200&format=json&page=1

ビートまりお - デスレーベル 95-97-02: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=surasshu&artist=ビートまりお&track=デスレーベル 95-97-02&limit=200&format=json&page=1

I figure one beatmario song is as good as any other one for diagnostic purposes, but let me know if you need more!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-16 03:14:59
Thanks, that's super helpful. I was stupidly not escaping %s so that wasn't working. Fixed now. The issue with your デスレーベル 95-97-02 is that duplicate scrobbles are being removed. See the tooltip on that option and see if you need to leave it checked or unchecked. Unchecking it shows the full 43 scrobbles.

v4.0.0b5
 - Escaping % in artist/title
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: スラッシュ on 2019-04-17 21:36:53
Thank you! Those scrobbles are almost certainly legitimate--My guess is that foo_audioscrobbler sent them in a batch and that is what gave them all the same timestamp. I'll probably have to suck it up and turn that setting off--the downside of having almost 15 years of scrobbles... varying quality :D

Anyway thank you for the update as well!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-04-24 03:00:19
The lastfm playcounts for new songs are forever stuck on 0 until I manually 'get scrobbles'. Is this expected behavior?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-24 16:10:09
The lastfm playcounts for new songs are forever stuck on 0 until I manually 'get scrobbles'. Is this expected behavior?
Scrobbles only get pulled when you play a song, or when you manually retrieve them. They don't automatically get pulled when a song is added to your library if that's what you're asking.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-04-24 17:30:38
Scrobbles only get pulled when you play a song, or when you manually retrieve them. They don't automatically get pulled when a song is added to your library if that's what you're asking.

No I mean it never moves from 0 even if I play it 100 times. Only if the playcount is 1 or higher it increments after each playback.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: davideleo on 2019-04-24 17:52:00
No I mean it never moves from 0 even if I play it 100 times. Only if the playcount is 1 or higher it increments after each playback.

Same here.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-24 19:22:45
No I mean it never moves from 0 even if I play it 100 times. Only if the playcount is 1 or higher it increments after each playback.
Okay, let me make sure I understand. You add a song to your library. This song has 10 scrobbles on last.fm. You hit play on the song, and %playcount% is 0 and %lastfm_playcount% is also 0.

Once the song has been played for a minute %playcount% shows 1 and %lastfm_playcount% now shows 10 or 11 (based on the increment setting). Is that correct?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-04-24 19:34:52
Okay, let me make sure I understand. You add a song to your library. This song has 10 scrobbles on last.fm. You hit play on the song, and %playcount% is 0 and %lastfm_playcount% is also 0.

Once the song has been played for a minute %playcount% shows 1 and %lastfm_playcount% now shows 10 or 11 (based on the increment setting). Is that correct?

No, I add a song to my library, it has 0 scrobbles on last.fm, 0 on %playcount% and 0 on %lastfm_play_count%.

After I play the track 1 time it has 1 scrobble on last.fm, 1 on %playcount% and 0 on %lastfm_play_count%.

Only after I manually click 'get lastfm scrobbles' in the context menu, %lastfm_play_count% jumps to 1.

Once the manual action has occurred no more intervention is needed, it will correctly increment %lastfm_play_count% by 1 after each play.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-24 22:04:35
Ahhh, now I understand the disconnect. As stated, the component only pulls last.fm scrobbles when playback starts or on a manual pull. When you play a song, %playcount% increments at 1 minute, but the scrobble is only sent as early as 50% playback (or way more likely after the song has finished). The "increment last.fm playcount when %playcount% increments" option is there to fake this behavior and try to keep the values in sync.

Now after you've played the song once, there are still zero scrobbles recorded for the song by the component, because it hasn't reached out to last.fm again to pull scrobbles for the song. The component doesn't add 1 to zero, because it can't differentiate between the following 3 use cases:


I currently don't "fake" scrobbles unless the component has pulled and found at least one scrobble because anything I do is going to be wrong in 2 of the 3 situations. Let me know your thoughts/feedback.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-04-24 23:54:21
I think I understand, but why is it checking for scrobbles at the start of playback instead of after playback if it causes this dilemma of trade-offs?

Nevertheless, pull on playback start does not work as intended. When I play a track 2 times (with a starting point of 0 scrobbles) %lastfm_play_count% still shows 0. This can only be fixed with a manual pull. I'll put a log below.

[00:36:34] Opening track for playback: "D:\Music Library\Pendant - Make Me Know You Sweet (2018)\06 - Pendant - OXI-GKK.mp3"
[00:36:38] foo_scrobble: Submitting track
[00:36:38] Found 0 plays in last.fm (since last recorded scrobble) of OXI-GKK
[00:42:57] Opening track for playback: "D:\Music Library\Pendant - Make Me Know You Sweet (2018)\06 - Pendant - OXI-GKK.mp3"
[00:43:01] foo_scrobble: Submitting track
[00:43:01] Found 0 plays in last.fm (since last recorded scrobble) of OXI-GKK

It seems that the lastfm query is skipped altogether. Again, this does not occur when the initial value of %lastfm_play_count% is anything else than 0.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-25 17:42:13
The time stamps on those logs seem suspect to me. At 36:34 you start playing the song and at 36:38 foobar submits a scrobble, but that scrobble isn't for the song you're playing, it's the previous song. At 42:57 you start playing the same song again, and at 43:01 the scrobble for the previous play is submitted and at the exact same timestamp, we pull scrobbles. This seems like the last.fm API hasn't had a chance to record the scrobble yet when we're checking again. What happens if you play the song, play a different song, then play the first song again? Or just play that song the an hour or day later without manually pulling scrobbles for it in the interim.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-04-25 22:06:51
The time stamps on those logs seem suspect to me. At 36:34 you start playing the song and at 36:38 foobar submits a scrobble, but that scrobble isn't for the song you're playing, it's the previous song. At 42:57 you start playing the same song again, and at 43:01 the scrobble for the previous play is submitted and at the exact same timestamp, we pull scrobbles. This seems like the last.fm API hasn't had a chance to record the scrobble yet when we're checking again. What happens if you play the song, play a different song, then play the first song again? Or just play that song the an hour or day later without manually pulling scrobbles for it in the interim.
Well, I went to test it out but I updated to 4.0b5 before I did and the problem does not occur anymore. Something changed between v3.0.7 and v4 that fixed the issue.

My question from the previous post still stands though, why is it checking for scrobbles at the start of playback instead of after playback if it causes this dilemma of trade-offs?

Btw I would like to thank you for this component and your support here.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-04-26 03:59:18
Well, I went to test it out but I updated to 4.0b5 before I did and the problem does not occur anymore. Something changed between v3.0.7 and v4 that fixed the issue.

My question from the previous post still stands though, why is it checking for scrobbles at the start of playback instead of after playback if it causes this dilemma of trade-offs?

Btw I would like to thank you for this component and your support here.
Interesting. The last.fm API endpoint changed between 3.0.7 and 4.0.0b5, and they hit completely different databases apparently. The beta version uses the latest and greatest which is supposed to update faster. I expect that accounts for what you were seeing.

At minimum we have to pull scrobbles at playback start. If you only scrobble from foobar it doesn't matter, but if you're like me and you scrobble from iPod, and Android phone, you could have played a song X number of times between the last time you played it in foobar, and then the last.fm playcount in foobar would be X scrobbles out of date until the song was over. This particularly matters if you're trying to display this information while the song is playing (like I do) and don't care so much how accurate it is in a playlist.

The reason pulling afterwards doesn't work as well is that there could very well be a race condition between when we request scrobbles and when your scrobbling component submits them. How long do we wait before making the request? This matters a lot more if you're using foo_audioscrobbler where scrobbles often get queued up and aren't submitted right away. Now, I could pull before and after, and just hope for the best. I might make that an option if people find they really want it.

Thanks for the kind words :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-04-26 12:44:56
I understand. The before and after approach could work if you can solve the race condition problem. Maybe a customizable delay after playback, but that could complicate things too much.

Honestly I was (and am) still using the old Last.fm Playcount Sync (https://hydrogenaud.io/index.php/topic,76772.0.html) by marc and it works very well still, but it relies on customdb which is not supported by columnsui anymore. Anyway, it seems to always have accurate lastfm playcount stats during and after playback, I don't know how it manages that though (I guess you could ask marc  :-X). It also supports lastfm autocorrected song titles which enhanced playcount cannot deal with atm (api limitation?).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: davideleo on 2019-04-26 15:19:24
Now after you've played the song once, there are still zero scrobbles recorded for the song by the component, because it hasn't reached out to last.fm again to pull scrobbles for the song.
Thanks for the explanation @MordredKLB, now at least the component's behavior has a logic. I'm not sure I understand the race condition problem, but for my needs this is a major flaw that almost makes the component useless. I'm not really interested in the precise number of scrobbles, but rather in whether I've listened to the track before or not. Never listened to before means not processed by me (tags checking, replaygain, beatunes analysis, etc..). I have an autoplaylist of unlistened tracks based on %lastfm_play_count% , which I use when I want to spend some time fixing "unprocessed" tracks and I expect the playlist to actually bring up such tracks. Instead, already processed tracks are still in the playlist until they're scrobbled twice.


it relies on customdb which is not supported by columnsui anymore.
Are you sure about this? I mean, customdb is officially not supported and actually deprecated, but I'm currently using it with columns UI 1.0.0 and it works as with previous columns UI versions.


Honestly I was (and am) still using the old Last.fm Playcount Sync (https://hydrogenaud.io/index.php/topic,76772.0.html) by marc
I was never able to find that script online, would you mind sharing it?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-04-26 15:45:30
I have an autoplaylist of unlistened tracks based on %lastfm_play_count% , which I use when I want to spend some time fixing "unprocessed" tracks and I expect the playlist to actually bring up such tracks. Instead, already processed tracks are still in the playlist until they're scrobbled twice.
This is exactly my use-case as well, so I guess it would benefit more people to add that functionality.

Regarding the other stuff you mentioned, I will private message you about that as to stay on-topic.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-05-03 21:50:38
I have an autoplaylist of unlistened tracks based on %lastfm_play_count% , which I use when I want to spend some time fixing "unprocessed" tracks and I expect the playlist to actually bring up such tracks. Instead, already processed tracks are still in the playlist until they're scrobbled twice.
Simple solution: for now, don't use %lastfm_play_count%. Use a combination of %play_count% and %lastfm_play_count% and make sure both of them are zero.

Going forward I plan to do two things:
1) Use the same +1 logic for %lastfm_play_count% if we have an existing record for the song with a %play_count% saved. That means the song was played at least once with the component, and we can assume was probably scrobbled at that time.
2) Try and do a %play_count_enhanced% like I've done elsewhere that returns the greater of %play_count% and %lastfm_play_count%. Not sure this will work perfectly since I don't provide %play_count% (and why I didn't do it before) but I'll give it a go.

3) I might consider doing the pull scrobbles after song ends thing, but that gets kinda tricky. Will see.

For now, I just reformatted my computer and have to reinstall everything before I can work on this again.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: davideleo on 2019-05-04 14:15:43
Simple solution: for now, don't use %lastfm_play_count%. Use a combination of %play_count% and %lastfm_play_count% and make sure both of them are zero.

I'm aware of that solution and of your recommendation to use foo_playcount in combination with your component, but it has proven to be so unreliable in the past (not the component itself, but internal playcounters in general, given how often I tweak, crash and rebuild my foobar2000) that I'd rather do without, for now. I guess I will do some mass-scrobble-pulling every now and than to keep lastfm playcounts updated, but if you ever make up your mind on solution number 3, you already have my support.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-05-04 23:30:02
but it has proven to be so unreliable in the past (not the component itself, but internal playcounters in general, given how often I tweak, crash and rebuild my foobar2000) that I'd rather do without, for now.
Ahhh, so you aren't using foo_playcount. That makes a little more sense. FTR, foo_playcount + foo_jesus + moving your index_data folder to dropbox or some other cloud storage location (and symlink/junction it back to the foobar folder) makes it basically bulletproof.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: firewater on 2019-05-10 22:02:07
I'm wondering if I could use this to update my local playcount, via the %lastfm_played_times% feature. Let me explain - I don't use last.fm, but I've been maintaining %play count% values locally for years now. I do almost all my listening on my computer, so the only time this is a problem is when I listen from my phone. There, I have a last.fm scrobbler installed, which caches a list of the played tracks on the phone. So what I do is every end of the week I go through this list, and manually update every single song mentioned back on my computer files, and then nuke the cache. It can get really time-consuming when I've got 100+ entries to update, so I've been looking for an upgrade to this method, and the one thing that occurs to me is to make a last.fm account for only my phone, actually scrobble the cache to it, use this plugin to tag %lastfm_played_times% in my computer, and then with some other plugin tag %playcount% + %lastfm_played_times% = %playcount%. Does that make sense to you? Or, do you think there's an easier way perhaps?

Some problems that I can think of if I do it: (1) does this plugin retrieve %lastfm_played_times% from "artist - album - track", or just "artist - track"? Because if the latter, then I'd have the problem of the same song being tagged twice if present on both a studio album and compilation (2) it seems to me that every time I'd run this hypotethical %playcount% + %lastfm_played_times% = %playcount% equation, I'd have to nuke all my last.fm playcounts so that they don't get added to the sum the next time, correct?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: benerogerio on 2019-05-11 00:30:42
Is there an way to import in to another variable the global playcount of an track from last.fm instead my personal playcount?
I want to create a autoplaylist that rank my songs sorting by most played songs in last.fm.
Thank you guys.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: miras on 2019-05-11 14:09:47
Hi, the plugin has stopped working for me.

Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=m1rass&artist=Jorge+Ben&limit=200&format=json&page=1
Found 0 plays in last.fm (since last recorded scrobble) of Jazz Potatoes
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-05-13 16:24:00
I'm wondering if I could use this to update my local playcount, via the %lastfm_played_times% feature. Let me explain - I don't use last.fm, but I've been maintaining %play count% values locally for years now. I do almost all my listening on my computer, so the only time this is a problem is when I listen from my phone. There, I have a last.fm scrobbler installed, which caches a list of the played tracks on the phone. So what I do is every end of the week I go through this list, and manually update every single song mentioned back on my computer files, and then nuke the cache. It can get really time-consuming when I've got 100+ entries to update, so I've been looking for an upgrade to this method, and the one thing that occurs to me is to make a last.fm account for only my phone, actually scrobble the cache to it, use this plugin to tag %lastfm_played_times% in my computer, and then with some other plugin tag %playcount% + %lastfm_played_times% = %playcount%. Does that make sense to you? Or, do you think there's an easier way perhaps?

Some problems that I can think of if I do it: (1) does this plugin retrieve %lastfm_played_times% from "artist - album - track", or just "artist - track"? Because if the latter, then I'd have the problem of the same song being tagged twice if present on both a studio album and compilation (2) it seems to me that every time I'd run this hypotethical %playcount% + %lastfm_played_times% = %playcount% equation, I'd have to nuke all my last.fm playcounts so that they don't get added to the sum the next time, correct?
Wow, that's a lot of work. You could do that, but you would have to manually clear all last.fm scrobbles after every pull.

What I'd do if I were you is to not manually update the %playcount%. Start scrobbling to last.fm, and then in your theme instead of showing %playcount% show $add(%playcount%, %lastfm_playcount%). It's a little more work if you use it in a bunch of spots in your theme, but you can easily do a $puts(playcount, $add(%playcount%, %lastfm_playcount%)) at the start of your theme, and then just use $get(playcount) everywhere and it's pretty simple.

The plugin has the option (on by default) to compare with album name as well. Be aware this toggle only works at pulling scrobble time. Switching it won't change the value of %lastfm_play_count% unless you clear the scrobbles for songs and repull.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-05-13 16:29:39
Hi, the plugin has stopped working for me.

Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getartisttracks&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=m1rass&artist=Jorge+Ben&limit=200&format=json&page=1
Found 0 plays in last.fm (since last recorded scrobble) of Jazz Potatoes

Looks like last.fm has officially killed the old API method. You'll have to update to the latest beta. I'll push it to the component registry and try and push a non-beta version later this week.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: firewater on 2019-05-19 03:54:37
Wow, that's a lot of work. You could do that, but you would have to manually clear all last.fm scrobbles after every pull.

What I'd do if I were you is to not manually update the %playcount%. Start scrobbling to last.fm, and then in your theme instead of showing %playcount% show $add(%playcount%, %lastfm_playcount%). It's a little more work if you use it in a bunch of spots in your theme, but you can easily do a $puts(playcount, $add(%playcount%, %lastfm_playcount%)) at the start of your theme, and then just use $get(playcount) everywhere and it's pretty simple.

The plugin has the option (on by default) to compare with album name as well. Be aware this toggle only works at pulling scrobble time. Switching it won't change the value of %lastfm_play_count% unless you clear the scrobbles for songs and repull.
I think your solution is very appropriate, thanks. Indeed it is a lot of work to do it the way I've been handling it, yesterday I spent more than an hour in what is probably the last time (hooray!). Okay so after installing the plugin, I realize it works like the base plugin, obviously, in that the data is retrieved after playback. Not ideal for me since I'd have to play the song here on the computer for it to get updated. I'll look into implementing the apparently still-working marc script, or doing this (https://hydrogenaud.io/index.php/topic,111891.0.html). Hopefully either works. Thanks again for orienting me, and keeping last.fm sync alive!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-06-30 19:40:55
Huge beta update today (sorry for never getting out of beta in the last one... it's stable):

Big change here is no more synchronous last.fm API calls. When manually pulling scrobbles no longer wait for previous request and instead use the thread pools marc2k3 recommended to me to make async calls once per 200ms (the last.fm API rate limit). Now when retrieving scrobbles for 100 songs or more the action happens 5x faster minimum (probably closer to 10-20x).

This change is going to lay the groundwork for this component retrieving recent scrobbles automatically, so please test it out if you can.

NOTE: Unlike almost every other beta I've done, this one carries a warning. There is a non-zero chance that I've done the thread safety stuff incorrectly and your enhanced_playcount DB could be corrupted and you'd lose all that data. I suggest making a backup of index-data/0C1BD000-43E7-4078-B885-48EE4249DEC3 first before manually pulling scobbles. I've been using it just fine and tried to break it multiple times and can't, but we're dealing with race conditions and other weirdness so I might've missed something. Feel free to review my PR (https://github.com/kbuffington/foo_enhanced_playcount/pull/4) if you're so inclined.

v4.1.0b1
 - No more synchronous last.fm API requests
 - refresh metadb every 25 songs updated
 - refactored some code to make maintenance easier
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-05 06:41:40
I'm assuming since nobody reported anything that the previous beta was working well. New version out today which refactored a bunch of code, removed some dead code, and added... automatic recent scrobble pulling on startup! When foobar starts, the component pulls the last 200 scrobbles and checks your entire library to see if any songs need to be updated.

This is very much a work in progress and will change drastically in the next week or two, although it should work perfectly fine now.
Eventually it'll pull new scrobbles and retrieve older scrobbles to make sure your last.fm scrobble count is up to date. Right now this can't be disabled, although options will be added. It will also dumbly pull and check the last 200 scrobbles no matter what, so if you open foobar wait 2 minutes for the check to finish, close foobar and reopen it'll recheck the same exact songs. That's my first order of business to change. It also doesn't honor your "check album" setting either. That's beta3 as well.

As always, let me know if I screwed something up.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: DVS on 2019-07-06 06:13:42
something wrong with beta 2
foobar2000 has crashed
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-06 06:23:23
something wrong with beta 2
foobar2000 has crashed
Can you give me a little more information about when it crashed (i.e. at startup)? What you were doing when it crashed? Were you manually pulling scrobbles? Is it repeatable?  Can you supply a debug log?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: DVS on 2019-07-06 06:55:57
Just replacing beta 1 with beta 2 (Launch is interrupted by an error)
I hope the attached information will be useful.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: DVS on 2019-07-06 09:41:45
Just deleted \configuration\foo_enhanced_playcount.dll.cfg, and the problem is solved.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-06 15:49:21
Just deleted \configuration\foo_enhanced_playcount.dll.cfg, and the problem is solved.
You don't happen to have a backup copy of your config file from foo_jesus or something, do you? I didn't make any changes to the configuration settings between beta1 and beta2 so this is pretty weird.Nevermind, I spotted the issue from the minidump and replicated locally. Thanks!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-07-06 18:05:15
I have the same problem with the same solution. I'll add both config files (one causes crash, one does not) so you can look at it.

EDIT: On second look, the only difference between the two is that one has my lastfm username and the other does not. So this is really not a fix as it just disables scrobble pulling at all. When I add my lastfm username it crashes again.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-06 18:26:51
Yup, after thinking further I realized that was what was going on. Fortunately the minidump was enough for me to spot the issue (I wasn't handling the case where a scrobble didn't have an album name listed).

I present 4.1.0b3 - This version automatically pulls recent scrobbles and legacy scrobbles. There's no way to defeat this right now, but I'll add that before an official release.
On startup I pull the 1000 most recent scrobbles and check each song in the library that matches them and then pull all scrobbles for those songs. I then record the newest and oldest scrobble I pulled in this manner.
Every 12 songs played after that (roughly an hour I'm hoping?) I pull the 1000 scrobbles older than than the earliest scrobble known and then check each song individually.
EVENTUALLY all scrobbles for your entire library will have been pulled (I hope).

I also fixed the crash that was reported by DVS and Odinos.

Whoops, premature. Just found another crash....
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-06 20:23:12
v4.1.0b4
 - Fixed more crashes
 - threading recent scrobble puling now to avoid blocking UI
 - only pulling 500 instead of 1000 right now.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: DVS on 2019-07-08 00:46:25
Beta 4, Still crashes. After deleting the configuration, it works, but after adding the username, it crashes again.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-07-08 01:12:46
Beta 4, Still crashes. After deleting the configuration, it works, but after adding the username, it crashes again.
Works fine here
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-08 04:46:42
Beta 4, Still crashes. After deleting the configuration, it works, but after adding the username, it crashes again.
Give me another crash minidump if you can, and also your last.fm username if you wouldn't mind.

Works fine here
It's related to the tags or whatever is in last.fm. Most likely it's bogus data which is causing the library search query to be invalid (it's particularly finnicky). At the moment I'm not gracefully handling crashes there so I can track down these error corner cases.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: DVS on 2019-07-08 08:01:59
another crash minidump,
davserg (last.fm)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-08 10:42:23
Thanks. The issue was with songs containing double-quotes (particularly this one (https://www.last.fm/music/А.+Недбальский/_/"Адский+галоп"+(Канкан)+из+оперетты+"Орфей+в+аду"))

Fixed in beta 5. I was able to pull your entire recent scrobble list without issue (the first 500 songs anyway).

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: DVS on 2019-07-08 18:05:36
Works great, thanks!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-09 07:53:21
Hopefully the last beta. Fixed a few more niggling issues,

v4.1.0b6 - Better handling of strings with double-quotes (it didn't crash, but it was impossible to get matches for these until now)
 - Pull new scrobbles every 5 plays
 - Pull legacy every 12
 - If quitting, abort threads immediately (fixed a deadlock issue when quitting during a pull)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-07-17 16:58:30
I would like to make 2 feature requests with regards to the lastfm integration. Currently in these cases lastfm plays are stuck on 0 in my library.

The first one is for custom field mappings. For example, I use '$if2([%conductor%],[%artist%])' as artist field in foo_scrobble. Obviously the artist that foo_enhanced_playcount retrieves from lastfm does not match up anymore with the artist tag in the song. Ideally your component copies the field mappings from foo_scrobble or at least allows to set them manually.

(https://dl.dropboxusercontent.com/s/6op2t5mg9nkxagz/foobar2000_2019-07-17_17-53-44.png)

Second request is to take into account lastfm autocorrected tags. There are many cases where lastfm incorrectly autocorrects to a different title/artist, when foo_enhanced_playcount retrieves those scrobbles back they do not match up with the tags in my library and thus remain on a playcount of 0.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-17 18:42:14
I really like the first idea. I'll take a look at implementing that in the near future.

As for the 2nd, I don't think there's a way to know what the originally played artist/title was to track them back. If you can give me an example from your own getRecentTracks call that you can point me to of a track that was corrected I can verify this. I've just looked through about 2000 tracks looking for something that was designated as autocorrected and couldn't find anything.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-18 07:22:42
Finally this feature seems ready to go:

v4.1.1
 - Option to defeat auto pull in configuration
 - Autopull pulls 1000 songs at a time again
 - Config shows when the next historical pull will start from, and allows you to restart from most recent scrobble
 - It was possible in some weird confluence of events for you be to pulling historical scrobbles from 2019 and the next pull could be years previously (despite thousands of songs in between). This should be impossible now
 - Once we reach the end of the scrobble list, start over from most recent date
 - Better prevention of querying last.fm for the same song twice
 - Prevent unnecessary last.fm queries for songs that were pulled back in versions 1.5 to 2.0.2

This is a soft release and if nobody reports any issues, I'll update it in the official registry.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-07-18 11:10:37
If you can give me an example from your own getRecentTracks call that you can point me to of a track that was corrected I can verify this.

Here is a query to an autocorrected scrobble: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Kelela&track=Guns%20%26%20Synths&limit=200&format=json&page=1

You can see the track parameter in the query is "Guns & Synths", which is the title in my library. However the query returns 3 scrobbles for "Guns & Synths (Prod. Bok Bok)". These scrobbles are not recognized and applied atm.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-23 17:12:19
v4.1.2 is up in the component registry. Fixes two issues:
 - Songs with an apostrophe in the album or title were not having scrobbles automatically checked
 - If you started up foobar and there were no songs scrobbled since the last check, the historical scrobble check would reset
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-23 18:26:46
Here is a query to an autocorrected scrobble: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Kelela&track=Guns%20%26%20Synths&limit=200&format=json&page=1

You can see the track parameter in the query is "Guns & Synths", which is the title in my library. However the query returns 3 scrobbles for "Guns & Synths (Prod. Bok Bok)". These scrobbles are not recognized and applied atm.
I think the solution here is to stop checking to see if the song title matches. This was required when we had to do artist queries, but now that the plugin does getTrackScrobbles instead it *should* be okay to skip this comparison. i'm gonna do a little more testing and then roll this out if I can't find any conflicts.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-07-26 15:58:58
I found a bug with retrieving scrobbles, when the title of a track contains a "+" the query doesn't return scrobble data. Two examples:
http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Thee Oh Sees&track=Strawberries 1+2&limit=200&format=json&page=1 (http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Thee Oh Sees&track=Strawberries 1+2&limit=200&format=json&page=1)
http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Varg&track=(+46) Placing My IPhone X Facing Up To See When U Answer My Texts&limit=200&format=json&page=1 (http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Varg&track=(+46) Placing My IPhone X Facing Up To See When U Answer My Texts&limit=200&format=json&page=1)

And here the query works correctly:
http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Thee Oh Sees&track=Strawberries 1%2B2&limit=200&format=json&page=1 (http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Thee Oh Sees&track=Strawberries 1%2B2&limit=200&format=json&page=1)
http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Varg&track=(%2B46) Placing My IPhone X Facing Up To See When U Answer My Texts&limit=200&format=json&page=1 (http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Varg&track=(%2B46) Placing My IPhone X Facing Up To See When U Answer My Texts&limit=200&format=json&page=1)

In this case I changed "+" with the uri encoded version "%2B". I'm not aware of any more cases like this with other characters, but it may be worth investigating.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-26 18:45:33
I found a bug with retrieving scrobbles, when the title of a track contains a "+" the query doesn't return scrobble data. Two examples:
http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Thee Oh Sees&track=Strawberries 1+2&limit=200&format=json&page=1 (http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Thee Oh Sees&track=Strawberries 1+2&limit=200&format=json&page=1)
http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Varg&track=(+46) Placing My IPhone X Facing Up To See When U Answer My Texts&limit=200&format=json&page=1 (http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Varg&track=(+46) Placing My IPhone X Facing Up To See When U Answer My Texts&limit=200&format=json&page=1)

And here the query works correctly:
http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Thee Oh Sees&track=Strawberries 1%2B2&limit=200&format=json&page=1 (http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Thee Oh Sees&track=Strawberries 1%2B2&limit=200&format=json&page=1)
http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Varg&track=(%2B46) Placing My IPhone X Facing Up To See When U Answer My Texts&limit=200&format=json&page=1 (http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=Odinoss&artist=Varg&track=(%2B46) Placing My IPhone X Facing Up To See When U Answer My Texts&limit=200&format=json&page=1)

In this case I changed "+" with the uri encoded version "%2B". I'm not aware of any more cases like this with other characters, but it may be worth investigating.
Thanks!

Fixed in 4.1.3 which is available now.

BTW: while doing sanity checks of other "special" characters, I found 3 songs that last.fm refuses to allow to be scrobbled. Check out Song #7 here: https://www.last.fm/music/Psychostick/Do
I thought things were broken on my end until I checked the # of scrobbles on that page. Pretty sure they're ignoring them as they think that whatever last.fm client being used is sending bogus data (i.e. a filename).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2019-07-28 18:15:55
Thank you MordredKLB for the active development :-)

Question aka Feature Request:

can we have some more information in the console, like

Code: [Select]
[19:10:41] Found 1 scrobbles in last.fm of "Renegades Of Acid Trance"

will be shown as

Code: [Select]
[19:10:41] Found 1 scrobbles in last.fm of "Renegades Of Acid Trance (01.02.2003)"

I like to see some sort of date, when looking at the console. We can display the dates in a panel, so displaying it in the console too would be easy and nice too 8-]

What to do, if 15 dates are found?
Just display the first and the last.

Code: [Select]
[19:10:41] Found 15 scrobbles in last.fm of "Renegades Of Acid Trance (01.02.2003 ... 04.05.2006)"

Thanks and Keep up the good work ;-)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2019-07-28 18:20:50
The first one is for custom field mappings. For example, I use '$if2([%conductor%],[%artist%])' as artist field in foo_scrobble. Obviously the artist that foo_enhanced_playcount retrieves from lastfm does not match up anymore with the artist tag in the song. Ideally your component copies the field mappings from foo_scrobble or at least allows to set them manually.
(https://dl.dropboxusercontent.com/s/6op2t5mg9nkxagz/foobar2000_2019-07-17_17-53-44.png)
I'd prefer the at least allows to set them manually part to have maximum freedom :-)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-07-28 23:42:17
BTW: while doing sanity checks of other "special" characters, I found 3 songs that last.fm refuses to allow to be scrobbled. Check out Song #7 here: https://www.last.fm/music/Psychostick/Do
I thought things were broken on my end until I checked the # of scrobbles on that page. Pretty sure they're ignoring them as they think that whatever last.fm client being used is sending bogus data (i.e. a filename).
Yes, I noticed that too. I have no idea how people are scrobbling this album (I can't) https://www.last.fm/music/ESPRIT+空想/virtua.zip (https://www.last.fm/music/ESPRIT+空想/virtua.zip)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-07-29 06:42:07
v4.1.4 - No longer comparing song titles since we search by song titles. This should handle the issue with last.fm auto-correcting songs.

Not publishing this one just yet cause I'd like to get a few more eyes on it first and make sure I didn't miss anything.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2019-09-18 00:33:20
Hi, I'm using v4.1.4 with f2k1.5b15 and
my historical scrobble pull is stuck on 2018-07-14 for days.

I had experienced another "stuck" some weeks before and pressed the "reset pull date" button and then it worked for some days and get stucked again.

Also, if I deactivate the
I found this on the console. Not sure, if it relays to the problem.
Code: [Select]
[01:01:06] Found 0 scrobbles in last.fm of "Heavy Gruts"
[01:01:07] Track scanned in 1349.001 ms
[01:01:09] last.fm Error: Operation failed - Most likely the backend service failed. Please try again.
and
Code: [Select]
[01:18:13] Opening track for playback: "C:\Users\mp3\frog pocket\04.mp3"
[01:18:14] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Frog Pocket&track=Windy Goule&limit=200&format=json&page=1
[01:18:14] Found 0 scrobbles in last.fm of "Windy Goule"
[01:18:35] Opening track for playback: "C:\Users\mp3\few nolder - no mo EP (2008)\few_nolder-no_mo.mp3"
[01:18:35] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Few Nolder&track=No Mo&limit=200&format=json&page=1
[01:18:36] Found 0 scrobbles in last.fm (since last known scrobble at 2019-09-18 01:12:15) of "No Mo"
[01:19:52] Opening track for playback: "C:\Users\mp3\few nolder - no mo EP (2008)\few_nolder-brenn.mp3"
[01:19:53] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Few Nolder&track=Brenn&limit=200&format=json&page=1
[01:19:53] Found 0 scrobbles in last.fm of "Brenn"
[01:20:28] Opening track for playback: "C:\Users\mp3\few nolder - no mo EP (2008)\few_nolder-no_mo.mp3"
[01:20:28] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Few Nolder&track=No Mo&limit=200&format=json&page=1
[01:20:29] Starting to pull legacy scrobbles (before 1531568361)
[01:20:29] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=1
[01:20:29] Found 0 scrobbles in last.fm (since last known scrobble at 2019-09-18 01:12:15) of "No Mo"
[01:20:30] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=2
[01:20:32] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=3
[01:20:34] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=4
[01:20:36] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=5
[01:21:04] Opening track for playback: "C:\Users\mp3\few nolder - no mo EP (2008)\few_nolder-brenn.mp3"
[01:21:04] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Few Nolder&track=Brenn&limit=200&format=json&page=1
[01:21:05] Found 0 scrobbles in last.fm of "Brenn"
Any Ideas?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-09-18 20:58:48
@fuffi That's a very interesting issue. Is there any possibility that none of the 1000 songs in your 5 getRecentTracks calls still exist in your library?

Here's the way the logic flow works:
* we query for the first 1000 songs based on the last checked timestamp.
* We take that list of 1000 songs and remove duplicates
* We iterate through that list and search for each song in our library and retrieve the record of last.fm values for it
* If we don't have a record, or the timestamp from the play in last.fm is after the last recorded timestamp, we add that song to a new list of songs we need to pull scrobbles for later
HOWEVER, if we do have a record of last.fm scrobbles and the latest scrobble is equal or newer than the scrobble in the list that last.fm gave us, then we update the most recent timestamp value to the one that last.fm reported for us.

The reason for this it's much safer in case last.fm goes down. We won't mark a time stamp as checked unless we know it's already covered. It's still possible to miss scrobbles this way, but it's much more fault tolerant. Now, if none of the 1000 scrobbles that were pulled existed in your library then it would just bomb out on step 3.

If that's not the case (and it seems unlikely) then something else kind of insidious seems to be happening. I'd probably have to provide you with a debug version of the component to debug it further.

Edit: One possible thing you could do to try and get things moving again is to open up http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=5 in a browser, and find the last song in the list. Copy a file in your library, and then in foobar copy the artist, album, and name fields exactly from the JSON and paste it into your file. Then play 12 songs to trigger the update. You'll probably need to play *another* 12 songs (you can just start and then immediately stop, or switch tracks rapidly), and then it should move the date back.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2019-09-18 21:15:34
thanks,
please provide the debug version :-)

@fuffi That's a very interesting issue. Is there any possibility that none of the 1000 songs in your 5 getRecentTracks calls still exist in your library?
It is possible, but unlikely, I guess too.
Sometimes foobar2000 plays completely new music (i.e. label compilations, or artists discographies) which have never been scrobbled before.

But I'm really curious, why the component stucks on this particular date
because it has to go back to 2007 IMHO, last.fm shows 227,924 Scrobbles and  43,051 Artists.

Question: where is the library located, which is used to store the fetched queries?

EDIT:
regarding your EDIT:
Ok, the last entry...it was a good guess >;-)

Artist Field  "Bebe Rexha"
Album Field  "All Your Fault Pt. 1" and
Track Field  "Bad Bitch"

I will try and give feedback. (please see screenshot "playlist". that should do it, I guess?)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2019-09-18 23:11:34
...aaaaand too late to edit my post... so a new one...

Something seems to happen, but I don't know why or what:
Code: [Select]
[23:33:38] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Last Step&track=Seafoam Green&limit=200&format=json&page=1
[23:33:38] Found 0 scrobbles in last.fm of "Seafoam Green"
[23:35:37] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Céline Dion&track=Because You Loved Me&limit=200&format=json&page=1
[23:35:38] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Helen Merrill&track=My Favorite Things&limit=200&format=json&page=1
[23:35:38] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Clarke-Boland Big Band&track=My Favorite Things&limit=200&format=json&page=1
[23:35:38] Found 0 scrobbles in last.fm of "Because You Loved Me"
[23:35:38] Found 0 scrobbles in last.fm of "Summertime"
[23:35:38] Found 0 scrobbles in last.fm of "My Favorite Things"
[23:35:39] Found 0 scrobbles in last.fm of "My Favorite Things"
[23:35:39] Found 0 scrobbles in last.fm of "Summertime"
[23:35:39] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Janis Joplin&track=Summertime&limit=200&format=json&page=1
[23:35:40] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Ike Quebec&track=Nature Boy&limit=200&format=json&page=1
[23:35:40] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Miles Davis&track=Milestones&limit=200&format=json&page=1
[23:35:40] Found 0 scrobbles in last.fm of "Summertime"
[23:35:40] Found 0 scrobbles in last.fm of "Nature Boy"
[23:35:40] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=George Gershwin&track=Summertime&limit=200&format=json&page=1
[23:35:41] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Delegation&track=Put a little love on me&limit=200&format=json&page=1
[23:35:41] Found 0 scrobbles in last.fm of "Milestones"
[23:35:41] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Röyksopp&track=What Else Is There?&limit=200&format=json&page=1
[23:35:41] Found 0 scrobbles in last.fm of "Summertime"
[23:35:42] Found 0 scrobbles in last.fm of "What Else Is There?"
[23:35:42] Found 0 scrobbles in last.fm of "Put a little love on me"
The first song (Seafoam Green) was played during my test, all other songs weren't played the last months, nor have I clicked on them in f2k or any other player.

I have seen this:
Code: [Select]
[23:28:10] Starting to pull legacy scrobbles (before 1531568361)
[23:28:10] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=1
[23:28:10] Track scanned in 940.969 ms
[23:28:13] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=2
[23:28:14] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=3
[23:28:15] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Ceephax Acid Crew&track=Trabzonspor&limit=200&format=json&page=1
[23:28:16] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=4
[23:28:16] Found 0 scrobbles in last.fm of "Trabzonspor"
[23:28:18] Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=mykey&user=myuser&limit=200&format=json&to=1531568361&page=5
But the pull date still is stuck on the same date 2018-07-14 13:39:21 as in my first post. (see screenshot)

And, after playing the song as you described, this is the result:
Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=mykey&user=myuser&artist=Bebe Rexha&track=Bad Bitch&limit=200&format=json&page=1
Found 0 scrobbles in last.fm (since last known scrobble at 2018-06-22 12:28:02) of "Bad Bitch"

Please, if you provide a version with detailed debug information, make it save those infos to disk and not only log to console. I have too much other components writing to the console and its hard to separate the important lines from the useless ones ;-}

The last.fm screenshot contains music by daft punk, which was played simultaneously from iTunes, you can ignore it. All other songs are played via f2k like the playlist I screenshotted in my post above.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Awesomeo on 2019-10-10 12:45:52
Do you ever plan to implement manual importing (and exporting to xml too) of statistics?
I hadn't considered it before. If I were to ever do something like this, I'd probably export to JSON because it's easier to work with IMO.
Ten months later, have you reconsidered maybe?

It would be so much more convenient if I could have control over my own listening statistics. Which I currently can't have either with regular statistics (first/last play only), last.fm (third party & commercial, extremely limited editing/correcting), listenbrainz (still in early beta, sparse functionality) or your plugin (no manual mass import).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-10-12 03:14:20
I actually really like the idea, but I'm not 100% sure how it could work. Are you looking for just changing playcounts, or also timestamps as well? Does it need to work with another tool/export format? Do you want to just change a few songs? Is this for backups or mass editing? Also the exports would be pretty huge for any reasonably large play history (100k plays).

Unfortunately I just haven't had a lot of time or motivation to work on this recently, and have been focusing on some other side projects. Also this isn't really a feature I personally need which means it's not top of my priority list.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Awesomeo on 2019-10-12 13:37:20
Like I posted at first in this thread:
Quote
I know there's the last.fm import option, but it doesn't really do much for me as my early years on last.fm are a mess. A couple of years ago I downloaded all my last.fm data and with some help of excel I managed to weed out outliers and finally adopt it for original playback statistics component. But it took time and manual tinkering and I'm 100% sure no automation can manage to do that without my own input. Also, you know, maybe one day sites like YouTube or Soundcloud will allow downloading user history through API - another case where manual import would prove useful.

Basically even importing from file tags would do. It doesn't have to be an xml importer like in foo_playcount. After all I can make a dummy copy of my library (3% length 6kbps opus previews) and copy the data to properly formatted foo_enhanced_playcount file tags (%played_times%, %played_times_js% or %played_times_raw%, doesn't matter). It's just the last step to get this data into foo_enhanced_playcount db that's missing.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Odinos on 2019-10-15 02:29:25
I am encountering cases where the value of %lastfm_play_count% are higher than what is returned by the lastfm query. Even after clearing saved plays and retrieving them again. It seems to happen when I pause playback mid-track and continue after a relatively long time (10+ mins). I can try to find more specific steps if you can't reproduce it.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-10-21 22:37:19
I am encountering cases where the value of %lastfm_play_count% are higher than what is returned by the lastfm query. Even after clearing saved plays and retrieving them again. It seems to happen when I pause playback mid-track and continue after a relatively long time (10+ mins). I can try to find more specific steps if you can't reproduce it.
I'm very curious if you can come up with more solid steps to reproduce this.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-11-08 06:34:35
Testing out version 4.2.0 now. Please give it a try and let me know if you encounter any issues.

Changes:
 
SimplePortal 1.0.0 RC1 © 2008-2019