HydrogenAudio

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
v5.0.0 - 2023-03-22

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:
 
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-11-27 19:02:24
4.2.1 fixed a regression from 4.2.0
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: fuffi on 2019-11-29 12:16:12
  • Field mappings are finally present. You can supply Artist, Album, and Title titleformatting strings. I don't know why you'd ever change anything other than Artist, but you can!

Just to give a valid reason:

I used to store remix or featuring information in other tags and stripped them from the artists and/or track tags to have a working "search for similar" (foo_quicksearch) option.

searching for similar track-titles only would work, if the title is exactly the same, but a title "good sound" and "good sound feat. dj bobo" or "good sound (dj bobo remix)" wouldn't not be similar, so I stripped "feat. dj bobo" or "(dj bobo remix)" from the tags and stored them elsewhere.

The drawback is, when scrobbling via last.fm component, only the stripped tags were sent to last.fm, so, for last.fm, I never listened to a remix of "good sound", but only to "good sound". This is especially bad, if you listen to a lot of electronic music, where there are a lot of remixes of a single track.

Glady, the last.fm component has a field mapping, like this wonderful component has now too! ;-D
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-11-30 06:42:24
That actually makes perfect sense! Glad it's working out!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jyra on 2020-01-25 18:10:40
Thanks for this useful component. It works well outside one issue.

I can't get any last.fm scrobbles for tracks that contain certain punctuation characters in their title or album field:
Code: [Select]
(
)
,

This is the error message that shows up in the console:

Code: [Select]
foo_enhanced_playcount: Exception making call to last.fm. Returning empty response.

I see that punctuation is mentioned in the change log, so I'm not sure if this just some problem on my end or not.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-01-26 08:05:07
Thanks for this useful component. It works well outside one issue.

I can't get any last.fm scrobbles for tracks that contain certain punctuation characters in their title or album field:
Code: [Select]
(
)
,

This is the error message that shows up in the console:

Code: [Select]
foo_enhanced_playcount: Exception making call to last.fm. Returning empty response.

I see that punctuation is mentioned in the change log, so I'm not sure if this just some problem on my end or not.
That's weird. I haven't seen any issues like this. Can you post the entire URL of the call that is being made to last.fm?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jyra on 2020-01-26 20:20:04
That's weird. I haven't seen any issues like this. Can you post the entire URL of the call that is being made to last.fm?

My bad, the problem is definitely on my end. I use foobar2000 under Wine and can't get any scrobbles now. I used a Windows VM before that which worked fine.

Do you happen to have an idea what could be needed to make it work? I have already tried installing .NET framework 2.0/3.0 but that didn't help.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-01-27 23:50:43
My bad, the problem is definitely on my end. I use foobar2000 under Wine and can't get any scrobbles now. I used a Windows VM before that which worked fine.

Do you happen to have an idea what could be needed to make it work? I have already tried installing .NET framework 2.0/3.0 but that didn't help.
Unfortunately I don't. I run my foobar inside VMware Fusion on my OSX box.

This is my code that makes the call:
Code: [Select]
		try {
response = request->run_ex(url, callback);
response->read_string_raw(buf, callback);
} catch (...) {
FB2K_console_formatter() << COMPONENT_NAME": Exception making call to last.fm. Returning empty response.";
buf = "{}";
cacheable = false;
}

