~ lirc & rhythmbox ->prossimo permalink
dopo tanto tempo torno a scrivere qualcosa.. ecco una memoria su come ho configurato lirc per funzionare a modino sul mio macbook 5,2:

/etc/lirc/lircrc

begin rhythmbox

begin
prog = Rhythmbox
button = play
config = playpause
end

begin
prog = Rhythmbox
button = pause
config = pause
end


begin
prog = Rhythmbox
button = forward
config = next
end

begin
prog = RhythmBox
button = backward
config = previous
end

begin
prog = RhythmBox
button = fw
config = seek_forward
end

begin
prog = RhythmBox
button = bw
config = seek_backward
end
end rhythmbox


begin
prog = irexec
button = volup
config = amixer -q set Front 5+ unmute
repeat = 2
end


begin
prog = irexec
button = voldown
config = amixer -q set Front 10- unmute
repeat = 2
end

begin
prog = irexec
button = play
config = rhythmbox-client
end

begin
prog = irexec
button = menu
config = rhythmbox-client --set-rating 2
end





l'ultima cosa funziona solo dopo aver patchato rhythmbox, in particolare il client rhythmbox-client con la seguente patch per il file rhythmbox/remote/dbus/rb-client.c

--- rb-client.c-orig      2009-05-18 19:30:09.000000000 +0200
+++ rb-client.c      2009-05-18 19:32:10.000000000 +0200
@@ -72,6 +72,7 @@ static gboolean volume_down = FALSE;
static gboolean print_volume = FALSE;
static gboolean mute = FALSE;
static gboolean unmute = FALSE;
+static gdouble set_rating = -1.0;

static gchar **other_stuff = NULL;

@@ -107,6 +108,7 @@ static GOptionEntry args[] = {
      { "print-volume", 0, 0, G_OPTION_ARG_NONE, &print_volume, N_("Print the current playback volume"), NULL },
      { "mute", 0, 0, G_OPTION_ARG_NONE, &mute, N_("Mute playback"), NULL },
      { "unmute", 0, 0, G_OPTION_ARG_NONE, &unmute, N_("Unmute playback"), NULL },
+      { "set-rating", 0, 0, G_OPTION_ARG_DOUBLE, &set_rating, N_("Rates current song"), NULL },

      { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &other_stuff, NULL, NULL },

@@ -490,6 +492,37 @@ print_playing_song_default (DBusGProxy *
      g_free (string);
}

+static void
+rate_song (DBusGProxy *shell_proxy, DBusGProxy *player_proxy, gdouble song_rating)
+{
+      GError *error = NULL;
+      char *playing_uri;
+      GValue * value = NULL;
+
+      value=g_new0(GValue, 1);
+      g_value_init(value, G_TYPE_DOUBLE);
+      g_value_set_double(value, song_rating);
+      
+      org_gnome_Rhythmbox_Player_get_playing_uri (player_proxy, &playing_uri, &error);
+      if (error != NULL) {
+            return;
+      }
+
+      if (!playing_uri || playing_uri[0] == '\0') {
+            return;
+      }
+
+      rb_debug ("rating song %s: %f", playing_uri, song_rating);
+      
+      org_gnome_Rhythmbox_Shell_set_song_property (shell_proxy, playing_uri, "rating", value, &error);
+      
+      if (annoy (&error)) {
+            return;
+      }
+      
+      g_free (value);
+}
+
int
main (int argc, char **argv)
{
@@ -582,7 +615,7 @@ main (int argc, char **argv)
       play_uri || other_stuff ||
       play || pause || play_pause || stop ||
       print_playing || print_playing_format || notify ||
-       (set_volume > -0.01) || volume_up || volume_down || print_volume || mute || unmute)
+       (set_volume > -0.01) || volume_up || volume_down || print_volume || mute || unmute || (set_rating > -0.01))
            no_present = TRUE;

      /* 2. present or hide */
@@ -720,6 +753,14 @@ main (int argc, char **argv)
            org_gnome_Rhythmbox_Shell_notify (shell_proxy, TRUE, &error);
            annoy (&error);
      }
+      
+      /* 9. set song rate */
+      if (set_rating>=0.0 && set_rating<=5.0) {
+            rb_debug ("rate song");
+            
+            rate_song (shell_proxy, player_proxy, set_rating);
+      }
+      

      g_object_unref (shell_proxy);
      g_object_unref (player_proxy);


per il quale ho aperto una feature-request: http://bugzilla.gnome.org/show_bug.cgi?id=583108
vediamo come andra' a finire :D



un ulteriore sviluppo potrebbe essere:
-la possibilità di incrementare o di diminuire il voto di una canzone
-portare le stesse modifiche dentro al plugin lirc di rhythmbox
ste's home page
sancho ascoltami, ti prego / sono stato anch'io un realista / ma ormai oggi me ne frego e anche se ho una buona vista,
l'apparenza delle cose / come vedi non m'inganna / preferisco le sorprese di quest'anima tiranna / che trasforma coi suoi trucchi la realtà che hai lì davanti
ma ti apre nuovi occhi e ti accende i sentimenti / prima d'oggi mi annoiavo e volevo anche morire / ma ora sono un uomo nuovo che non teme di soffrire