changeset 1578:063fde7e5100 trunk

[svn] - Show the filename if there's no track_name
author nhjm449
date Sat, 12 Aug 2006 16:46:09 -0700
parents 18edacaa3126
children d60e3dbe1a48
files ChangeLog Plugins/General/notify/notify.c
diffstat 2 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Aug 11 18:41:53 2006 -0700
+++ b/ChangeLog	Sat Aug 12 16:46:09 2006 -0700
@@ -1,3 +1,12 @@
+2006-08-12 01:41:53 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [2068]
+  - installing Container plugins might help!
+  
+
+  Changes:        Modified:
+  +1 -1           trunk/Plugins/Makefile.in  
+
+
 2006-08-11 12:13:11 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [2066]
   jump to file dialog now accepts multi-byte input.
--- a/Plugins/General/notify/notify.c	Fri Aug 11 18:41:53 2006 -0700
+++ b/Plugins/General/notify/notify.c	Sat Aug 12 16:46:09 2006 -0700
@@ -7,6 +7,7 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+#include <string.h>
 
 #include <libnotify/notify.h>
 #include "audacious/plugin.h"
@@ -113,7 +114,7 @@
 		g_strcasecmp(title, previous_title)) ||
 		(title == NULL && pos != notify_playlist_pos) || (! was_playing)))
 	{
-		gchar *tmpbuf;
+		gchar *tmpbuf, *filename;
 		TitleInput *tuple;
 
 		tuple = playlist_get_tuple(pos);
@@ -121,14 +122,19 @@
 		if (tuple == NULL)
 			return TRUE;
 
-		/* 
-		FIXME: This is useless for formats without metadata.
-		Proposed Remedy: playlist_get_filename(pos) instead of _("Unknown Track")
-		*/
+		filename = playlist_get_filename(pos);
+
 		tmpbuf = g_markup_printf_escaped("<b>%s</b>\n<i>%s</i>\n%s",
 			(tuple->performer ? tuple->performer : ( audcfg.notif_skipnf == FALSE ? _("Unknown Artist") : "" )),
 			(tuple->album_name ? tuple->album_name : ( audcfg.notif_skipnf == FALSE ? _("Unknown Album") : "" )),
-			(tuple->track_name ? tuple->track_name : ( audcfg.notif_skipnf == FALSE ? _("Unknown Track") : "" )));
+			(tuple->track_name ?
+				tuple->track_name :
+				(filename ?
+					(strrchr(filename, '/') ? (strrchr(filename, '/') + 1) : filename) :
+					_("Unknown Track")
+				)
+			)
+		);
 
 		do_notification("Audacious", tmpbuf, DATA_DIR "/pixmaps/audacious.png");
 		g_free(tmpbuf);