It seems likely that request->run_ex is not able to work correctly in your current configuration. Might be worth googling for run_ex (it's a fb2k API) and WINE on this forum.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-01-29 19:49:15
Do you happen to have an idea what could be needed to make it work? I have already tried installing .NET framework 2.0/3.0 but that didn't help.
Here's a version with improved error logging. Let me know what that tells you. Thanks to marc2k3 for the code suggestion!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Nassoo on 2020-02-08 11:41:46
Hi! Thanks fo the wonderful plugin, MordredKLB!

I've got a problem with some songs, they are nor scrobbled at all, I suppose it's because of the ' character in the artist name. For example:

Code: [Select]
Opening track for playback: "E:\MP3\The Blues Collection\41 - Memphis Jug Bands - Walk Right In\01 - Bring It With You When You Come.mp3"
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=nasssoo&artist=Cannon's Jug Stompers&track=Bring It With You When You Come&limit=200&format=json&page=1
Found 0 scrobbles in last.fm of "Bring It With You When You Come"

I hope you coud help me with thiis!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jazzthieve on 2020-02-08 13:29:36
You're in the wrong topic. This component doesn't scrobble. It "retrieves" scrobbles back from last.fm, it doesn't send them.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Nassoo on 2020-02-08 23:15:43
You're in the wrong topic. This component doesn't scrobble. It "retrieves" scrobbles back from last.fm, it doesn't send them.

Yeah, you're right about that :) But there's something wrong with the playcount too - I've managed to scrobble it with google music, and now I've got this:

Code: [Select]
Opening track for playback: "E:\MP3\The Blues Collection\41 - Memphis Jug Bands - Walk Right In\01 - Bring It With You When You Come.mp3"
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=nasssoo&artist=Cannon's Jug Stompers&track=Bring It With You When You Come&limit=200&format=json&page=1
Found 0 scrobbles in last.fm (since last known scrobble at 2020-02-09 01:06:24) of "Bring It With You When You Come"
ListenBrainz 2: {"status":"ok"}
Lastfm Playcount: Attempt: 2
Lastfm Playcount: Attempt: 3
Lastfm Playcount: Attempt: 4
Lastfm Playcount: Attempt: 5
Lastfm Playcount: Attempt: 6
Lastfm Playcount: Attempt: 7
Lastfm Playcount: Attempt: 8
Lastfm Playcount: Attempt: 9
Lastfm Playcount: Attempt: 10
Lastfm Playcount: Database error. Playcount not updated.
foo_scrobble: Submitting track
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-02-09 03:54:31
Yeah, you're right about that :) But there's something wrong with the playcount too - I've managed to scrobble it with google music, and now I've got this:

Code: [Select]
Opening track for playback: "E:\MP3\The Blues Collection\41 - Memphis Jug Bands - Walk Right In\01 - Bring It With You When You Come.mp3"
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=nasssoo&artist=Cannon's Jug Stompers&track=Bring It With You When You Come&limit=200&format=json&page=1
Found 0 scrobbles in last.fm (since last known scrobble at 2020-02-09 01:06:24) of "Bring It With You When You Come"
It's working correctly. You've scrobbled the song once, and the component knows about it. When you start playing the song again, it checks the scrobbles and only retrieves new ones. You can see it says: Found 0 scrobbles in last.fm (since last known scrobble at 2020-02-09 01:06:24). Once you play a song it isn't scrobbled until the song is over so the component won't know about it until it checks recent scrobbles (every 5 tracks played), you play the song again, or it get's caught when it checks historical scrobbles (every 12 tracks played - but works backward from the oldest scrobble it knows about).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-02-13 17:01:26
I had a request to add a new feature to the component, where the user wanted to get when any song by an artist was last played, particularly for use with foo_skip. This seemed like a reasonable request, so I went ahead and did it.

I added a new property: %artist_last_played% which can be used to retrieve this timestamp. This does necessitate another metadb file (0C1BD000-43E7-4078-B885-48EE4249DED0), but it'll be super tiny. Play around with it and let me know if there are any issues. Consider this an RC even though it isn't tagged as one.

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Axololtl on 2020-03-17 10:58:54
Hello. Great Plugin, but I have encountered frequent issue where it returns zero scrobbles from LastFM for specific tracks. About 5% of my tracks show zero values. I tried to disable "Compare album field" option, but it didn't helped.
LastFM shows the scobbles of those tracks correctly (both site and LastFM plugin)

Here is the example:

Arist: Big Blood
Album: Operate Spaceship Earth Properly
Title: No Human Color

Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=The-Axolotl&artist=Big Blood&track=No Human Color&limit=200&format=json&page=1
Found 0 scrobbles in last.fm of "No Human Color"

Here's the link to this track LastFM page (for my profile) where you can see that there's more than 30 scroblles of it in my profile.
https://www.last.fm/user/the-axolotl/library/music/Big%20Blood/_/No%20Human%20Color
First i thought that this is some LastFM autocorrecting issue, but as you can see the name in tags matches the name in LastFM database.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Axololtl on 2020-03-18 12:21:49
Update: mentioned ubove problem comes out to happen only on my old system with Foobar 1.3.2. Today tried on latest Foobar and all works fine. But, maybe it still will be useful in some way.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-03-19 00:28:13
Update: mentioned ubove problem comes out to happen only on my old system with Foobar 1.3.2. Today tried on latest Foobar and all works fine. But, maybe it still will be useful in some way.
That's weird. Are you positive you were using the most recently released version?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Axololtl on 2020-03-19 08:47:08
Version of plugin in both cases were 4.2.1.
Other foobar components and foobar configs in both cases were the same.
Foobar 1.3.2>1.5.2

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: sc113 on 2020-05-15 19:51:10
Has anyone pointed that the plugin shows a bit incorrect dates of the first and last playback?
(https://i.imgur.com/HlbbWwZ.png)
3 left columns are marc2003's "last.fm playcount sync" plugin, 3 right columns are "enhanced playcount". the lfps dates are exact as the ones on last.fm, while enh-playcount dates has 1 increased minute

and also comparing to lfps, enh-playcount for some reason don't sync tracks below 0:30 by default, while lfps does (it was already discussed here, but i've searched through the thread and didn't find anything about the fixes):
(https://i.imgur.com/xiGlEa0.png)

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2020-05-15 20:23:37
Strictly speaking, you shouldn't have any plays recorded for tracks shorter than 30 seconds. It's one of last.fm's rules. Submitting the length is always a required field for any scrobbler and last.fm will reject anything shorter than 30 seconds. I'm sure all scrobblers for fb2k obey the rules so the only way you can have plays existing on last.fm is by using some other scrobbler that fakes the length.

As for Last.fm playcount sync fetching these plays, it's simply a bug. It doesn't fetch them when listening normally because it does check the length... but when doing any kind of manual lookup of selected items via the context menu, the length of each item is not checked.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: sc113 on 2020-05-15 20:48:48
But shouldn't the plugin just adopt existing last.fm data? if i already have that track scrobbled - then i should get play counts back for any mp3 with the same artist+title tags, isn't it? i mean what if i've scrobbled 0:31 version on youtube, while my mp3 is 0:29? or if i have few different rips with +- few seconds? The rule of ignoring tracks below 0:30 is not really fine thing for syncing existing data, in my opinion.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-05-17 06:18:30
3 left columns are marc2003's "last.fm playcount sync" plugin, 3 right columns are "enhanced playcount". the lfps dates are exact as the ones on last.fm, while enh-playcount dates has 1 increased minute
Marc's already answered your question regarding songs shorter than 30s, so I'll explain this one.

This component was meant to work in concert with foo_playcount. foo_playcount records a song as played when you play one minute of it. The last.fm scrobblers for foobar record the time the song started playing. Because I wanted those values to match up inside the values stored in foo_enhanced_playcount, I add 60 seconds to the scrobbled time retrieved from last.fm.

For songs between 30 and 59 seconds, the value would be off, as it would be if you paused a track at 0:59 for an hour, and then unpaused it and let it play through.

However 99% of the time the values should match up, and fudging the response by 60s doesn't seem like it would hurt much.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: privatesir on 2020-07-29 09:26:38
First, thanks for all the work.

May I ask why the plugin wasn't created to request a login token? I mean, I don't know the technicality about any of this but I'm asking because I don't like to have my profile open to everyone which this plugin apparently needs.

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: jazzthieve on 2020-07-29 17:55:39
Check reply 189 - 191 (https://hydrogenaud.io/index.php?topic=115227.msg969727#msg969727) in this thread.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-07-30 03:26:13
First, thanks for all the work.

May I ask why the plugin wasn't created to request a login token? I mean, I don't know the technicality about any of this but I'm asking because I don't like to have my profile open to everyone which this plugin apparently needs.
Cause I'm a shitty dev and never even thought about it (and would have to research a ton to figure out how to do it). I can look at that again someday when I finish some of the other projects I'm working on though.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Axololtl on 2020-09-15 06:45:35
Hello, plugin works pretty fine, but has one annoying issue.
When you try to use Playlist Search and select and listen tracks from this search window, after a few seconds plugin refreshes this window so it loses focus on which track you were. More than that, when you sort tracks in Playslist Search window, after refreshing it sorts it back to initial state.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-09-15 19:26:11
Hello, plugin works pretty fine, but has one annoying issue.
When you try to use Playlist Search and select and listen tracks from this search window, after a few seconds plugin refreshes this window so it loses focus on which track you were. More than that, when you sort tracks in Playslist Search window, after refreshing it sorts it back to initial state.
Not much I can do about that. It's not the plugin, it's that 3 seconds after song starts the plugin queries last.fm and gets updated scrobble information for the currently playing song. That triggers an on_metadb_changed callback for a track that's visible in the plugin window, and the playlist search is refreshing because it has no idea what data actually change. For all it knows it was the song name that changed and so it has to update its contents.

About the only thing that could be done would be disabling automatic pulling of scrobbles, but then what's even the point of having this component if the information is never up to date?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Axololtl on 2020-09-16 07:10:03
Actually the window refreshes after 3 seconds even if the scrobble info for this track remains the same. Maybe if plugin will update scrobble information only if something has changed, than it wil at least romove a big part of a problem.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-09-16 16:49:00
Actually the window refreshes after 3 seconds even if the scrobble info for this track remains the same. Maybe if plugin will update scrobble information only if something has changed, than it wil at least romove a big part of a problem.
Hmmm... looks like you might be right. Looking at the code it seems I'm setting the metadb record even if the values returned from lastfm contain no new information. I'll verify that and create a fix to mitigate that extraneous callback notification.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-09-18 07:15:46
Actually the window refreshes after 3 seconds even if the scrobble info for this track remains the same. Maybe if plugin will update scrobble information only if something has changed, than it wil at least romove a big part of a problem.
I believe this should be fixed now in the new version. Try it out and let me know.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Axololtl on 2020-09-19 17:22:49
Yes, now it is not refreshes after 3 secs for the tracks that have no changes. But of course still does it when track plays to the moment when it updates playcount. I think this Search Window behavior is something, that better to report in the main foobar thread.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-09-20 21:26:10
Yes, now it is not refreshes after 3 secs for the tracks that have no changes. But of course still does it when track plays to the moment when it updates playcount. I think this Search Window behavior is something, that better to report in the main foobar thread.
I couldn't actually replicate your behavior on 1.6. Search window didn't refresh for me when metadb updates were sent and selection/sorting didn't change at all. Still was a good issue you found, glad it's better at least.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Axololtl on 2020-09-21 21:28:11
I couldn't actually replicate your behavior on 1.6. Search window didn't refresh for me when metadb updates were sent and selection/sorting didn't change at all.
There are different search tools in Foobar. It happens only in Playlist Search window (Edit>Search). Library search does not have such a behavior. Also use 1.6 (Colums UI). Or maybe some specific settings inside Foobar triggers such a behavior.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-09-22 22:53:02
I couldn't actually replicate your behavior on 1.6. Search window didn't refresh for me when metadb updates were sent and selection/sorting didn't change at all.
There are different search tools in Foobar. It happens only in Playlist Search window (Edit>Search). Library search does not have such a behavior. Also use 1.6 (Colums UI). Or maybe some specific settings inside Foobar triggers such a behavior.
You're right. I was using Library search. Seeing it now in playlist search. Definitely seems like a foobar issue, especially if it didn't happen before 1.6.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: bukakow on 2020-10-21 12:19:33
Any way to change play counter moment from 60s to 75% of the track?
In a classic playcounter I set 75% and now both statistics are different
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: ingver on 2020-11-21 20:35:57
Thank you for this plugin! It seems I can use that and forgo libre.fm scrobbling.

Using 4.3.1 with foo_playcount 3.0.4 and foo_scrobble 1.3.1 (if it matters), and it seems to give surprising numbers for scrobbles (fewer). I checked the API URL manually from the logs, and it gives the correct result.

Quote
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=<some api key here>&user=ingver&artist=Amon Tobin&track=The Lighthouse&limit=200&format=json&page=1
Found 2 scrobbles in last.fm of "The Lighthouse"

I did try clearing scrobble data for that track and refetching from context menu. Same result.
Strangely the old last fm playcount sync by marc2003 had recorded the correct count. Maybe not as strict with album titles?

The URL in question returns 15, however (see spoiler):
Spoiler (click to show/hide)

Also, as an aside, at some point after first run it started fetching a bunch of scrobbles in quick succession (but still in sequence, not parallel) for lots of my artists, according to logs, until the API key got suspended. Reauthorizing got it working again, so hopefully not an issue. The results were saved to tracks so I guess it was lastfm being strict with rate limits.

Thanks again and sorry if it has been addressed before. Quick search did not yield anything for me.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Korwin on 2020-11-22 12:09:04
I understand correctly that there are now two ways to send information about the music being played from foobar2000 to last.fm - using the Audioscrobbler by Florian Heidenreich (https://www.foobar2000.org/components/view/foo_audioscrobbler) and using the Enhanced Playback Statistics by MordredKLB (https://www.foobar2000.org/components/view/foo_enhanced_playcount)? However, I did not find a way to enter my username and password from last.fm in this add-on. Neither the add-on page, nor the add-on help page (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Components_1.0/foo_enhanced_playcount), nor this thread (https://hydrogenaud.io/index.php/topic,115227.0.html).
Quote from: foobar2000: Components Repository - Enhanced Playback Statistics
To get the maximum use out of this component, JScript or WSH panel is also required.
I didn't find "JScript" and "WSH panel" in the foobar2000 Components Repository (https://www.foobar2000.org/components).

Help me please.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: ingver on 2020-11-22 23:25:25
I didn't find "JScript" and "WSH panel" in the foobar2000 Components Repository (https://www.foobar2000.org/components).

Help me please.

It seems some of these components have been not updated for a while. I dug out my old fb2k installation and had to do quite a few changes.

It works for me with a newer https://github.com/gix/foo_scrobble, where you do not have to enter password, but simply oauth flow.

Instead of wsh panel maybe you can try the newer https://www.foobar2000.org/components/view/foo_spider_monkey_panel. I didn't try it myself (since I do not need to display anything except last.fm play count, for which no extra components are needed).
Note that it is not strictly necessary.

wsh panel mode is quite old (https://code.google.com/archive/p/foo-wsh-panel-mod/downloads), it was followed by https://github.com/kbuffington/foo_jscript_panel/releases but it seems a later version is at https://github.com/marc2k3/foo_jscript_panel/releases/tag/v2.4.3. The same author has helped with spider_monkey_panel, it seems.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-11-30 05:49:53
Thank you for this plugin! It seems I can use that and forgo libre.fm scrobbling.

Using 4.3.1 with foo_playcount 3.0.4 and foo_scrobble 1.3.1 (if it matters), and it seems to give surprising numbers for scrobbles (fewer). I checked the API URL manually from the logs, and it gives the correct result.
....

Thanks again and sorry if it has been addressed before. Quick search did not yield anything for me.
So it looks like you're maybe playing a track from Splinter Cell soundtrack? There seem to be two scrobbles of that song from that album, while the rest are from a different album. Uncheck "Compare Album field when retrieving scrobbles" and then clear scobbles for that track and repull. At that point it should return 15.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2020-11-30 05:51:49
I understand correctly that there are now two ways to send information about the music being played from foobar2000 to last.fm - using the Audioscrobbler by Florian Heidenreich (https://www.foobar2000.org/components/view/foo_audioscrobbler) and using the Enhanced Playback Statistics by MordredKLB (https://www.foobar2000.org/components/view/foo_enhanced_playcount)? However, I did not find a way to enter my username and password from last.fm in this add-on. Neither the add-on page, nor the add-on help page (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Components_1.0/foo_enhanced_playcount), nor this thread (https://hydrogenaud.io/index.php/topic,115227.0.html).
Quote from: foobar2000: Components Repository - Enhanced Playback Statistics
To get the maximum use out of this component, JScript or WSH panel is also required.
I didn't find "JScript" and "WSH panel" in the foobar2000 Components Repository (https://www.foobar2000.org/components).

Help me please.
This addon does not scrobble tracks, it just retrieves scrobbles. As ingver recommended, use foo_scrobble.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: foremtehan on 2021-01-03 22:05:17
Hey man thanks for your plugin can you give me a hand please ? I want to skip current track if i scrobbled it on my lastfm, So first step i installed your plugin and filled my username https://imgur.com/a/g78XTk9, Then installed Skip Track plugin and filled the query like %lastfm_play_count% MISSING, But nothing happens when i play something https://imgur.com/a/kjd8f49, Am i missing something ?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2021-01-03 23:23:30
2 things:

-you need to fetch playcounts in advance of them being played for it to play nice with foo_skip. You'll need to select all tracks and use the right click menu option to do that.
-you want %lastfm_play_count% PRESENT if you want to skip tracks that you've already played.

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: foremtehan on 2021-01-04 06:56:18
@snotlicker It worked thanks!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-01-05 19:55:48
2 things:

-you need to fetch playcounts in advance of them being played for it to play nice with foo_skip. You'll need to select all tracks and use the right click menu option to do that.
-you want %lastfm_play_count% PRESENT if you want to skip tracks that you've already played.
For the most problem free execution, especially immediately after installing the plugin, this answer is correct, but every 12 plays or so the the plugin will pull 1000 old scrobbles (moving backward from the current time), and every 5 tracks it retrieves the 500 most recent scrobbles so it will attempt to keep itself in sync with last.fm, but again you'll have needed to use the plugin for a little bit before it really works perfectly.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: error on 2021-03-10 09:54:39
Hello,

I'm seeing this:
Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=error&artist=Tyler, the Creator&track=Bastard&limit=200&format=json&page=1
foo_enhanced_playcount: Exception making call to last.fm: Network error
Found 0 scrobbles in last.fm of "Bastard"
is this normal or not working?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-03-10 10:05:50
Hello,

I'm seeing this:
Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=error&artist=Tyler, the Creator&track=Bastard&limit=200&format=json&page=1
foo_enhanced_playcount: Exception making call to last.fm: Network error
Found 0 scrobbles in last.fm of "Bastard"
is this normal or not working?
Not normal. I can load that URL, but it appears you haven't scrobbled that song before though (you still shouldn't get a network error). Are you able to load it in a browser? If that is still happening, or happening on every track possible something is blocking you from accessing last.fm.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-03-11 06:05:39
v4.3.2 - fixes an issue where timestamps with a value of 0 could be saved if foo_playcount was not installed, and prevents time stamps of value 0 from ever being returned (they get returned too foobar as dates around the year 65000).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: kuzzzma on 2021-03-11 12:41:09
Great component, very useful, thank you for creating and maintaining it!

Some feedback:
When "compare album..." is enabled - component won't find and sync any scrobbles on files with no album tags, whyle last.fm has them. Disabling this option gives you correct number of scrobbles for this track.
Strange behavior - I'd expect component to drop check for files with no album tag present...
Also someone seemed to mention this issue on 2-3 page of the discussion, yet it I got it with foobar 1.6.4 and the latest component version.

Console info of requests:
Spoiler (click to show/hide)

Suggestion:
It would be nice to show how many scrobbles are currently recorded in the component database, so you can compare synced number to the overall last.fm record (smth akin to Total Time Played in Playback menu page)
I've got close to 450.000 scrobbles recorded on last.fm (16 years of data!) - so syncing would take awhile even with manual pulls  and it would be nice to have some estimation of my progress.


Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: kuzzzma on 2021-03-11 12:49:25
Also wanted to share a simple columns_ui code that gives user a simple "popularity bar" - easy to setup your own brackets based on  your preferences (my top tracks playcount goes quite high, users might want to adjust accordingly)

Spoiler (click to show/hide)

X
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-03-11 16:34:47
Great component, very useful, thank you for creating and maintaining it!

Some feedback:
When "compare album..." is enabled - component won't find and sync any scrobbles on files with no album tags, whyle last.fm has them. Disabling this option gives you correct number of scrobbles for this track.
Strange behavior - I'd expect component to drop check for files with no album tag present...
I'll take a look at that. You are right.


Quote
Suggestion:
It would be nice to show how many scrobbles are currently recorded in the component database, so you can compare synced number to the overall last.fm record (smth akin to Total Time Played in Playback menu page)
I've got close to 450.000 scrobbles recorded on last.fm (16 years of data!) - so syncing would take awhile even with manual pulls  and it would be nice to have some estimation of my progress.
That would be pretty cool, but there are 2 issues:
1) Let's say you have two copies of that Dream On track (maybe one's on a regular album and one is on a greatest hits). Depending on settings and how things are tagged in your library, both tracks could have records of the same 50 songs. Any count would double those values and so there's no way it could be accurate. Also, if you've scrobbled a song but it's not in your library (or can't be matched in your library because last.fm coerced the name or something) then scrobbles would be missing.

of course those are minor issues compared to:

2) there's no way to count how many scrobbles are recorded. It's not like a SQL database where I can just query how many rows exist. It would require retrieving every record in the database and then adding those values together.

That said you can go to the properties page and see the date it's next going to pull historical scrobbles from. Once that date ends up 16 years in the past you can be confident it's gotten most of them :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Koshingg on 2021-03-11 19:11:06
Hi! Is it possible using this component to obtain a playlist or auto playlist, for the most played songs in a year, for example "Most played songs in 2020"? Congrats for your work with this component, foobar is great.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: regor on 2021-03-11 20:23:46
Hi! Is it possible using this component to obtain a playlist or auto playlist, for the most played songs in a year, for example "Most played songs in 2020"? Congrats for your work with this component, foobar is great.
Yes and no. You can create an auto-playlist with that query, but it will output duplicates as long as you have more than 1 version of the same track (statistics are saved for any track with same title - track number- artist - date). It will also output ALL tracks with play-count greater than 1. But they will be ordered and you have to cut the playlist to X tracks at any point later.

Autplaylist:
Code: [Select]
%last_played% DURING LAST 57 WEEKS AND %play_count% GREATER 1
Sort By:
Code: [Select]
 $sub(99999,%play_count%)

NOTE: you can not force the playlist to only output tracks played at 2020 since only %last_played% is saved (you would miss tracks played at 2021 too)! You can force %last_played% being at least 2020 or sooner, if that's ok.

NOTE 2: for the same reason, with queries, you can not really get most played tracks from 2020 (relative count). But only most played tracks (absolute count) that were also played at 2020. It's not the same! You can only do the 1st thing using js scripts.

(https://hydrogenaud.io/index.php?action=dlattach;attach=18629;image)

If you want to create an autoplaylist without duplicates (and you can set what duplicates means according to any tag), then you can use a SpiderMonkeyPanel script (https://hydrogenaud.io/index.php?topic=120394.0). I do it with a button, using internally that query and then using another script to remove duplicates (by "title", "artist", "date"). Send me an email if you want the files.

(https://hydrogenaud.io/index.php?action=dlattach;attach=18672;image)

There is also a bonus, you can also set the playlist length so it outputs only X top tracks. Using only an autoplaylist would recreate the entire list every time a track is played, so you would need to recreate and re-cut the playlist manually everytime with the first method.

Note anyway my script is an "absolute" Top tracks playlist, not relative to the year. But I could edit it easily if there is interest to use the variables from this plugin instead of queries:
Quote
%played_times% - Date formatted list: ["2012-08-04 15:58:37", "2012-12-10 14:40:46", "2018-01-02 23:38:13"]
%played_times_js% - JS timestamp list: [1344117517000, 1355172047000, 1514957893431]
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-03-11 23:21:53
Great post regor. One slight correction, documentation for foo_playcount is slightly wrong and the string it uses for computing hashes is:
%artist% - %date% - %album% $if2(%discnumber%,1)-%tracknumber% %title%
foo_playcount_enhanced uses:
%artist% - $year($if2(%date%,%original release date%)) - %album% $if2(%discnumber%,1)-%tracknumber% %title%

One other option you've got if you use Columns UI is to create filters like so:
(https://user-images.githubusercontent.com/2282004/110867856-19378280-828d-11eb-9637-7e3d8ec5234d.png)

Notice the $max(%play_count%,%lastfm_play_count%) if you play songs from outside foobar and retrieve scrobbles.

Then you can just select any song with over X number of plays to generate a playlist and then randomize it or whatever you want.

Edit: I'm just realizing that doesn't solve the ask which was most played songs IN a year, and not FROM a year :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: riot. on 2021-03-11 23:45:51
For a long time I used foobar and then eventually iTunes, and then for about a decade I rarely touched my music collection. Now I'm back to trying to sort everything out all nice and neat but I have a problem. I have play counts from foobar and from iTunes. I've tried combining them both in Musicbee but I don't see a way for that to happen. Can I add the iTunes play counts to my foobar play_counter using this plugin? If not, any other ideas?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: regor on 2021-03-12 00:00:04
Edit: I'm just realizing that doesn't solve the ask which was most played songs IN a year, and not FROM a year :)

Yep that's the point. You can use queries to get most played songs and limit it within a time frame. It's the more similar thing doable with standard TF and queries.
But there is no workaround to get most played songs in a year without js. You need %played_times% for that,  and $meta_num/$meta(prop, index) don't work with those fields.

Quote
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.

EDIT: if I am not mistaken, your theme has a "track lifetime" bar or something similar which already uses those fields. Maybe it makes sense to integrate the" most played tracks from X year" playlist creation script as a button there (?). I'm going to take a look at it, so you could reuse it for your theme.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-03-12 00:28:31
Can I add the iTunes play counts to my foobar play_counter using this plugin? If not, any other ideas?
Not unless you were scrobbling to last.fm from iTunes (which is what I do).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-03-12 00:35:12
EDIT: if I am not mistaken, your theme has a "track lifetime" bar or something similar which already uses those fields. Maybe it makes sense to integrate the" most played tracks from X year" playlist creation script as a button there (?). I'm going to take a look at it, so you could reuse it for your theme.
I probably won't directly integrate it into the theme, but it's an interesting problem (that I wish I had time to solve), so if you come up with something cool I'd love to see it.

And now that I think about it, it could potentially work as a menu item along with some other cool playlist generation things....
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: error on 2021-03-12 04:18:19
Hello,

I'm seeing this:
Code: [Select]
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=a1685abe5265b93cf2be4a70d181bf6b&user=error&artist=Tyler, the Creator&track=Bastard&limit=200&format=json&page=1
foo_enhanced_playcount: Exception making call to last.fm: Network error
Found 0 scrobbles in last.fm of "Bastard"
is this normal or not working?
Not normal. I can load that URL, but it appears you haven't scrobbled that song before though (you still shouldn't get a network error). Are you able to load it in a browser? If that is still happening, or happening on every track possible something is blocking you from accessing last.fm.

Yes i'm able to access the link through a browser fine and it does show the previous plays for certain tracks i tested but i keep getting that network error in the console.

Edit: i'm dumb lol, i checked the network settings and found out i had set some old proxy settings so once i removed those it's working fine now!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Koshingg on 2021-03-12 20:09:56
Thanks for trying to help regor & MordredKLB
Yes, this is what I want : most played tracks in 2020, or another year (relative count). I don't want most played tracks (absolute count) that were also played at 2020.
I think it's a useful and interesting feature because you can have a look in the past, to see what songs you played the most 5 years ago, or 3 years ago, for example
So you can have playlists like this:
 Most played songs in 2019
    Artist            Title             Play count (or if possible, lastfm_play_count)
1. Bon Jovi    - Always          25
2. Inna           - Hot              20
3. Madonna  - Frozen          15
.........................
.........................
50.Def Leppard - Hysteria     2

Most played songs in 2018
   Artist         Title                     Play count (or lastfm_play_count)
1. Tiesto       - Just Be               35
2. Basto       - Again & again   20
3. Bon Jovi   - Always               10
.........................
.........................
50. Smokie   - Carol                   1

I asked this question here because I noticed this on the first page of this component:
%lastfm_played_times% - Date formatted list of scrobbles: ["2012-08-04 15:58:37", "2012-12-10 14:40:46", "2018-01-02 23:38:13"]
%lastfm_played_times_js% - JS timestamp list: [1344117517000, 1355172047000, 1514957893000]
I thought that maybe with this component or a script for SMP it might be possible. So I asked here because MordredKLB has also his Georgia theme, and then I thought to ask regor because he also has very interesting scripts, but luckily regor noticed my post.
regor I'll send you an email to send me those files because I'm also interested about those scripts, but I will comment on your page because I have a few questions.
So, is it possible to achieve this with a script : Most played songs in 2020 (relative count), or 2017, or any other year ?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-03-12 21:49:07
It's not all that difficult to write a script which would generate a playlist of all songs with a last_played in the last 52 weeks (or whatever), but things get much more complex and computationally intensive if you want to get number of plays in a certain arbitrary date range (i.e. in 2016). To achieve the second you'd need to again generate a list of any song played after 2016-01-01, then iterate through every entry in that list, pull %lastfm_played_times_js% for every song, then filter the output of each one of those calls to lop off any song before <2016 or >=2017. Then you'd count the times that were left in that range, and shove them into an ordered array and only keep the top 50.

Probably take an hour or two to write up and get working perfectly, but depending on the size of your library and how many plays/scrobbles, could potentially take several seconds or more to generate.

Edit: On further thought:
1) Generate a handle list of all songs with a last played >= 2016-01-01 saved as start
2) Generate a handle list of all songs with a first played >= 2017-01-01 saved as end
Sort both lists, then call start.MakeDifference(end) would drastically cut down on the number of songs you'd need to filter times for.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-03-19 17:51:54
How many people are currently using either any of the %played_times_XXXX% properties, or the %lastfm_played_times_XXX% properties?

I'm considering either changing the behavior of %played_times% or adding a new %played_times_combined% which would hopefully eliminate 90-95% of the duplicates (depending on how often you pause songs in the first minute of play) and just return a list of all foobar and lastfm scrobbles in one call.

I'm wondering if there's even demand for this.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: artins90 on 2021-03-21 14:47:16
The download link for the latest version seems to be missing from the component page.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-03-21 21:15:35
The download link for the latest version seems to be missing from the component page.
Weird. Should be fixed now.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Woodee on 2021-05-13 10:45:33
Not retrieving ANY scrobbles... this has happened for a while.

I have the foo_audioscrobbler installed which successfully submits to Last.fm. In the log I get the following error when it tries to retrieve the statistics:

Quote
Querying last.fm: http://ws.audioscrobbler.com/2.0/?method=user.getTrackScrobbles&api_key=XX&user=woodee&artist=Within Temptation&track=In Vain&limit=200&format=json&page=1
last.fm Error: Login: User required to be logged in

Didn't know if it was safe to post the API key so replaced with XX.

Any help?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2021-05-13 10:52:13
Perhaps you've enabled the setting on the last.fm website that hides your recent listening history. This would affect the API as well.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Woodee on 2021-05-13 11:09:19
Perhaps you've enabled the setting on the last.fm website that hides your recent listening history. This would affect the API as well.

THANKS!!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: dreampillet on 2021-05-26 03:37:03
Hello! I'd like to make a request. I wanna start off saying this is one of my favorite components, I really have to thank MordredKLB for making it as it’s one of my favorite things that you can do on foobar!

Is there any way that this component's playcount could supplant foo_playcount's? So %lastfm_play_count%'s value could be stored in %play_count% and therefore, components like Facets could display it as a statistic.

I am using this component by itself, that is, without foo_playcount alongside it. This works perfectly well for my purposes as -unless I'm misunderstanding something- I'm not interested in keeping a different set of playback statistics separate from lastfm. However, my setup makes extensive use of foo_facets, which supports foo_playcount and can display aggregate playcounts for different columns (playcount totals for artist, album, etc.) but, it can’t display aggregate statistics of custom fields, so it can't show aggregate lastfm playcounts. I’ve been trying to find a way around this but I haven’t found any, and sadly, the author of foo_facets doesn't seem to be active anymore.

 :-[ I realize I might not be using this component the way it's intended and I don't know how hard it'd be to implement this, so I apologize if this request is a little ridiculous. Thanks.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-05-26 03:48:11
Is there any way that this component's playcount could supplant foo_playcount's? So %lastfm_play_count%'s value could be stored in %play_count% and therefore, components like Facets could display it as a statistic.
Short answer is yes, but I won't do it.

Conceivably I could alter the component so that it also registered itself as watching %play_count%, then it would return my playcounts instead of foo_playcounts. Of course that would cause problems at best if you had both components installed, and probably get me in trouble with Peter and my component kicked off the registry at worst. There might be some way to only provide this behavior if foo_playcount is not installed, or through some kind of opt-in only option, but frankly it's not worth the confusion/risk/dev effort IMO.

I don't use Facets, so I have no idea if there's someway to alter the aggregate playcounts to use a custom field. If not, your request is better placed over there assuming that component is still maintained.

Sorry!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: dreampillet on 2021-05-26 05:33:12
Ah, I see. And yes, sadly Facets doesn't seem to be maintained anymore and it's a shame since I really love the way it works but it'd be great to have features like this.
Thanks for taking the time to reply and explain!  :)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: mjm716 on 2021-05-26 07:24:43
can display aggregate playcounts for different columns

why not display a facets column such as:
$max(%play_count%,%lastfm_play_count%)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2021-05-26 17:12:28
why not display a facets column such as:
$max(%play_count%,%lastfm_play_count%)

This is no good. Statistics columns calculate totals for the whole group so lets say you had an Album pane and an album has 10 tracks with 5 plays of each track, it would show a total of 50 plays. It's impossible to do this custom columns/standard title formatting.

Conceivably I could alter the component so that it also registered itself as watching %play_count%, then it would return my playcounts instead of foo_playcounts. Of course that would cause problems at best if you had both components installed, and probably get me in trouble with Peter and my component kicked off the registry at worst.

With both components installed, they would battle it out for precedence on startup so the first component loaded would take control. It's supposed to random on every restart assuming Peters own components are not given preference over 3rd parties. But like you say, trying to take over someone else's clearly defined fields is not cool!!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: ViniMan on 2021-06-09 08:39:42
Could this component check loved tracks as well? or anything else out there that does this?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2021-06-09 10:44:18
https://github.com/marc2k3/foo_jscript_panel/wiki/Other-Components#foo_lastfm_playcount_sync

As the name implies, it fetches playcounts like this component but has support for importing all loved tracks and if you authorise your Last.fm account, it can love/unlove up to 20 tracks at a time.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Koshingg on 2021-08-06 23:59:22
How can I sort the highest value between Playcount or LastFm playcount in descending order ?
Currently I have this ( in Advanced - Display - Standart sort) :

$if($max(%play_count%,%lastfm_play_count%),$num($max(%play_count%,%lastfm_play_count%),3)|$if2(%album artist%,...)|['['%date%']' ]$if2(%album%,...)|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%)

But it's in ascending order. If anyone can help, thanks
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-08-09 18:44:26
How can I sort the highest value between Playcount or LastFm playcount in descending order ?
Currently I have this ( in Advanced - Display - Standart sort) :

$if($max(%play_count%,%lastfm_play_count%),$num($max(%play_count%,%lastfm_play_count%),3)|$if2(%album artist%,...)|['['%date%']' ]$if2(%album%,...)|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%)

But it's in ascending order. If anyone can help, thanks

This is usually done like:

$sub(10000,$if($max(%play_count%,%lastfm_play_count%),$num($max(%play_count%,%lastfm_play_count%),3))
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Koshingg on 2021-08-13 22:15:39
Huge thanks @MordredKLB
I just reminded some useful info (hopefully), and since it's related with foo_enhanced_playcount I should post this here, if it's ok. For those that use this component and also listen to music on a android phone there is a very useful app, Pano Scrobbler for LastFM (https://play.google.com/store/apps/details?id=com.arn.scrobble&hl=en_US&gl=US). Scrobble from anything including video streaming apps, less known audio players or even a song playing in your IM app. You can even scrobble from Youtube app, something that the official Last.fm app can't do. This way, your scrobbles will be more accurate, for example if you listen a song on youtube (using a phone) and you have that song also in your library, foo_enhanced_playcount will retrieve those scrobbles.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-08-16 16:10:17
Huge thanks @MordredKLB
I just reminded some useful info (hopefully), and since it's related with foo_enhanced_playcount I should post this here, if it's ok. For those that use this component and also listen to music on a android phone there is a very useful app, Pano Scrobbler for LastFM (https://play.google.com/store/apps/details?id=com.arn.scrobble&hl=en_US&gl=US). Scrobble from anything including video streaming apps, less known audio players or even a song playing in your IM app. You can even scrobble from Youtube app, something that the official Last.fm app can't do. This way, your scrobbles will be more accurate, for example if you listen a song on youtube (using a phone) and you have that song also in your library, foo_enhanced_playcount will retrieve those scrobbles.

I use Simple Last.fm Scrobbler (SLS) for the same thing on Android. Not sure if it has the same number of apps that Pano supports, but it does give you a list of every player on your device that it recognizes and you can enable or disabling scrobbling from each one.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: iridescentaudio on 2021-12-03 14:24:20
I'm late to the party! I began using this component a few days ago, feeling that I wanted to convert a whole bunch of single-value Artist tags into multi-value and enjoy improved functionality from the Album List panel. Of course this has ramifications upon Last FM, so began pulling my 13yr scrobbling legacy before making more tag changes, and meanwhile hoping the Last FM overlords don't banish me for being too eager! Going well so far though. Thank you MordredKLB for all your work!

I use the "Automatically synchronize file tags with statistics" setting in Playback Statistics advanced prefs, and have a rather convoluted Playcount column that displays $max(%play_count%,%lastfm_play_count%), while also running an $ifequal comparison of the aforementioned against $meta(PLAY_COUNT) and throwing up a red X in the column if there is a mismatch. I also have Context Menu buttons for Importing/Exporting Playback Stats. However, I cannot figure out a convenient way to write %lastfm_play_count% to the PLAY_COUNT tag. I have PLAY_COUNT as the linked metadata field for the column, so whatever number is displayed I can type it in the field and from there import it into Playback Statistics so that all three playcount values are synchronized, but repeating this process for thousands of songs is obviously not practical. The very best I can figure out how to do at the moment is open an ALL playlist, sort by playcount, then select all songs with the same number in turn and bulk-edit <PLAY_COUNT> under properties. Eugh.

As for why I'm doing this, it's a "once bitten, twice shy" situation, as I have lost statistics in the past for one reason or another, and having stats written to tags (in my case external tags) reduces the likelihood of that happening again in future.

So, feature request: I'm wondering if you would consider adding similar context menu options, to Import/Write Enhanced Statistics to/from file tags, and a similar Synchronization option? I've tried to use Masstagger's "Copy values between fields" option, but since %lastfm_play_count% isn't a metadata field, I'm not sure if there is anything I can type there to invoke it (I've tried LASTFM_PLAY_COUNT, SCROBBLES, __SCROBBLES etc... nothing works.) If you have any other advice that would be lovely.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2021-12-08 04:10:31
So, feature request: I'm wondering if you would consider adding similar context menu options, to Import/Write Enhanced Statistics to/from file tags, and a similar Synchronization option? I've tried to use Masstagger's "Copy values between fields" option, but since %lastfm_play_count% isn't a metadata field, I'm not sure if there is anything I can type there to invoke it (I've tried LASTFM_PLAY_COUNT, SCROBBLES, __SCROBBLES etc... nothing works.) If you have any other advice that would be lovely.
I haven't added this because I don't personally need it, and it can already be done with Masstagger using the "Format Value from Other Fields" option:

(https://user-images.githubusercontent.com/2282004/145146714-f1c20655-0858-46ac-aafc-918f64f63258.png)

For your use you'd probably want to set PLAY_COUNT to be $max(%play_count%,%lastfm_play_count%)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: iridescentaudio on 2021-12-10 14:48:37
I figured there had to be a way and I was simply mishandling things. Thank you for that, this works great!

I had hoped to propagate %added_enhanced% & %first_played_enhanced% to <ADDED_TIMESTAMP> & <FIRST_PLAYED_TIMESTAMP> similarly, but unfortunately it doesn't look like it's possible to fetch those values as timestamps that Playback Stats understands, and I have no idea if it's possible to take the dates returned by those fields and reformat them to timestamps some other way.
Instead, I'm trialling a new <ADDED> field. Upon reflection, it probably isn't too important for Playback Stats to reimport these dates once they're in a tag, as they are not going to be routinely modified. It's the other fields that are modified on every play of a song that represent far too much administration to bother synchronising manually. :P I guess I will cut my losses with those and hope I never lose them from the db.

Thanks once again for this component. I'm cautiously aware that Last FM may not be around for forever, what with the trend towards Spotify/streaming services, so definitely feel it's important to do this legwork pulling my data sooner rather than later.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: gob on 2022-05-10 22:07:14
I understand that this component works with the official statistics plugin.

Is there a way to import the scrobbled playcount to the official statistics plugin's data?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: ZarkBit on 2022-08-31 17:52:51
Just gonna leave this here since I've had the same doubt about foo_lastfm_playcount_sync.

There used to be a script made by marc I think that allowed exporting playcount from lastfm into a db and then importing that db into foobar, but I think that script now has issues.

As a workaround I use this custom column.
Code: [Select]
$ifgreater([%lfm_playcount%],[%play_count%],[%lfm_playcount%],[%play_count%])
$ifgreater(a,b,a,b)

It compares a to b, if a is higher then it shows a, otherwise it shows b. Swap %lfm_playcount% with %lastfm_play_count% for this specific component.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2022-08-31 21:15:44
Use $max

https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#.24max.28a.2Cb.29

And that WSH script/foo_customdb from years ago was a filthy hack done when I didn't know any better. But there was a nice last.fm API meaning you could playcount/loved status for 200 tracks in a single web request. Admittedly there was no date info but it was good at the time. But last.fm nuked it and now it's one request per track (or more if the number of plays exceeds the plays per page limit).
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: metal_termite on 2022-09-10 17:27:29
Many times I find this plugin doesn't fetch the complete last.fm play stats. Here's an example compared to foo_lastfm_playcount_sync

(https://i.imgur.com/4vggKIT.png)

Is there a way to fix this?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2022-09-10 17:41:01
Because my component is focused purely on Last.fm, I only take artist/title in account ( $meta(artist,0) to be precise )

https://github.com/marc2k3/foo_lastfm_playcount_sync/blob/main/src/DB.cpp#L13

Enhanced playcount does something else entirely..

https://github.com/kbuffington/foo_enhanced_playcount/blob/99b1cbc67105dad0b88213764a1257e4e14a8c59/src/PlayedTimes.cpp#L24L30

This is not a good fit for last.fm data.

edit: I've not even look at how enhanced playcount parses the last.fm server response. I suspect it's very different from mine.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: metal_termite on 2022-09-10 20:42:26
Because my component is focused purely on Last.fm, I only take artist/title in account ( $meta(artist,0) to be precise )
I just downloaded all my last.fm scrobbles from https://benjaminbenben.com/lastfm-to-csv/ and the history of each scrobble shows %artist% %album% %title% (and %date%). Why not include %album% in your plugin's fetching or make it an option? Wouldn't that improve accuracy or do you find that level of specificity is redundant?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2022-09-10 21:16:09
You really are contradicting yourself now. Your original post was complaining about enhanced playcount not showing as many plays as mine and now you want mine broken down my album so you don't see the full total? Madness.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: metal_termite on 2022-09-10 23:08:14
You really are contradicting yourself now. Your original post was complaining about enhanced playcount not showing as many plays as mine and now you want mine broken down my album so you don't see the full total? Madness.
Well if you put it like that yeah, but it's a false dichotomy because this assumes it must necessarily be a contradiction for me to wonder why both plugins are presenting their data inaccurately: one underreporting and one overreporting.

It's weird that that foo_enhanced_playcount is underreporting play counts. In the above screen shot that specific track was played 47x from a specific album and 1x time from an EP while foo_enhanced_playcount is only reporting 5 plays.

But your plugin is over attributing play counts and play dates (and I'm not blaming you because this seems like how last.fm is presenting their data on https://last.fm/user/{usernamne}/library/music/{artist}/_/{track title}). One can have different versions of a track but if they share the same %artist% and %title% their play stats will be identical here. For example, with your plugin there is no discrimination between Nirvana's tracks from their MTV Unplugged album and the same track titles from their studio albums even though the MTV Unplugged tracks are acoustic variations of the songs--all the tracks with the same titles get identical play stats.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2022-09-10 23:40:57
Well it is a stated aim in the docs (just below the gif)

https://marc2k3.github.io/component/lastfm-playcount-sync/

Quote
Stats are grouped by $lower($meta(artist,0) - %title%) with absolutely no consideration for album tags. This generally means the numbers will match anything you see on Last.fm track pages/charts.

There is a bit of history behind it too. The current API we use (user.getTrackScrobbles) is relatively new but I used last.fm for years before where the only API I could use to get playcounts was track.getInfo - this still exists here...

https://www.last.fm/api/show/track.getInfo

I still use it now to check loved status on every play. Because it showed total playcount only, you never able to determine how many plays per album or any first/last played dates at all.

So even when user.getTrackScrobbles came along, I just didn't invest in it to check albums. I did find the ability to get first played / last played dates useful so that's exactly what I do with it now.

user.getRecentTracks has always been around but parsing an entire listening history just isn't feasible in the context of an fb2k component.

edit: track love status is also bound to artist/title. There is no choice at all with the last.fm API.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: metal_termite on 2022-09-10 23:51:02
Fair enough. Thanks for the explanation.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2022-09-11 01:19:12
So I was messing around and got my component to dump out the album totals each time it looks up a track and the most played track on your user account has 133 plays. It got broke down like this...

Overall total - 133
<album missing> - 42
Blue Room - 31
Garden State - 20
Parachutes - 40

Could 42 scrobbles submitted without an album tag be accurate? How about the other totals? Feasible?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: metal_termite on 2022-09-11 02:19:03
That's all feasible.

I strongly suspect the reason for the <album missing> values is Last.fm/Audioscrobbler, was not tracking %album% on scrobbles until January 2006. At least based on my Last.fm data dump, all album values are null until precisely 18 Jan 2006 22:51
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2022-09-11 02:39:39
If you're willing to install fb2k v2 in portable mode, you can test this console spamming album total build I made (32bit only). You can play the tracks with the biggest discrepancies you get with enhanced playcount to see what last.fm says??

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: metal_termite on 2022-09-11 02:54:48
Thanks, will do tomorrow. I'm just about to head out atm.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: metal_termite on 2022-09-14 06:47:57
The only thing throwing some of them off is the arbitrary use the ` and ' character in track titles (which on my end get changed by foo_musicbrainz)

foo_musicbrainz has pretty much always* had an option for replacing unicode punctuation with asciii. Picard does the same and it's always recommended, especially if scrobbling. The wider world won't be using musicbrainz so you really want your scrobbles to count towards the titles that everyone else is submitting. Too late for you now though.

*the original developer last updated it in 2012 and it was there then. I can't say for sure about the earliest versions. There might be a changelog entry for when it was added but I'm far too lazy to check that out.

Also, it would have more interesting to compare the album groupings returned against the stats by enhanced playcount that appeared way off. That was the prompt for all of this.
(Replaying here since your request pertains to this component)

It's not very interesting. After I saw the raw Last.fm playback stats I realized the perceived discrepancy in the playback stats was due to the same reason as the perceived discrepancy your component had: the Unicode/ASCII punctuation issue. It would be super nice if both components here were able to overcome this, at least for metadata with the Unicode apostrophe , but for all I know that's much easier said than done.

So it turns out this component is giving accurate readings from Last.fm. The only difference was as you said, foo_enhanced_playback was discriminating tracks based on %album%, your component was not, and the Unicode/ASCII characters issue was compounding my confusion.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2022-09-14 11:28:21
but for all I know that's much easier said than done.

Correct. Technically possible but it would be really messy and I'm not interested. ;D
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: iridescentaudio on 2022-10-29 11:20:13
Since I couldn't find a quick answer to this anywhere (somewhere here (https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Components_1.0/foo_enhanced_playcount) would be ideal), where does Enhanced Playback Statistics store the information it collects? I need to uninstall it, hopefully temporarily for diagnostic purposes (https://hydrogenaud.io/index.php/topic,122847.msg1018396.html#msg1018396), but don't want to lose the data it has collected. I am guessing it's fine to just drag the component out of my user-components directory but thought I should double-check first.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2022-10-29 13:00:25
Removing the component won't touch the data. It will still be there if you restore the component later.

It's stored inside the index-data folder for fb2k 1.x users or inside metadb.sqlite file for fb2k 2 users.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: grimes on 2022-10-29 13:42:58
Since I couldn't find a quick answer to this anywhere (somewhere here (https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Components_1.0/foo_enhanced_playcount) would be ideal), where does Enhanced Playback Statistics store the information it collects? I need to uninstall it, hopefully temporarily for diagnostic purposes (https://hydrogenaud.io/index.php/topic,122847.msg1018396.html#msg1018396), but don't want to lose the data it has collected. I am guessing it's fine to just drag the component out of my user-components directory but thought I should double-check first.
You could start foobar2000 in save mode. Terminate foobar2000 in task manager, next time you start it, it should ask whether to run it in safe mode.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: iridescentaudio on 2022-10-29 15:39:17
Hmm... no need, I believe foo_enhanced_playcount is responsible for the extreme CPU use I'm experiencing. I haven't had further problems since removing it. No-one else having problems like this (https://hydrogenaud.io/index.php/topic,122847.msg1018396.html#msg1018396)? I hope I am not the only one.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Mrakobes on 2022-12-25 07:25:43
Removing the component won't touch the data. It will still be there if you restore the component later.

It's stored inside the index-data folder for fb2k 1.x users or inside metadb.sqlite file for fb2k 2 users.

tell me how to update correctly from 1.6 to 2.0 in the 19th beta, the foo_enhanced_playcount started working again - is there a need to transfer the index-date folder? Now the foo_enhanced_playcount stores data in the metadb.sqlite? What to do with the folder index-data??

what are the differences between  foo_lastfm_playcount_sync
 and foo_enhanced_playcount where does your plugin save data? Is it possible to get statistics by day? I have studied the last fm website since the beginning of 2000, I have statistics on tracks - on what day what was played - which plugin is responsible for this? How to save it when switching to 2.0?

advise me which kit to leave for scrobbling, otherwise I'm clogging up the player with duplicates again
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Mrakobes on 2022-12-31 09:52:00
@MordredKLB tell me how to transfer settings from 1.6 to 2.0 in the old player, all ratings and history are in the index folder and in the new one in the database sql, how else can I import from the site last.fm database back?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: iridescentaudio on 2023-02-06 11:36:57
Hmm... no need, I believe foo_enhanced_playcount is responsible for the extreme CPU use I'm experiencing. I haven't had further problems since removing it. No-one else having problems like this (https://hydrogenaud.io/index.php/topic,122847.msg1018396.html#msg1018396)? I hope I am not the only one.

I re-installed the component today hoping that the CPU use may no longer be a concern (EDIT: sadly it still is, manual pulling triggered it), however automatic scrobble pulling is broken. When I press "reset" it fetches the date of the day I removed the plugin (2022-10-29), then if I close and re-open its preferences, the next historical pull date is mentioned as being 1970-01-01. Manual pulling of scrobbles still works, but of course I've listened to quite a lot of music in the interim... how can I fix this?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-02-07 06:36:14
I re-installed the component today hoping that the CPU use may no longer be a concern (EDIT: sadly it still is, manual pulling triggered it), however automatic scrobble pulling is broken. When I press "reset" it fetches the date of the day I removed the plugin (2022-10-29), then if I close and re-open its preferences, the next historical pull date is mentioned as being 1970-01-01. Manual pulling of scrobbles still works, but of course I've listened to quite a lot of music in the interim... how can I fix this?
What version of foobar are you using?

As you might have noticed this component hasn't been updated in 4 years or so because it was basically working flawlessly AFAIK (things might have changed in 2.0, but I had trouble when my foo_playcount stats didn't migrate over, so I gave up).

The component checks for scrobbles in two directions, starting with the last scrobble it knows about. It checks forward in time to get all scrobbles since that last scrobble it has recorded this syncs you up with syncing from other devices/foobar instances/or while you had the plugin removed, so that date 2022-10-29 makes sense.
Then it checks backward from that date 1000 scrobbles at a time (and rarely) to get all your historical scrobbles. Once it finally reaches the last scrobble in last.fm, it starts back over at the last scrobble it knows about, just in case some were missed in the interim. 1970-01-01 is the unix epoch, so presumably it thinks the last scrobble time is zero? I'm wondering if there's an issue writing the cfg file for the component (or reading from it?). Again, this may be all related to 2.0, but I haven't tried it. I'll give it a shot soon though.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: iridescentaudio on 2023-02-07 15:29:52
Thanks for the reply. I was using 2.0 beta v17 (32bit), though I just updated to the newest beta this morning, and also discovered the alternative last.fm component by marc2k3 which is working well so I'm using that at least for the time being (though I will miss the automatic fetching of recent scrobbles...)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-02-14 08:22:51
5.0.0 beta 1 here:

Supports x64, dark mode, 2.0 SDK etc. Everything appears to be working fine, but I need more testers.

Nevermind
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-02-14 08:29:18
@iridescentaudio I was looking at the code tonight. On startup it will pull up to 800 songs from the last scrobble it knows about to attempt to keep everything in sync.

Historical scrobbles will initially show a time around 1970-01-01 if you reset it (I should change how this displays), but after playing 12 songs, the historical scrobble pull will move backward in time from the earliest scrobble date it has checked and grab 1000 songs. Play 12 more songs, and it'll grab another 1000. You won't see the date move otherwise.

I checked the CPU during a historical scrobble pull on a new beta24 x86 install and there was nothing out of the ordinary. CPU usage was around 1% during the fetching and then querying for each songs phase. Try the beta above and let me know if your CPU issues still persist. Peter moved the entire metadb database back into memory with beta 18, so it's possible your issues were entirely related to that temporary change which I know had a bad performance effect for some people.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: TT on 2023-02-14 15:53:05
5.0.0 beta 1 here:

Supports x64, dark mode, 2.0 SDK etc. Everything appears to be working fine, but I need more testers.

https://www.dropbox.com/s/5p88kdyvm6feiy4/foo_enhanced_playcount-v5.0.0b1.fb2k-component?dl=0

Haha, it was yesterday I've asked you about it =)
Thanks a lot, it's good that your motivation is slightly back.

-TT
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-02-14 17:37:54
Haha, it was yesterday I've asked you about it =)
Thanks a lot, it's good that your motivation is slightly back.

-TT
My motivation wanes with every "unresolved external symbol" linker error I have to figure out. :P

My problem is that once I start fiddling with a project I can't force myself to stop. I'm up till 3AM every night trying to tie up every last loose end, etc. So I go through starts and stops with this stuff in an attempt to keep myself (relatively) sane.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-02-15 04:46:41
v5.0.0b1 seems to work fine on 1.6.x, but on 2.0 only manual scrobble pulls work. For some reason it's unable to search the library in the same way that the old version does. Not sure if that's a bug, or more likely my implementation is messed up.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2023-02-15 10:48:37
The library in v2 is loaded asynchronously so code like this...

Code: [Select]
metadb_handle_list items;
library_manager::get()->get_all_items(items);

will return 0 items if you run it too early.

You can verify it with scripting components too. var items = fb.GetLibraryItems() on fb2k startup returns 0 items as well. It probably goes unnoticed because library viewers will have on_library_items_added which will update themselves.

You might want to look at on_library_initialized here

https://github.com/marc2k3/foobar2000-sdk-2/blob/c2b5293e8107af51b9d1b3daab66da31e0459474/foobar2000/SDK/library_callbacks.h#L25-L32
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-02-15 23:39:10
The library in v2 is loaded asynchronously so code like this...

Code: [Select]
metadb_handle_list items;
library_manager::get()->get_all_items(items);

will return 0 items if you run it too early.
You're a damn genius you know that? on_library_initialized fixed my problem.

Also is there a list of changes for how 2.0 works compared to 1.6 or do I just need to have been following a bunch of different threads for the last few months?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2023-02-16 00:15:03
I looked at your github and that code looks so wrong (to me) that I can't believe it worked??

I'm submitting a PR.  :))

edit: as for keeping up, I just search the SDK for this to look for new goodies on release...

Code: [Select]
//! \since 2.0

late edit: my PR didn't even compile. What a genius I am.  ;D
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-02-16 01:00:36
I looked at your github and that code looks so wrong (to me) that I can't believe it worked??

I'm submitting a PR.  :))
PR definitely helped my understanding of what I'm supposed to do. Also I barely knew how the pre 2,0 SDK worked, and so adding 61 new things with very little documentation and a foo_sample that hasn't been updated to use any of the new stuff means I'm just throwing darts in the dark :))

I'm hopeful that situation will improve once 2.0 gets out of beta and the SDK is somewhat more locked down.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-02-16 18:49:23
5.0.0 beta 2
 - In 2.0 component now waits for library to load before pulling scrobbles
 - Actually removes duplicate hashes when pulling recent/historical scrobbles. This speeds up scrobble pulls if you have multiple copies of the same albums in your library (i.e. different encodes, editions, etc.) and cuts down on console spam
 - Next historical scrobble pull shows the correct date, and the reset button now sets next pull date to current time. This fixes a bug where pulls after a reset did not work correctly.
 - Component is now referred to everywhere in the UI as "Playback Statistics Enhanced", instead of confusingly sometimes calling itself "Playcount Enhanced"

I think this is the one. If a few people can test this out and make sure there are no problems, I'll release a 5.0.0 official in a few days.

https://www.dropbox.com/s/qkcxy7eqm8vi5z5/foo_enhanced_playcount-v5.0.0b2.fb2k-component?dl=0
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Mrakobes on 2023-03-12 10:36:24
How to do a reverse import of information??? Statistics were lost for a certain period. At the same time, there are statistics that are not in last fm and there is information on the site that is not in the player
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: iridescentaudio on 2023-03-12 13:59:04
@iridescentaudio I was looking at the code tonight. On startup it will pull up to 800 songs from the last scrobble it knows about to attempt to keep everything in sync.

Historical scrobbles will initially show a time around 1970-01-01 if you reset it (I should change how this displays), but after playing 12 songs, the historical scrobble pull will move backward in time from the earliest scrobble date it has checked and grab 1000 songs. Play 12 more songs, and it'll grab another 1000. You won't see the date move otherwise.

I checked the CPU during a historical scrobble pull on a new beta24 x86 install and there was nothing out of the ordinary. CPU usage was around 1% during the fetching and then querying for each songs phase. Try the beta above and let me know if your CPU issues still persist. Peter moved the entire metadb database back into memory with beta 18, so it's possible your issues were entirely related to that temporary change which I know had a bad performance effect for some people.

Apologies for being slow getting back to you, I'm testing it out today and everything seems to be smooth sailing so far, I haven't noticed the same CPU spikes I was having before, and the idiosyncratic behaviour with the pull date has stopped. Now picking up scrobbles from the last several months and re-jigging my columns. I'll let you know if I notice anything strange but so far, so good - thank you for your hard work!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-03-17 18:19:55
Apologies for being slow getting back to you, I'm testing it out today and everything seems to be smooth sailing so far, I haven't noticed the same CPU spikes I was having before, and the idiosyncratic behaviour with the pull date has stopped. Now picking up scrobbles from the last several months and re-jigging my columns. I'll let you know if I notice anything strange but so far, so good - thank you for your hard work!
That's awesome! Must have been an issue with the beta versions then. Glad everything is working again.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-03-23 04:12:50
So it was more than a few days, but I finally released v5.0.0 with official support for 2.0/x64. Enjoy, and please report any bugs or wonky behavior. Hopefully that's been cut down somewhat with this one. Only changes from the beta 2 were refactoring some code to make maintenance a lot easier going forward and bumping the version number.

You can get it here (https://github.com/kbuffington/foo_enhanced_playcount/releases/tag/5.0.0) or through the component registry.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: dpc666 on 2023-05-21 12:28:20
I recently lost all of my playback statistics, and am now trying to restore them from last.fm. When I use "Get Last.fm scrobbles" on my files, the playcount doesn't change though. I have entered my username in the settings and am certain that scrobbles exist, but I can't sync them.

Edit: Wait is there even a way to sync playcount from scrobbles with this component?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-05-21 18:21:47
Playcount does not change after pulling scrobbles. You'll probably want to use something like
Code: [Select]
$max(%play_count%,%lastfm_play_count%)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: dpc666 on 2023-05-22 10:19:21
I'd rather just have my normal stats back.

Is there no way to export last.fm stats as xml?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: dpc666 on 2023-05-22 14:49:36
I created an xml using Foobar's text tools and some really annoying text editing and was able to import it.
Unfortunately it seems that the component was unable to pull last.fm stats for about half my files (most of which I'm sure I have scrobbled), I think largely because of problematic unicode symbols.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: dpc666 on 2023-05-23 12:13:32
No, the problem was rather that the files had multiple years in the date tag.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: iridescentaudio on 2023-05-24 09:54:14
I have a couple of suggestions.

1.) Under Preferences -> Advanced -> Playback Statistics, enable automatic synchronisation of file tags with statistics. I'd recommend using this alongside External Tags too personally, so that you aren't constantly writing plays or ratings to actual audio files. Some audio formats won't support arbitrary tags so you would need External Tags for those anyway. Then if your foobar2000 library goes kaput again in future, it's a simple job of re-importing stats from file tags. I inexplicably lost stats a few times in the early days, so this is my way of taking matters into my own hands.

2.) This means you will want values in your file tags and library to remain consistent. Ordinarily they should be, but sometimes they won't because of last.fm pulls (especially if you also scrobble from mobile), or foobar crashes (maybe not as much of a problem with newer foobar versions), or maybe other reasons, so rather than having separate columns for a bunch of redundant playcount columns, my solution is to have one master playcount column which produces fat X and arrow symbols when there are inconsistencies, and toolbar buttons for moving stats & last.fm plays to tags, and importing from tags to stats, whichever the case required. There's probably a more elegant way to code this but it works.

Code: [Select]
$puts(bestcount,[$max(%play_count%,%lastfm_play_count%)])
$ifgreater($get(bestcount),
$meta(PLAY_COUNT)
,

,)

$ifgreater(%play_count%,$meta(PLAY_COUNT),←,)

$ifgreater($meta(PLAY_COUNT),%play_count%,→,)

Ideally what I'd also like is an autoplaylist populated with just these inconsistent items (so that I can keep track of them and fix them), but haven't figured out how to do that yet.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-05-24 17:57:38
I hate writing playcount tags to files, and I don't like external tags much either. To ensure I never lose my library, I moved my index-data folder into my dropbox folder, and then symlinked (https://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html) it back to the original location in my foobar folder. I haven't moved over to 2.0 yet, but when I do I'll be doing the exact same thing but with the entire profile folder to pick up metadb.sqlite. Unfortunately due to the size of metadb.sqlite you'd be transferring a lot more data in the background, and a lot more frequently. Still very doable though.

Advantage of this method is that you've always got a remote offsite backup and Dropbox offers 30 day version history for free so if something gets screwed up, you can just load an older version from the website.

Dropbox requires that files/folders actually be in the dropbox folder, and then can be symlink/junctioned to other locations, so you can't just pick and choose individual files and symlink them into your dropbox account as they won't sync. It's certainly possible that OneDrive, or Google Drive do allow for that kind of syncing though.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: regor on 2023-10-01 20:53:45
Just noticed the "native" copy playback statistics doesn't copy the enhanced stats, so there is no way to copy them between tracks (with different TF) as far as I know.

I suppose you can not hijack the original menu entry and add all the stats there (although that would be great), but could you at least provide a new entry at the enhanced menu with Reset/Copy/Paste options? (which would include both stats from foo_playcount and yours)
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Azuriye on 2023-11-18 16:24:04
Hello, Not sure if I am too late to the party but I've just stumbled upon your implementation of foo_playcount... I have one feature or more over a suggestion...

Is it possible to hook the function responsible for setting the %last_played% field and implement some sort of a slider for the user to choose or maybe a threshold limit where if the song plays for X minutes the last_played field gets updated? Poweramp has something similar to this...

I'm not sure if you've realised this but the original foo_playcount plugin for some reason only updates the %last_played% field after a minute of the song has been played. It would be really helpful if it could be a slider so that it's up to the user's preference. Not only that it will help me sort out my library to play songs which haven't played at all due to how Foobar's shuffle feature is restricted...
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2023-11-24 04:21:33
Is it possible to hook the function responsible for setting the %last_played% field and implement some sort of a slider for the user to choose or maybe a threshold limit where if the song plays for X minutes the last_played field gets updated? Poweramp has something similar to this...
This is not something I plan to ever implement. I'm going to keep it aligned with foobar's "listened" definition.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: Vhien on 2023-11-30 19:15:52
:D Might there be a version that works with the MacOS in the near future?
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: audiophool on 2024-02-12 12:12:44
I haven't messed with my fb2k installation in 5+ years so apologies if I'm being rusty.

I've recently upgraded from 1.6.x i386 to 2.1.2 x64 (on Windows 10 x64) and don't have the play counts in Columns UI which worked fine for ages. When I open "Media Library Search" instead, I can see the correctly populated play counts if I add that column.

In Columns UI, I've created a custom column Plays with Display script "[max(%play_count%,%lastfm_play_count%)]" (without the quotes). This column does not display anything.

Any suggestion?

Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: marc2k3 on 2024-02-12 13:03:11
$max not max.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: audiophool on 2024-02-12 13:34:51
$max not max.
Thanks so much for the quick reply. That way easy!
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: mihelson on 2024-03-03 20:00:25
How to display statistics when online radio is playing? The radio has tags, statistics on lastfm are available.