]> git.tue.mpg.de Git - paraslash.git/commitdiff
Change dbinfo1 stat item and use it from afs.
authorAndre Noll <maan@systemlinux.org>
Tue, 23 Oct 2007 15:53:04 +0000 (17:53 +0200)
committerAndre Noll <maan@systemlinux.org>
Tue, 23 Oct 2007 15:53:04 +0000 (17:53 +0200)
afs.c
command.c
gui_theme.c
para.h
sdl_gui.c
server.c
server.h
stat.c
vss.c

diff --git a/afs.c b/afs.c
index 48faeb17fdd153c735105a80a67aa27b1bd216e3..c410854c1129a91a811d21101886276aae731a2e 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -75,6 +75,8 @@ struct command_task {
        struct task task;
 };
 
+extern struct misc_meta_data *mmd;
+
 static int server_socket;
 static struct command_task command_task_struct;
 static struct signal_task signal_task_struct;
@@ -536,10 +538,17 @@ static int activate_mood_or_playlist(char *arg, int *num_admissible)
        current_play_mode = mode;
        if (arg != current_mop) {
                free(current_mop);
-               if (arg)
+               if (arg) {
                        current_mop = para_strdup(arg);
-               else
+                       mmd_lock();
+                       strcpy(mmd->afs_mode_string, arg); /* FIXME: check length */
+                       mmd_unlock();
+               } else {
+                       mmd_lock();
+                       strcpy(mmd->afs_mode_string, "dummy");
+                       mmd_unlock();
                        current_mop = NULL;
+               }
        }
        return 1;
 }
