From: Andre Noll Date: Tue, 23 Oct 2007 15:53:04 +0000 (+0200) Subject: Change dbinfo1 stat item and use it from afs. X-Git-Tag: v0.3.0~247 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=a551870e3ac31ff77e1757f226d3e307e4ef83fc;hp=54a480aef5bd11e922c3c2339bb207334c170df8;ds=sidebyside Change dbinfo1 stat item and use it from afs. --- diff --git a/afs.c b/afs.c index 48faeb17..c410854c 100644 --- 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; } diff --git a/command.c b/command.c index 8940a0d1..441f4d7e 100644 --- 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, diff --git a/gui_theme.c b/gui_theme.c index 7844e605..98830c22 100644 --- a/gui_theme.c +++ b/gui_theme.c @@ -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 dea92910..a23c4406 100644 --- 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, diff --git a/sdl_gui.c b/sdl_gui.c index c63f9b80..9668fad1 100644 --- 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 = ""; diff --git a/server.c b/server.c index bf4ed37c..6703fabe 100644 --- 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(); diff --git a/server.h b/server.h index 86d4f173..cb7a716a 100644 --- 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 ce6adeda..adff3b70 100644 --- 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 3db8bb44..93ee76d7 100644 --- 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++;