# HG changeset patch # User deitarion # Date 1154857947 25200 # Node ID ae369659010a3a63ebe9ea3ec9e85a89ed704b20 # Parent 2e1e5dae8f4c6517485a2155b942b542ce65412f [svn] Added awareness of the difference between stopped and playing. diff -r 2e1e5dae8f4c -r ae369659010a ChangeLog --- a/ChangeLog Sun Aug 06 01:54:32 2006 -0700 +++ b/ChangeLog Sun Aug 06 02:52:27 2006 -0700 @@ -1,3 +1,13 @@ +2006-08-06 08:54:32 +0000 William Pitcock + revision [1930] + - prepare to add an optional libxml2 dependency + + + Changes: Modified: + +188 -0 trunk/m4/libxml.m4 + +2 -0 trunk/mk/rules.mk.in + + 2006-08-06 08:53:29 +0000 William Pitcock revision [1928] - incomplete stuff diff -r 2e1e5dae8f4c -r ae369659010a Plugins/General/notify/notify.c --- a/Plugins/General/notify/notify.c Sun Aug 06 01:54:32 2006 -0700 +++ b/Plugins/General/notify/notify.c Sun Aug 06 02:52:27 2006 -0700 @@ -10,6 +10,7 @@ #include #include "audacious/plugin.h" #include "audacious/playlist.h" +#include "audacious/input.h" #include "config.h" @@ -20,6 +21,7 @@ static gint notify_playlist_pos = -1; static gchar *previous_title = NULL; +static gboolean was_playing = FALSE; /* our API. */ static void do_notification(gchar *summary, gchar *message, gchar *icon_uri); @@ -44,6 +46,10 @@ static void init(void) { + /* + TODO: I assume 100 means 100ms checking interval? Why not 200? + It would be twice as efficient and the user shouldn't notice any difference. + */ timeout_tag = gtk_timeout_add(100, watchdog_func, NULL); } @@ -63,9 +69,20 @@ gint pos = playlist_get_position(); gchar *title = playlist_get_songtitle(pos); - if ((title != NULL && previous_title != NULL && - g_strcasecmp(title, previous_title)) || - (title == NULL && pos != notify_playlist_pos)) + /* + Trigger a notice if a song is now playing and one of the following is true: + 1. it has a different title from the last time this ran + 2. there is no title but it's a different playlist position + 3. the player was stopped the last time this ran + (listed in the order they are checked) + + FIXME: The same song twice in a row will only get announced once. + Proposed Remedy: Add a check for playback progress. + */ + if (ip_data.playing && + ((title != NULL && previous_title != NULL && + g_strcasecmp(title, previous_title)) || + (title == NULL && pos != notify_playlist_pos) || (! was_playing))) { gchar *tmpbuf; TitleInput *tuple; @@ -75,6 +92,10 @@ if (tuple == NULL) return TRUE; + /* + FIXME: This is useless for formats without metadata. + Proposed Remedy: playlist_get_filename(pos) instead of _("Unknown Track") + */ tmpbuf = g_markup_printf_escaped("%s\n%s\n%s", (tuple->performer ? tuple->performer : _("Unknown Artist")), (tuple->album_name ? tuple->album_name : _("Unknown Album")), @@ -93,6 +114,7 @@ } previous_title = g_strdup(title); + was_playing = ip_data.playing; return TRUE; }