quodlibet / quodlibet

Music player and music library manager for Linux, Windows, and macOS
https://quodlibet.readthedocs.io
GNU General Public License v2.0
1.43k stars 224 forks source link

Allow plugins to hook into ratings events #963

Open lazka opened 9 years ago

lazka commented 9 years ago

Original issue 963 created by nick.boultbee on 2012-05-07T09:55:08.000Z:

It would be good for plugins to be able to subscribe to ratings events i.e.

  1. when user changes the rating of a song (or potentially album one day - see Issue #544, or maybe artist somehow too), signals are sent with the rating chosen
  2. When a song is loaded, or periodically, any subscribed plugins would be able to somehow influence or override the rating coming from the QL library. This would require some thought especially for the case of multiple providers, as well as caching and timeouts.

The prime candidates for this are scrobblers - last.fm provides a track.love [1] and track.unlove [2] API commands and I imagine there are others like this.

[1] http://www.last.fm/api/show/track.love [2] http://www.last.fm/api/show/track.unlove

lazka commented 9 years ago

Comment #2 originally posted by sp4zzpp2 on 2013-09-04T17:41:53.000Z:

QL doesn't have any track.love/.unlove support, does it?

lazka commented 9 years ago

Comment #3 originally posted by nick.boultbee on 2013-10-07T22:30:04.000Z:

Not currently - that's what this would enable...

cauerego commented 7 years ago

just please don't mix up QL ratings with last.fm track-love, as per #2381! ;P

ghost commented 5 years ago

Hi,

I'd like to start working on this issue simply to make #927 cleaner. In order to do so, I would just like to send out ratings events whenever they are changed in a track.
Without having looked at the code, I'm assuming there's a listener either at track level or GUI component level where I can trigger an event to be forwarded to plugins.

May I start working on that sub-issue in that manner?

Cheers

ghost commented 5 years ago

Looking at this, there is already a plugin_on_changed event handler that is called when a song is rated or otherwise modified. The only problem is that one doesn't know which attribute has been modified. Therefore I think the better solution to track which attribute changed would have to be introduced.

I'm sure that would be a bigger change, so I'm not gonna tackle this now unless there's a precise idea or feedback.

bassstorm commented 3 years ago

Looking at this, there is already a plugin_on_changed event handler that is called when a song is rated or otherwise modified. The only problem is that one doesn't know which attribute has been modified. Therefore I think the better solution to track which attribute changed would have to be introduced.

Agree, maybe just supplying an attribute change set along with affected song(s) would be a good deal for start. Spent a couple of hours today how events/plugins work, not very successfully though...