changeset 2407:1dc1d36d0347 trunk

[svn] - add hooks: playback begin, playback end, playlist reached end
author nenolod
date Thu, 25 Jan 2007 21:29:51 -0800
parents 6f4094cc3859
children b380e84148bb
files ChangeLog src/audacious/playback.c src/audacious/playlist.c
diffstat 3 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jan 25 21:19:44 2007 -0800
+++ b/ChangeLog	Thu Jan 25 21:29:51 2007 -0800
@@ -1,3 +1,11 @@
+2007-01-26 05:19:44 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [3822]
+  - allow for hooks to be automatically registered if they are needed
+  
+  trunk/src/audacious/hook.c |    8 +++++++-
+  1 file changed, 7 insertions(+), 1 deletion(-)
+
+
 2007-01-26 04:50:15 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [3820]
   enhancement to popup information settings
--- a/src/audacious/playback.c	Thu Jan 25 21:19:44 2007 -0800
+++ b/src/audacious/playback.c	Thu Jan 25 21:29:51 2007 -0800
@@ -51,9 +51,9 @@
 #include "libaudacious/urldecode.h"
 #include "util.h"
 
-
 #include "playback.h"
 
+#include "hook.h"
 
 /* FIXME: yuck!! this shouldn't be here... */
 void
@@ -140,6 +140,8 @@
 
     playlist_check_pos_current(playlist);
     mainwin_set_info_text();
+
+    hook_call("playback begin", entry);
 }
 
 void
--- a/src/audacious/playlist.c	Thu Jan 25 21:19:44 2007 -0800
+++ b/src/audacious/playlist.c	Thu Jan 25 21:29:51 2007 -0800
@@ -67,6 +67,8 @@
 
 #include "debug.h"
 
+#include "hook.h"
+
 typedef gint (*PlaylistCompareFunc) (PlaylistEntry * a, PlaylistEntry * b);
 typedef void (*PlaylistSaveFunc) (FILE * file);
 
@@ -1341,6 +1343,8 @@
     if ((cfg.no_playlist_advance && !cfg.repeat) || cfg.stopaftersong)  
       ip_data.stop = FALSE;
 
+    hook_call("playback finish", playlist->position);
+
     PLAYLIST_LOCK(playlist->mutex);
     
     if ((playlist_position_before_jump != NULL) && playlist->queue == NULL)
@@ -1379,6 +1383,7 @@
 
         if (!cfg.repeat) {
             PLAYLIST_UNLOCK(playlist->mutex);
+	    hook_call("playlist reached end", playlist->position);
             mainwin_clear_song_info();
             mainwin_set_info_text();
             return;