Hydrogenaudio Forums

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

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

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

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

New fields provided:

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

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

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

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

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

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

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

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

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

v3.0.6 - 2019-01-10

v3.0.4 - 2018-09-03

v3.0.2 - 2018-08-07

v3.0.1 - 2018-05-23

v3.0.0 - 2018-05-11

v2.5.1 - 2018-04-16

v2.1.1 - 2018-04-11

v2.1.0 - 2018-04-07

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

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

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

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

v1.0.2
 - Changed name to foo_enhanced_playcount

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

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

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

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

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

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

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

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

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

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

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

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

Here's the skinny. New fields:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Hey MordredKLB,
thanks for responding that quickly.

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

Hope this can help.

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

Hope this can help.

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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


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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

hey,

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

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

Kind regards
v2.5.0beta1

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

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

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

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

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

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

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

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

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

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

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

Change list:

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

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

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

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

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

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

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

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

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

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




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

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

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

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

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

Edit:

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

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

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

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



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

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

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

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

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


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

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

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

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

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


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

Goddam you're fast !!!

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

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

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

Happy to make all the posible test to improve it.

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

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

I think I found another discrepancy in %last_played_enhanced%.

Cleaning lastfm data to test again from the begining.

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

Then I run get lastfm scrobbles in the files

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

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

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

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

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

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

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

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

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

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

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

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

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

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

for example:

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



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

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

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

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

No problem, I try to PM you right now


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

Correct

PD:
I PM you the files

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

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

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

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

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

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

Tested in the problematic files, problem solved.

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

Beta 6 changelist:

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

Of course, with eternal love and honey ;)


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

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

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

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

Cool  8)

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



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

Changelog

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

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

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

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

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

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

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

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

But first things first:

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

Now the nagging :-)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

The component also minimizes requests by caching (if you're playing only songs by one artist you should never see the popup until you restart foobar), and also checking the last recorded scrobble we know about. So you might have 1000 scrobbles from an artist, but if the component has a record of the scrobble from yesterday it will stop making requests to last.fm if it finds scrobbles before that date in the last response.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: kode54 on 2019-02-01 00:19:40
The only workaround to doing it in the background would be to implement the full threading model of the background request manually, and avoid using the SDK's convenient threaded background process interface.
Title: Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles
Post by: MordredKLB on 2019-02-05 23:08:54
The only workaround to doing it in the background would be to implement the full threading model of the background request manually, and avoid using the SDK's convenient threaded background process interface.
For the record, I do not have the knowledge or skills required to do this. Frankly I'm amazed I was able to write this component to begin with :)
SimplePortal 1.0.0 RC1 © 2008-2019