index 8940a0d1b8faf931d8a2e8cea77c0593746d517b..441f4d7ea667d4fed60c0f7ecb4a87b5a18ae1c5 100644 (file)
--- a/command.c
+++ b/command.c
@@ -148,7 +148,7 @@ static char *get_status(struct misc_meta_data *nmmd)
        ret = make_message(
                "%s:%zu\n"      "%s:%s\n"               "%s:%lu\n"      "%s:%u\n"
                "%s:%s\n"       "%s:%s\n"       "%s:%s\n"       "%s:%s\n"
-               "%s:%li\n"      "%s:%s\n"       "%s"
+               "%s:%li\n"      "%s:%s\n"       "%s:%s\n" "%s"
                "%s:%s\n"       "%s:%lu.%lu\n"  "%s:%lu.%lu\n",
                status_item_list[SI_FILE_SIZE], nmmd->size / 1024,
                status_item_list[SI_MTIME], mtime,
@@ -162,6 +162,7 @@ static char *get_status(struct misc_meta_data *nmmd)
 
                status_item_list[SI_OFFSET], offset,
                status_item_list[SI_FORMAT], audio_format_name(nmmd->audio_format),
+               status_item_list[SI_AFS_MODE], mmd->afs_mode_string,
                nmmd->afi.info_string,
 
                status_item_list[SI_UPTIME], ut,
index 7844e605df8b942e26fd666503d939f2c024ef03..98830c22a667f3fa0075a4e8cc3fc5de6a1c6150 100644 (file)
@@ -247,14 +247,14 @@ static void init_theme_colorful_blackness(struct gui_theme *t)
        d[SI_AUDIO_INFO3].y = 63;
        d[SI_AUDIO_INFO3].len = 100;
 
-       d[SI_DBINFO1].prefix = "";
-       d[SI_DBINFO1].postfix = "";
-       d[SI_DBINFO1].fg = COLOR_YELLOW;
-       d[SI_DBINFO1].bg = COLOR_BLACK;
-       d[SI_DBINFO1].align = CENTER;
-       d[SI_DBINFO1].x = 0;
-       d[SI_DBINFO1].y = 77;
-       d[SI_DBINFO1].len = 100;
+       d[SI_AFS_MODE].prefix = "";
+       d[SI_AFS_MODE].postfix = "";
+       d[SI_AFS_MODE].fg = COLOR_YELLOW;
+       d[SI_AFS_MODE].bg = COLOR_BLACK;
+       d[SI_AFS_MODE].align = CENTER;
+       d[SI_AFS_MODE].x = 0;
+       d[SI_AFS_MODE].y = 77;
+       d[SI_AFS_MODE].len = 100;
 
        d[SI_DBINFO2].prefix = "";
        d[SI_DBINFO2].postfix = "";
diff --git a/para.h b/para.h
index dea92910b02250efb4e6d11c03299bcd5153b5fa..a23c44063b95e3c981a7fa77cbef55b382855eab 100644 (file)
--- a/para.h
+++ b/para.h
@@ -164,7 +164,7 @@ enum {
        SI_MTIME,               SI_LENGTH_MIN,          SI_LENGTH_SEC,
        SI_FILE_SIZE,           SI_STATUS_FLAGS,        SI_FORMAT,
        SI_SCORE,               SI_AUDIO_INFO1,         SI_AUDIO_INFO2,
-       SI_AUDIO_INFO3,         SI_DBINFO1,             SI_DBINFO2,
+       SI_AUDIO_INFO3,         SI_AFS_MODE,            SI_DBINFO2,
        SI_DBINFO3,             SI_DECODER_FLAGS,       SI_AUDIOD_STATUS,
        SI_PLAY_TIME,           SI_UPTIME,              SI_OFFSET,
        SI_LENGTH,              SI_STREAM_START,        SI_CURRENT_TIME,
index c63f9b804b5e994926b5bb8f548747cdb96c95ad..9668fad1c9b58f4b78ae04a4427eb6e43f4fa5bb 100644 (file)
--- a/sdl_gui.c
+++ b/sdl_gui.c
@@ -281,18 +281,18 @@ static void init_stat_items(void)
        s[SI_AUDIO_INFO3].font = N_YELLOW;
        s[SI_AUDIO_INFO3].align = CENTER;
 
-       s[SI_DBINFO1].name = "dbinfo1:";
-       s[SI_DBINFO1].prefix = "";
-       s[SI_DBINFO1].postfix = "";
-       s[SI_DBINFO1].x = 0;
-       s[SI_DBINFO1].y = 83;
-       s[SI_DBINFO1].w = 100;
-       s[SI_DBINFO1].h = FONT_HEIGHT;
-       s[SI_DBINFO1].r = 0;
-       s[SI_DBINFO1].g = 0;
-       s[SI_DBINFO1].b = 0;
-       s[SI_DBINFO1].font = N_YELLOW;
-       s[SI_DBINFO1].align = CENTER;
+       s[SI_AFS_MODE].name = "afs_mode:";
+       s[SI_AFS_MODE].prefix = "";
+       s[SI_AFS_MODE].postfix = "";
+       s[SI_AFS_MODE].x = 0;
+       s[SI_AFS_MODE].y = 83;
+       s[SI_AFS_MODE].w = 100;
+       s[SI_AFS_MODE].h = FONT_HEIGHT;
+       s[SI_AFS_MODE].r = 0;
+       s[SI_AFS_MODE].g = 0;
+       s[SI_AFS_MODE].b = 0;
+       s[SI_AFS_MODE].font = N_YELLOW;
+       s[SI_AFS_MODE].align = CENTER;
 
        s[SI_DBINFO2].prefix = "";
        s[SI_DBINFO2].postfix = "";
index bf4ed37ccd19987cf9e28603972938a568702980..6703fabe256bbab611050e12bdd3927b696d16c6 100644 (file)
--- a/server.c
+++ b/server.c
@@ -147,7 +147,6 @@ static void shm_init(void)
                goto err_out;
        mmd_mutex = ret;
 
-       mmd->selector_num = 0;
        mmd->num_played = 0;
        mmd->num_commands = 0;
        mmd->events = 0;
@@ -344,8 +343,6 @@ static unsigned do_inits(int argc, char **argv)
        /* become daemon */
        if (conf.daemon_given)
                daemon_init();
-//     init_selector();
-//     PARA_ERROR_LOG("num: %d\n", mmd->selector_num);
        PARA_NOTICE_LOG("%s", "initializing virtual streaming system\n");
        afh_init();
        vss_init();
index 86d4f17393adc94cbd524e9d0ac8e74565a9148b..cb7a716a1ef6eb17221bcea561ccdc59fee1cd3a 100644 (file)
--- a/server.h
+++ b/server.h
@@ -101,9 +101,7 @@ struct misc_meta_data {
        /** the process id of para_server */
        pid_t server_pid;
        /** a string that gets filled in by the current audio file selector */
-       char selector_info[MMD_INFO_SIZE];
-       /** The number of the current audio file selector. */
-       int selector_num;
+       char afs_mode_string[MAXLINE];
        /** commands set this to non-zero to change the current selector */
        int selector_change;
        /** used by the sender command */
diff --git a/stat.c b/stat.c
index ce6adeda2019454acfdf4ca5759e4a29cc4c2e64..adff3b706ddbed2d1bf4dac6c46e41df5459e8a0 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -65,7 +65,7 @@ const char *status_item_list[NUM_STAT_ITEMS] = {
        [SI_AUDIO_INFO2] = "audio_file_info2",
 
        [SI_AUDIO_INFO3] = "audio_file_info3",
-       [SI_DBINFO1] = "dbinfo1",
+       [SI_AFS_MODE] = "afs_mode",
        [SI_DBINFO2] = "dbinfo2",
 
        [SI_DBINFO3] = "dbinfo3",
@@ -171,7 +171,6 @@ void stat_client_write(const char *msg, int itemnum)
        PARA_DEBUG_LOG("%d client(s)\n", num_clients);
 }
 
-
 /**
  * check if string is a known status item.
  *
@@ -184,12 +183,13 @@ int stat_item_valid(const char *item)
 {
        int i;
        if (!item || !*item) {
-       PARA_ERROR_LOG("%s\n", "no item");
+               PARA_ERROR_LOG("%s\n", "no item");
                return -E_UNKNOWN_STAT_ITEM;
        }
        FOR_EACH_STAT_ITEM(i)
                if (!strcmp(status_item_list[i], item))
                        return i;
+       PARA_ERROR_LOG("invalid stat item: %s\n", item);
        return -E_UNKNOWN_STAT_ITEM;
 }
 
diff --git a/vss.c b/vss.c
index 3db8bb446f447dbe4e2441af67f6c5944eb15ac8..93ee76d7377e69a4a84223459d301f694e20da48 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -202,10 +202,6 @@ static void vss_eof(void)
                status_item_list[SI_AUDIO_INFO2], status_item_list[SI_AUDIO_INFO3]);
        strcpy(mmd->afi.info_string, tmp);
        free(tmp);
-       tmp  = make_message("%s:\n%s:\n%s:\n", status_item_list[SI_DBINFO1],
-               status_item_list[SI_DBINFO2], status_item_list[SI_DBINFO3]);
-       strcpy(mmd->selector_info, tmp);
-       free(tmp);
        mmd->filename[0] = '\0';
        mmd->size = 0;
        mmd->events++;