Monday, March 5, 2012

Rate songs in notifications with Rhythmbox

Update: Keeping in mind the feedback, I have enabled instant update of the notification once the ratings are changed in my new patch to the notification plugin of Rhythmbox.

When do you rate your songs?

I have a huge music library. Enough to keep me engaged for more than a month if I listen to each song in a row with no repeats. Hence, my preferred time for rating songs is while I am listening to it.

Currently, this process is somewhat complicated. I have to go to Rhythmbox's workspace, rate the song and then figure out which workspace did I just leave and then continue my previous work. This interrupts my work flow.

However, Gnome 3 allows actions in its notifications and one can already do the Previous, Play/Pause, Next actions from within the notification.

Current notifications in Rhythmbox for Gnome 3

Wouldn't it be lovely if I could rate songs via this notification itself?

Rating in Notifications

So I checked-out Rhythmbox source code and made modifications (new patch) to the Notification plugins to get something like this:

New Rhythmbox Notifications with Rate Up/Rate Down buttons (between the Pause and Next)

The two extra buttons between the Pause and Next are the Rate up and Rate down buttons. These buttons increase and decrease respectively the number of stars of rating given to the song. If the song was initially un-rated, the rating is assumed to be 3 stars.

This video describes the working in somewhat detail (also shows how to do it once the notification disappears, just open the notification by clicking on the status-icon):

UI issue

There are some problems with the plugin which Nirbheek pointed out, the primary issue being inconsistent UI. Gnome's standard set of icons lacks stock icons for increasing/decrearing ratings. The buttons (go-up and go-down) which I use to rate the songs are the closest I could find for the purpose.

This problem arises because one can use only Gnome theme's named icons in the notifications. There are several ways of dealing with it:
  1. Allowing arbitrary icons with buttons in notifications.
  2. Adding rate-up and rate-down icons in Gnome.
  3. Allowing arbitrary widgets inside Notifications.
  4. Using better integration with Gnome 3. (Dedicated plugin for Gnome 3 like Pidgin's?)
Which of these is the best way is something which should be discussed further.

My 2 cents

I don't think operations rate-up and rate-down are common enough to warrant a standard icon in every Gnome theme. Widgets are ill-placed in lightweight notifications. Making a Gnome3 extension will be a Gnome3 specific solution. I think (1) is the best route to take at the moment even though this would require additions to the libnotify API. On the other hand I just might go for (4) because it seems to be the easiest alternative.

PS: Losing ratings of my entire library has one redeeming aspect; I get to rediscover music which I once loved as I listen to my entire collection and rate them all over again.


Shreyes said...

Bravo you finally managed to figure it out. Good job.!:-)

Piyush said...

Off topic, but what between GNOME 3 (which would mean Fedora 17) and Unity (Ubuntu Precise) would you recommend to a prodigal Ubuntu user planning to switch back to Linux after a one year hiatus?

Utkarsh Upadhyay said...

You will find both of them filled with surprises.
I would recommend Gnome 3, but that is a biased opinion. :)


william said...

I likes :)

Utkarsh Upadhyay said...

Me toos.
I have been using it for the last month or so and it seems so much easier than rating my songs one by one or in patches.