aboutsummaryrefslogtreecommitdiff
path: root/mpiosh
diff options
context:
space:
mode:
authorgermeier <germeier>2003-04-19 09:32:47 +0000
committergermeier <germeier>2003-04-19 09:32:47 +0000
commitda2f107789effc568777ba21d37ec90641f68a10 (patch)
treeadf42bd3a1e17e39a3ce5c5ae543101c84e76cf2 /mpiosh
parent25f641bc5213de63f6f72142880f1a66b215f9cf (diff)
downloadmpiosh-da2f107789effc568777ba21d37ec90641f68a10.tar.gz
mpiosh-da2f107789effc568777ba21d37ec90641f68a10.tar.bz2
mpiosh-da2f107789effc568777ba21d37ec90641f68a10.zip
added ID3 rewriting support
Diffstat (limited to 'mpiosh')
-rw-r--r--mpiosh/callback.c46
-rw-r--r--mpiosh/callback.h4
-rw-r--r--mpiosh/config.c18
-rw-r--r--mpiosh/config.h5
-rw-r--r--mpiosh/global.c8
-rw-r--r--mpiosh/mpiosh.c5
6 files changed, 78 insertions, 8 deletions
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 <crunchy@tzi.de>
*
- * $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 <crunchy@tzi.de>
*
@@ -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 <crunchy@tzi.de>
*
- * $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 <crunchy@tzi.de>
*
@@ -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 <crunchy@tzi.de>
*
- * $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 <crunchy@tzi.de>
*
@@ -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 <crunchy@tzi.de>
*
- * $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 <crunchy@tzi.de>
*
@@ -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 <crunchy@tzi.de>
*
- * $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 <crunchy@tzi.de>
*
@@ -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, "[<on|off>]",
+ " enable/disable ID3 rewriting support",
+ mpiosh_cmd_id3, NULL },
+ { "id3_format", NULL, "[<format>]",
+ " 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 <crunchy@tzi.de>
*
@@ -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