Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles (Read 128322 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #375
Thanks for the reply. I was using 2.0 beta v17 (32bit), though I just updated to the newest beta this morning, and also discovered the alternative last.fm component by marc2k3 which is working well so I'm using that at least for the time being (though I will miss the automatic fetching of recent scrobbles...)

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #376
5.0.0 beta 1 here:

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

Nevermind

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #377
@iridescentaudio I was looking at the code tonight. On startup it will pull up to 800 songs from the last scrobble it knows about to attempt to keep everything in sync.

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

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

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #378
5.0.0 beta 1 here:

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

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

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

-TT

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

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

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

My problem is that once I start fiddling with a project I can't force myself to stop. I'm up till 3AM every night trying to tie up every last loose end, etc. So I go through starts and stops with this stuff in an attempt to keep myself (relatively) sane.

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #380
v5.0.0b1 seems to work fine on 1.6.x, but on 2.0 only manual scrobble pulls work. For some reason it's unable to search the library in the same way that the old version does. Not sure if that's a bug, or more likely my implementation is messed up.

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #381
The library in v2 is loaded asynchronously so code like this...

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

will return 0 items if you run it too early.

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

You might want to look at on_library_initialized here

https://github.com/marc2k3/foobar2000-sdk-2/blob/c2b5293e8107af51b9d1b3daab66da31e0459474/foobar2000/SDK/library_callbacks.h#L25-L32

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #382
The library in v2 is loaded asynchronously so code like this...

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

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

Also is there a list of changes for how 2.0 works compared to 1.6 or do I just need to have been following a bunch of different threads for the last few months?

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #383
I looked at your github and that code looks so wrong (to me) that I can't believe it worked??

I'm submitting a PR.  :))

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

Code: [Select]
//! \since 2.0

late edit: my PR didn't even compile. What a genius I am.  ;D

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #384
I looked at your github and that code looks so wrong (to me) that I can't believe it worked??

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

I'm hopeful that situation will improve once 2.0 gets out of beta and the SDK is somewhat more locked down.

 

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #385
5.0.0 beta 2
 - In 2.0 component now waits for library to load before pulling scrobbles
 - Actually removes duplicate hashes when pulling recent/historical scrobbles. This speeds up scrobble pulls if you have multiple copies of the same albums in your library (i.e. different encodes, editions, etc.) and cuts down on console spam
 - Next historical scrobble pull shows the correct date, and the reset button now sets next pull date to current time. This fixes a bug where pulls after a reset did not work correctly.
 - Component is now referred to everywhere in the UI as "Playback Statistics Enhanced", instead of confusingly sometimes calling itself "Playcount Enhanced"

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

https://www.dropbox.com/s/qkcxy7eqm8vi5z5/foo_enhanced_playcount-v5.0.0b2.fb2k-component?dl=0

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #386
How to do a reverse import of information??? Statistics were lost for a certain period. At the same time, there are statistics that are not in last fm and there is information on the site that is not in the player

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #387
@iridescentaudio I was looking at the code tonight. On startup it will pull up to 800 songs from the last scrobble it knows about to attempt to keep everything in sync.

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

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

Apologies for being slow getting back to you, I'm testing it out today and everything seems to be smooth sailing so far, I haven't noticed the same CPU spikes I was having before, and the idiosyncratic behaviour with the pull date has stopped. Now picking up scrobbles from the last several months and re-jigging my columns. I'll let you know if I notice anything strange but so far, so good - thank you for your hard work!

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #388
Apologies for being slow getting back to you, I'm testing it out today and everything seems to be smooth sailing so far, I haven't noticed the same CPU spikes I was having before, and the idiosyncratic behaviour with the pull date has stopped. Now picking up scrobbles from the last several months and re-jigging my columns. I'll let you know if I notice anything strange but so far, so good - thank you for your hard work!
That's awesome! Must have been an issue with the beta versions then. Glad everything is working again.

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #389
So it was more than a few days, but I finally released v5.0.0 with official support for 2.0/x64. Enjoy, and please report any bugs or wonky behavior. Hopefully that's been cut down somewhat with this one. Only changes from the beta 2 were refactoring some code to make maintenance a lot easier going forward and bumping the version number.

You can get it here or through the component registry.

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #390
I recently lost all of my playback statistics, and am now trying to restore them from last.fm. When I use "Get Last.fm scrobbles" on my files, the playcount doesn't change though. I have entered my username in the settings and am certain that scrobbles exist, but I can't sync them.

Edit: Wait is there even a way to sync playcount from scrobbles with this component?

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #391
Playcount does not change after pulling scrobbles. You'll probably want to use something like
Code: [Select]
$max(%play_count%,%lastfm_play_count%)

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #392
I'd rather just have my normal stats back.

Is there no way to export last.fm stats as xml?

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #393
I created an xml using Foobar's text tools and some really annoying text editing and was able to import it.
Unfortunately it seems that the component was unable to pull last.fm stats for about half my files (most of which I'm sure I have scrobbled), I think largely because of problematic unicode symbols.

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #394
No, the problem was rather that the files had multiple years in the date tag.

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #395
I have a couple of suggestions.

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

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

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

,)

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

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

Ideally what I'd also like is an autoplaylist populated with just these inconsistent items (so that I can keep track of them and fix them), but haven't figured out how to do that yet.

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #396
I hate writing playcount tags to files, and I don't like external tags much either. To ensure I never lose my library, I moved my index-data folder into my dropbox folder, and then symlinked it back to the original location in my foobar folder. I haven't moved over to 2.0 yet, but when I do I'll be doing the exact same thing but with the entire profile folder to pick up metadb.sqlite. Unfortunately due to the size of metadb.sqlite you'd be transferring a lot more data in the background, and a lot more frequently. Still very doable though.

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

Dropbox requires that files/folders actually be in the dropbox folder, and then can be symlink/junctioned to other locations, so you can't just pick and choose individual files and symlink them into your dropbox account as they won't sync. It's certainly possible that OneDrive, or Google Drive do allow for that kind of syncing though.

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #397
Just noticed the "native" copy playback statistics doesn't copy the enhanced stats, so there is no way to copy them between tracks (with different TF) as far as I know.

I suppose you can not hijack the original menu entry and add all the stats there (although that would be great), but could you at least provide a new entry at the enhanced menu with Reset/Copy/Paste options? (which would include both stats from foo_playcount and yours)

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #398
Hello, Not sure if I am too late to the party but I've just stumbled upon your implementation of foo_playcount... I have one feature or more over a suggestion...

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

I'm not sure if you've realised this but the original foo_playcount plugin for some reason only updates the %last_played% field after a minute of the song has been played. It would be really helpful if it could be a slider so that it's up to the user's preference. Not only that it will help me sort out my library to play songs which haven't played at all due to how Foobar's shuffle feature is restricted...

Re: foo_enhanced_playcount - Record all song plays and Last.fm scrobbles

Reply #399
Is it possible to hook the function responsible for setting the %last_played% field and implement some sort of a slider for the user to choose or maybe a threshold limit where if the song plays for X minutes the last_played field gets updated? Poweramp has something similar to this...
This is not something I plan to ever implement. I'm going to keep it aligned with foobar's "listened" definition.