Actually, use this patch instead. It will also fire the first time it sees a new title, even if the previous saved one was empty. The previous patch would need *two* changes of title before it would fire the script, one to fill in the previous, and then another to be different to that.
I'd definitely push this upstream if possible. I really don't know why this has remained unfixed for so long, I guess no audacious dev cared about this bit of code. diff -ur audacious-plugins-3.5/src/song_change/song_change.c new-audacious-plugins-3.5/src/song_change/song_change.c --- audacious-plugins-3.5/src/song_change/song_change.c 2014-04-23 03:37:46.000000000 +0100 +++ new-audacious-plugins-3.5/src/song_change/song_change.c 2016-02-25 00:18:01.691451152 +0000 @@ -32,7 +32,7 @@ static void songchange_playback_begin(gpointer unused, gpointer unused2); static void songchange_playback_end(gpointer unused, gpointer unused2); static void songchange_playlist_eof(gpointer unused, gpointer unused2); -//static void songchange_playback_ttc(gpointer, gpointer); +static void songchange_playback_ttc(gpointer, gpointer); typedef struct { @@ -252,7 +252,7 @@ hook_dissociate("playback begin", songchange_playback_begin); hook_dissociate("playback end", songchange_playback_end); hook_dissociate("playlist end reached", songchange_playlist_eof); - // hook_dissociate( "playlist set info" , songchange_playback_ttc); + hook_dissociate("title change" , songchange_playback_ttc); if ( ttc_prevs != NULL ) { @@ -320,7 +320,7 @@ ttc_prevs = g_malloc0(sizeof(songchange_playback_ttc_prevs_t)); ttc_prevs->title = NULL; ttc_prevs->filename = NULL; - // hook_associate( "playlist set info" , songchange_playback_ttc , ttc_prevs ); + hook_associate("title change" , songchange_playback_ttc , ttc_prevs ); return TRUE; } @@ -335,53 +335,58 @@ do_command (cmd_line_after); } -#if 0 static void songchange_playback_ttc(gpointer plentry_gp, gpointer prevs_gp) { - if ( ( aud_ip_state->playing ) && ( strcmp(cmd_line_ttc,"") ) ) + if ( aud_drct_get_playing() && ( strcmp(cmd_line_ttc,"") ) ) { songchange_playback_ttc_prevs_t *prevs = prevs_gp; - PlaylistEntry *pl_entry = plentry_gp; + int playlist = aud_playlist_get_playing (); + int pl_entry = aud_playlist_get_position(playlist); + gchar *pl_entry_filename = aud_playlist_entry_get_filename(playlist, pl_entry); + gchar *pl_entry_title = aud_playlist_entry_get_title(playlist, pl_entry, FALSE); /* same filename but title changed, useful to detect http stream song changes */ if ( ( prevs->title != NULL ) && ( prevs->filename != NULL ) ) { - if ( ( pl_entry->filename != NULL ) && ( !strcmp(pl_entry->filename,prevs->filename) ) ) + if ( ( pl_entry_filename != NULL ) && ( !strcmp(pl_entry_filename,prevs->filename) ) ) { - if ( ( pl_entry->title != NULL ) && ( strcmp(pl_entry->title,prevs->title) ) ) + if ( ( pl_entry_title != NULL ) && ( strcmp(pl_entry_title,prevs->title) ) ) { - int pos = aud_drct_pl_get_pos(); - char *current_file = aud_drct_pl_get_file(pos); - do_command(cmd_line_ttc, current_file, pos); - g_free(current_file); + do_command(cmd_line_ttc); g_free(prevs->title); - prevs->title = g_strdup(pl_entry->title); + prevs->title = g_strdup(pl_entry_title); } } else { g_free(prevs->filename); - prevs->filename = g_strdup(pl_entry->filename); + prevs->filename = g_strdup(pl_entry_filename); /* if filename changes, reset title as well */ if ( prevs->title != NULL ) g_free(prevs->title); - prevs->title = g_strdup(pl_entry->title); + prevs->title = g_strdup(pl_entry_title); } } else { - if ( prevs->title != NULL ) - g_free(prevs->title); - prevs->title = g_strdup(pl_entry->title); - if ( prevs->filename != NULL ) - g_free(prevs->filename); - prevs->filename = g_strdup(pl_entry->filename); + if ( pl_entry_filename != NULL && pl_entry_title != NULL ) + { + do_command(cmd_line_ttc); + if ( prevs->title != NULL ) + g_free(prevs->title); + prevs->title = g_strdup(pl_entry_title); + if ( prevs->filename != NULL ) + g_free(prevs->filename); + prevs->filename = g_strdup(pl_entry_filename); + } } + + str_unref (pl_entry_filename); + str_unref (pl_entry_title); } } -#endif static void songchange_playlist_eof(gpointer unused, gpointer unused2) {