Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrobbling randomly doesn’t work/scrobbling logic doesn’t take into account if server received it #226

Closed
el-tiuri opened this issue Mar 12, 2024 · 13 comments
Labels
bug Something isn't working implemented This feature/bug is implemented TestInBeta This feature can be tested in Beta

Comments

@el-tiuri
Copy link

Reporting playback to my Subsonic (Navidrome) server randomly doesn’t work; oftentimes the songs at the beginning of a queue or album won’t scrobble, then most of those after will.

I feel like adding a check to see if the server has received the message and resending it if necessary would solve this. I tried diving into the code a while ago to fix scrobling logic (see here: #106 (comment)), but I didn’t end up finding the time to brush up on my skills to resolve this.

I do think that a fix for this would also solve the previous issue;

  • Try to scrobble a song
  • Check if it was received
  • If yes > good
  • If no > cache it with timestamp and retry the next time a scrobble goes through successfully

If I do find the time I’ll try to look at it again myself, but I don’t think that’ll happen tbh.

@BLeeEZ
Copy link
Owner

BLeeEZ commented Apr 22, 2024

Scribble cache is already implemented. When server is not reachable the scrobble gets saved. All cached scrobbles get uploaded when the server is reachable.
I reworked the scrobble behaviour in e4e864c and f427673.

@BLeeEZ BLeeEZ added the implemented This feature/bug is implemented label Apr 22, 2024
@el-tiuri
Copy link
Author

This is fantastic! Are the scrobbles timestamped for the moment they were originally played as described here? That’s the last thing stopping me from using Amperfy full time. I’d test it out myself, but the update isn’t available yet on TestFlight.

Either way, thanks for the improvements!

@BLeeEZ
Copy link
Owner

BLeeEZ commented Apr 23, 2024

Scrobble cache is already available in v1.2.0.
Only the NowPlaying feature is new and can be tested in upcoming v.1.2.1.

@BLeeEZ BLeeEZ added the TestInBeta This feature can be tested in Beta label Jun 5, 2024
@BLeeEZ
Copy link
Owner

BLeeEZ commented Jun 5, 2024

This feature can be tested in the newest beta v1.2.1 (2): #25

@BLeeEZ
Copy link
Owner

BLeeEZ commented Jun 5, 2024

Please provide your comments in the feature threads to keep the beta thread as clean as possible.

I just discovered that the first track in a queue never seems to scrobble. Everything beyond that seems to work fine (as does replaying the first track), but after trying multiple times the first song played never seems to go through.

Another scrobbling related one: all songs played when offline still get timestamped at the time you go online, rather than when they were played. I thought this was fixed, but apparently not? Or is this the expected behaviour?

It’s a bit of a shame, because if you listen to a couple of albums when offline and then go online they’ll all be reported as being played on the exact same time.

@el-tiuri
Copy link
Author

el-tiuri commented Jun 5, 2024

Apologies, I posted it there because you linked it here! My bad!

@BLeeEZ
Copy link
Owner

BLeeEZ commented Jun 5, 2024

I tested Ampache and Subsonic regarding your description. I can't reproduce this behaviour. All songs are scribbled, the first one too. Cached scrobbles are transmitted with the timestamp when the song was played.

@el-tiuri
Copy link
Author

el-tiuri commented Jun 6, 2024

Turns out my Navidrome server was set to the wrong time zone, leading scrobbles to be timestamped after the time the server was set to - which caused Navidrome to scrobble them at the time they were sent. For some reason this never was an issue for the other app I use (Substreamer), and now that I’ve corrected it on my end Amperfy seems to work as expected as well! I’ll continue testing to see if I encounter anything else.

Thanks for your help, and apologies for my mistake.

@el-tiuri
Copy link
Author

For some reason, I’m still experiencing this when songs were played in offline mode, while it does work when offline mode is disabled but there’s no connection to the server.

@el-tiuri
Copy link
Author

I’m still experiencing issues with songs being scrobbled when going online, rather than when they were played. I double checked and my Subsonic server (Navidrome) was set to the right time.

I quickly checked out the relevant code, and it seems to me the timestamps are not saved in the unix epoch format? As far as I can tell switching over to that should fix this entirely, as it’s the native time format for both Subsonic scrobbles and Last.fm scrobbles.

@BLeeEZ
Copy link
Owner

BLeeEZ commented Jul 15, 2024

I am saving the scrobble date and time here: https://github.com/BLeeEZ/amperfy/blob/master/AmperfyKit/Player/ScrobbleSyncer.swift#L144
The date will be send to server as timeIntervalSince1970 Integer as described in the specification: https://github.com/BLeeEZ/amperfy/blob/master/AmperfyKit/Api/Subsonic/SubsonicServerApi.swift#L698
I can't see an error here.

@el-tiuri
Copy link
Author

Ah, I thought Date() returned it in a different format, it’s been a long while since I coded altogether (clearly lol). I’d have to play around with it myself, because I can’t figure out for the life of me why this goes wrong with some regularity.

I’ll try to find out more, if only to make sure someone with the same problem can find a solution here.

@BLeeEZ
Copy link
Owner

BLeeEZ commented Jul 15, 2024

For some reason, I’m still experiencing this when songs were played in offline mode, while it does work when offline mode is disabled but there’s no connection to the server.

With 055a1aa I fixed an error with failed scrobble syncs. If a scrobble request send to the server fails, the scrobble gets cached too and will be synced when the server is available again.

@BLeeEZ BLeeEZ removed the TestInBeta This feature can be tested in Beta label Jul 17, 2024
@BLeeEZ BLeeEZ added bug Something isn't working TestInBeta This feature can be tested in Beta labels Nov 4, 2024
@BLeeEZ BLeeEZ closed this as completed Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working implemented This feature/bug is implemented TestInBeta This feature can be tested in Beta
Projects
None yet
Development

No branches or pull requests

2 participants