-
Notifications
You must be signed in to change notification settings - Fork 5
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 to multiple servers? #39
Comments
It depends how "clean" the solution should be. If you have countable number of servers, then you might duplicated the configuration and duplicate the scrobbling in the server code. If this solution should be more generic, then it might be a little bit of work (not much, though). First of all, the configuration should be flexible to allow any number of services for which the scrobbling should occur. Then, the actual scrobbling code should be moved to a separate thread, and N-number of threads should be created (in order to prevent unresponsiveness in case of not responding server) - one for each server. And finally, every thread should be "notified" (send a message to all threads using e.g. SEQPACKET socket) when scrobbling is required. Basically, that's my idea, but maybe other ideas will be good as well. If you (or anyone) will create PR I will review it of course. But on my part, I'm afraid that currently I've got not enough time for such change in this project - especially that I do not need such feature on my own. And to be clear, this project is not dead, I'm using cmusfm almost every day :D |
Thanks for the reply. It's fine if your time is limited, I don't expect you to do any additional work. Just asking for some info. I tried just changing the My first idea was:
I've modified the server loop to include re-initialization of scrobbling but it didn't work. The Now playing works for multiple servers, but only the first one gets the final scrobble. I'm assuming there's some shared global data where one If it's possible, one could separate the state (if it is file based) based on the configuration, so whenever a new configuration is made, the correct file is used. |
The big picture of the cmusfm architecture is as follows:
The server instance keeps state for current playback, and uses it to infer whether scrobbling should be done or not (there are some rules specified by the last.fm).
Now playing is sent to server when you start playing new song, but is does not mean that the song shall be scrobbled (you may play it for 2 seconds only, and it does not count as a scrobble trigger). The actual scrobble is sent to the server when you stop current song or start now one. So, that's the reason for a global state (it's not file based, it is kept in the server instance). The other problem with multi-server scrobble is the requirement to modify offline cache. Right now, if the server does not accept scrobbling (or e.g. there is no internet connection at the moment), all songs are "scrobbled" locally, and are synced later. With multi-server approach, such cache should be per-server. |
I understand you completely. Thanks for the info. I'll notify if I'll start developing. |
Would this be possible without much effort?
I've tried moving scrobbler initialization and other variables after rereading the
cmusfm.conf
change (in the server loop) but for some reason it ended up not working.The text was updated successfully, but these errors were encountered: