Move functions only needed by audiod from stat.c to audiod_command.c.
[paraslash.git] / gui.c
diff --git a/gui.c b/gui.c
index e734b10c8e9e57438075a14a2cc1941f0c28a7b1..394b69fe5466efe19fb532a2cf43e18381409d8e 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -6,14 +6,16 @@
 
 /** \file gui.c Curses-based interface for paraslash. */
 
+#include <regex.h>
 #include <signal.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <curses.h>
+
 #include "gui.cmdline.h"
 #include "para.h"
 #include "gui.h"
 #include "string.h"
-#include <curses.h>
 #include "ringbuffer.h"
 #include "fd.h"
 #include "error.h"
@@ -677,8 +679,31 @@ static void print_stat_item(int i)
 
 static int update_item(int item_num, char *buf)
 {
-       free(stat_content[item_num]);
-       stat_content[item_num] = para_strdup(buf);
+       char **c = stat_content + item_num;
+
+       free(*c);
+       if (buf && buf[0])
+               goto dup;
+       switch (item_num) {
+       case SI_ARTIST:
+               *c = para_strdup("(artist tag not set)");
+               goto print;
+       case SI_TITLE:
+               *c = para_strdup("(title tag not set)");
+               goto print;
+       case SI_YEAR:
+               *c = para_strdup("????");
+               goto print;
+       case SI_ALBUM:
+               *c = para_strdup("(album tag not set)");
+               goto print;
+       case SI_COMMENT:
+               *c = para_strdup("(comment tag not set)");
+               goto print;
+       }
+dup:
+       *c = para_strdup(buf);
+print:
        print_stat_item(item_num);
        return 1;
 }