changeset 974:fa6a2ad65e71 trunk

[svn] Remove nonexistant tags from TitleInput.
author nenolod
date Wed, 26 Apr 2006 20:12:05 -0700
parents 8279241db8b9
children c9915a0559f7
files Plugins/Input/mpg123/mpg123.c
diffstat 1 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/mpg123/mpg123.c	Wed Apr 26 19:14:25 2006 -0700
+++ b/Plugins/Input/mpg123/mpg123.c	Wed Apr 26 20:12:05 2006 -0700
@@ -459,6 +459,8 @@
         v2->track_number = 0;
 }
 
+#define REMOVE_NONEXISTANT_TAG(x)   if (!*x) { x = NULL; }
+
 /*
  * Function mpg123_format_song_title (tag, filename)
  *
@@ -478,13 +480,22 @@
         input->performer = taglib_tag_artist(taglib_tag);
         input->album_name = taglib_tag_album(taglib_tag);
         input->track_name = taglib_tag_title(taglib_tag);
-		mpg123_strip_spaces(input->performer,strlen(input->performer));
-		mpg123_strip_spaces(input->album_name,strlen(input->album_name));
-		mpg123_strip_spaces(input->track_name,strlen(input->track_name));
+
+        mpg123_strip_spaces(input->performer,strlen(input->performer));
+        mpg123_strip_spaces(input->album_name,strlen(input->album_name));
+        mpg123_strip_spaces(input->track_name,strlen(input->track_name));
+
         input->year = taglib_tag_year(taglib_tag);
         input->track_number = taglib_tag_track(taglib_tag);
         input->genre = taglib_tag_genre(taglib_tag);
         input->comment = taglib_tag_comment(taglib_tag);
+
+        /* remove any blank tags, fucking taglib */
+        REMOVE_NONEXISTANT_TAG(input->performer);
+        REMOVE_NONEXISTANT_TAG(input->album_name);
+        REMOVE_NONEXISTANT_TAG(input->track_name);
+        REMOVE_NONEXISTANT_TAG(input->genre);
+        REMOVE_NONEXISTANT_TAG(input->comment);
     }
 
     input->file_name = g_path_get_basename(filename);
@@ -495,7 +506,7 @@
                                  mpg123_cfg.id3_format :
                                  xmms_get_gentitle_format(), input);
 
-    if (!title || strlen(input->track_name) == 0) {
+    if (!title /* || strlen(input->track_name) == 0 */) {
         /* Format according to filename.  */
         title = g_path_get_basename(filename);
         if (extname(title))