From: Andre Noll Date: Tue, 23 Oct 2007 17:38:47 +0000 (+0200) Subject: Remove com_sb and com_sc. X-Git-Tag: v0.3.0~237 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=17d2533cafc67dd0509860fa2b59ec98b23d7be7;p=paraslash.git Remove com_sb and com_sc. Nobody used com_sb and com_sc was only used by para_krell. --- diff --git a/command.c b/command.c index 441f4d7e..92fe18f0 100644 --- a/command.c +++ b/command.c @@ -95,38 +95,6 @@ static char *vss_get_status_flags(unsigned int flags) return msg; } -/* - * compute status bar string. Never returns NULL - */ -static char *get_sb_string(struct misc_meta_data *nmmd) -{ - char *base, *ret; - long long unsigned secs = 0, rsecs = 0, percent = 0; - - base = para_basename(nmmd->filename); - if (!base) - return para_strdup(""); - if (!base[0]) - return base; - if (nmmd->afi.chunks_total) { - secs = (long long) nmmd->afi.seconds_total * nmmd->chunks_sent - / nmmd->afi.chunks_total; - rsecs = (long long) nmmd->afi.seconds_total * - (nmmd->afi.chunks_total - nmmd->chunks_sent) - / nmmd->afi.chunks_total; - percent = 100 * ((nmmd->chunks_sent + 5) / 10) - / ((nmmd->afi.chunks_total + 5) / 10); - } - ret = make_message("%llu:%02llu [%llu:%02llu] (%llu%%) %s", - secs / 60, secs % 60, - rsecs / 60, rsecs % 60, - percent, - base - ); - free(base); - return ret; -} - static char *get_status(struct misc_meta_data *nmmd) { char *bar, *ret, mtime[30] = ""; @@ -341,61 +309,6 @@ int com_version(int fd, int argc, __a_unused char * const * argv) ); } -/* sc */ -int com_sc(int fd, int argc, char * const * argv) -{ - char *name = NULL; - int ret, old = 0, count = -1; /* print af change forever */ - - if (argc > 1) - count = atoi(argv[1]); -repeat: - mmd_lock(); - if (old != mmd->num_played) { - old = mmd->num_played; - name = para_strdup(mmd->filename); - } - mmd_unlock(); - if (name) { - ret = send_va_buffer(fd, "%s\n", name); - free(name); - name = NULL; - if (ret < 0) - return ret; - if (argc > 1 && !--count) - return 1; - } - usleep(500000); - goto repeat; -} - -/* sb */ -int com_sb(int fd, int argc, char * const * argv) -{ - char *sb; - int ret, nr = -1; /* status bar will be printed that many - * times. Negative value means: print - * forever - */ - if (argc > 1) - nr = atoi(argv[1]); - while (nr) { - mmd_lock(); - sb = get_sb_string(mmd); - mmd_unlock(); - ret = send_va_buffer(fd, "%s\n", sb); - free(sb); - if (ret < 0) - return ret; - if (nr == 1) - return 1; - usleep(500000); - if (nr > 0) - nr--; - } - return 1; -} - /* stat */ int com_stat(int fd, int argc, char * const * argv) { diff --git a/server.cmd b/server.cmd index 41dc2805..18e1ab6c 100644 --- a/server.cmd +++ b/server.cmd @@ -74,27 +74,6 @@ U: play H: Set the 'P' (playing) bit of the vss status flags. This H: results in starting/continuing to stream. --- -N: sb -P: VSS_READ -D: print status bar for current audio file -U: sb [n] -H: Without any arguments, sb continuously prints a status bar of the -H: form -H: -H: 12:34 [56:12] (56%) filename -H: -H: indicating playing time, remaining time, percentage and the name of -H: the file being streamed. Use the optional number n to let stat exit -H: after having displayed the status bar n times. ---- -N: sc -P: VSS_READ -D: print name of audio file whenever it changes -U: sc [n] -H: sc prints exactly one line (the filename of the audio file -H: being played) whenever the audio file changes. Stops after -H: n iterations, or never if n is not specified. ---- N: sender P: VSS_READ | VSS_WRITE D: control paraslash internal senders