From da2f107789effc568777ba21d37ec90641f68a10 Mon Sep 17 00:00:00 2001 From: germeier Date: Sat, 19 Apr 2003 09:32:47 +0000 Subject: added ID3 rewriting support --- mpiosh/callback.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- mpiosh/callback.h | 4 +++- mpiosh/config.c | 18 +++++++++++++++++- mpiosh/config.h | 5 ++++- mpiosh/global.c | 8 +++++++- mpiosh/mpiosh.c | 5 +++-- 6 files changed, 78 insertions(+), 8 deletions(-) (limited to 'mpiosh') diff --git a/mpiosh/callback.c b/mpiosh/callback.c index b252f24..284b42d 100644 --- a/mpiosh/callback.c +++ b/mpiosh/callback.c @@ -2,7 +2,7 @@ * * Author: Andreas Büsching * - * $Id: callback.c,v 1.38 2003/04/18 13:53:01 germeier Exp $ + * $Id: callback.c,v 1.39 2003/04/19 09:32:48 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -252,7 +252,8 @@ mpiosh_cmd_open(char *args[]) if ((mpiosh.dev) && (mpiosh.config->charset)) mpio_charset_set(mpiosh.dev, mpiosh.config->charset); - + if (mpiosh.dev) + mpio_id3_set(mpiosh.dev, mpiosh.config->id3_rewriting); } void @@ -1037,4 +1038,45 @@ mpiosh_cmd_lmkdir(char *args[]) } } +void +mpiosh_cmd_id3(char *args[]) +{ + BYTE status; + int n; + + MPIOSH_CHECK_CONNECTION_CLOSED; + + if (args[0] == NULL) { + status = mpio_id3_get(mpiosh.dev); + printf("ID3 rewriting is %s\n", (status?"ON":"OFF")); + return; + } else { + if (!strcmp(args[0], "on")) { + status = mpio_id3_set(mpiosh.dev, 1); + } else if (!strcmp(args[0], "off")) { + status = mpio_id3_set(mpiosh.dev, 0); + } else { + fprintf(stderr, "unknown id3 command\n"); + return; + } + printf("ID3 rewriting is now %s\n", (status?"ON":"OFF")); + } +} + +void +mpiosh_cmd_id3_format(char *args[]) +{ + BYTE format[INFO_LINE]; + + MPIOSH_CHECK_CONNECTION_CLOSED; + + if (args[0] == NULL) { + mpio_id3_format_get(mpiosh.dev, format); + printf("current format line: \"%s\"\n", format); + } else { + mpio_id3_format_set(mpiosh.dev, args[0]); + } +} + + /* end of callback.c */ diff --git a/mpiosh/callback.h b/mpiosh/callback.h index b480105..8d6be74 100644 --- a/mpiosh/callback.h +++ b/mpiosh/callback.h @@ -2,7 +2,7 @@ * * Author: Andreas Büsching * - * $Id: callback.h,v 1.9 2003/04/18 13:53:02 germeier Exp $ + * $Id: callback.h,v 1.10 2003/04/19 09:32:48 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -53,6 +53,8 @@ void mpiosh_cmd_dump_mem(char *args[]); void mpiosh_cmd_health(char *args[]); void mpiosh_cmd_config(char *args[]); void mpiosh_cmd_channel(char *args[]); +void mpiosh_cmd_id3(char *args[]); +void mpiosh_cmd_id3_format(char *args[]); /* local command callbacks */ void mpiosh_cmd_ldir(char *args[]); diff --git a/mpiosh/config.c b/mpiosh/config.c index b77c99f..1b1ed1b 100644 --- a/mpiosh/config.c +++ b/mpiosh/config.c @@ -2,7 +2,7 @@ * * Author: Andreas Buesching * - * $Id: config.c,v 1.3 2002/11/13 23:05:28 germeier Exp $ + * $Id: config.c,v 1.4 2003/04/19 09:32:48 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -144,6 +144,22 @@ mpiosh_config_read(struct mpiosh_config_t *config) } else { config->charset = NULL; } + + value = mpiosh_config_read_key(config, "mpiosh", "id3_rewriting"); + if (value) { + if (!strcmp("on", value)) { + config->id3_rewriting = 1; + } else { + config->id3_rewriting = 0; + } + } + + value = mpiosh_config_read_key(config, "mpiosh", "id3_format"); + if (value) { + config->id3_format = strdup(value); + } else { + config->id3_format = strdup(MPIO_ID3_FORMAT); + } } diff --git a/mpiosh/config.h b/mpiosh/config.h index 6c37752..c7924d4 100644 --- a/mpiosh/config.h +++ b/mpiosh/config.h @@ -2,7 +2,7 @@ * * Author: Andreas Buesching * - * $Id: config.h,v 1.2 2002/11/13 23:05:28 germeier Exp $ + * $Id: config.h,v 1.3 2003/04/19 09:32:48 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -34,6 +34,9 @@ struct mpiosh_config_t { char *prompt_ext; char *charset; unsigned default_mem; + + unsigned id3_rewriting; + char *id3_format; }; struct mpiosh_config_t *mpiosh_config_new(void); diff --git a/mpiosh/global.c b/mpiosh/global.c index 7910eff..2f10870 100644 --- a/mpiosh/global.c +++ b/mpiosh/global.c @@ -2,7 +2,7 @@ * * Author: Andreas Buesching * - * $Id: global.c,v 1.9 2003/04/18 13:53:02 germeier Exp $ + * $Id: global.c,v 1.10 2003/04/19 09:32:48 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -120,6 +120,12 @@ struct mpiosh_cmd_t commands[] = { { "health", NULL, NULL, " show the health status from the selected memory", mpiosh_cmd_health, NULL }, + { "id3", NULL, "[]", + " enable/disable ID3 rewriting support", + mpiosh_cmd_id3, NULL }, + { "id3_format", NULL, "[]", + " define/show the format line for ID3 rewriting", + mpiosh_cmd_id3_format, NULL }, { "dump_memory", NULL, NULL, " dump FAT, directory, spare area and the first 0x100 of the\n" " selected memory card", diff --git a/mpiosh/mpiosh.c b/mpiosh/mpiosh.c index 5ddf5c6..56764af 100644 --- a/mpiosh/mpiosh.c +++ b/mpiosh/mpiosh.c @@ -2,7 +2,7 @@ /* * - * $Id: mpiosh.c,v 1.24 2003/04/11 22:53:10 germeier Exp $ + * $Id: mpiosh.c,v 1.25 2003/04/19 09:32:48 germeier Exp $ * * Author: Andreas Büsching * @@ -66,7 +66,8 @@ mpiosh_init(void) if ((mpiosh.dev) && (mpiosh.config->charset)) mpio_charset_set(mpiosh.dev, mpiosh.config->charset); - + if (mpiosh.dev) + mpio_id3_set(mpiosh.dev, mpiosh.config->id3_rewriting); } void -- cgit v1.2.3