diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-07 16:12:03 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-07 16:12:03 +0200 |
commit | 0efd765588da43ec8cc08c5eabde49254eeb44b8 (patch) | |
tree | ae43654b9e17c2e4008af9a3520de0bc6afe1c48 /src/cmdline.opt | |
parent | 9b5fb2470499d0d054e6dfab55611057d669ad76 (diff) | |
download | idest-0efd765588da43ec8cc08c5eabde49254eeb44b8.tar.gz idest-0efd765588da43ec8cc08c5eabde49254eeb44b8.tar.bz2 |
Implement ID3v2 read-only access.
* .gitignore: Add core.
* gnulib.modules: Add argmatch and linked-list.
* src/.gitignore: Add .gdbinit
* src/slist.c: New file
* src/Makefile.am (id3ed_SOURCES): Add new files.
* src/cmdline.opt: Remove all options, except -q and --latin1.
Add new options: --all and --set.
* src/getopt.m4 (BEGIN): Fix handling of optional arguments.
* src/id3ed.h: Include xalloc.h, gl_linked_list.h and argmatch.h
(v1_block,title,artist,album,year,comment,track,genre): Remove.
(DEFAULT_ED_LIST): New define.
(set_id3v1): Takes 2 arguments.
(string_list_action_fn): new data type.
(new_string_list,do_string_list,concat_string_list)
(print_string_list): New prototypes.
(ed_list_add_item,ed_list_print,ed_list_add_assignment): New prototypes.
* src/id3v1.c (id3v1_read,id3v1_write): Bugfixes.
(set_id3v1): Take a pointer to id3v1_block as 2nd argument.
* src/id3v2.c: Implement show_tags.
* src/main.c: Rewrite.
Diffstat (limited to 'src/cmdline.opt')
-rw-r--r-- | src/cmdline.opt | 79 |
1 files changed, 33 insertions, 46 deletions
diff --git a/src/cmdline.opt b/src/cmdline.opt index 27a8298..bc2ef91 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt @@ -1,61 +1,42 @@ +static int mode_set = 0; +#define SET_MODE(m) do { \ + if (mode_set++ && mode != m) \ + error(1, 0, "only one of -q, -s, -d may be used"); \ + mode = m; \ + } while(0) + OPTIONS_BEGIN(gnu, "id3ed", [<id3ed - ID3 tag editor>], [<FILE [FILE...]>]) -OPTION(title,t,NUMBER, - [<set song title>]) -BEGIN - title = optarg; - mode = MODE_MOD; -END - -OPTION(artist,a,NAME, - [<set artist name>]) -BEGIN - artist = optarg; - mode = MODE_MOD; -END - -OPTION(album,A,NAME, - [<set album name>]) -BEGIN - album = optarg; - mode = MODE_MOD; -END - -OPTION(year,y,YEAR, - [<set year>]) -BEGIN - year = optarg; - mode = MODE_MOD; -END - -OPTION(comment,c,TEXT, - [<set comment>]) -BEGIN - comment = optarg; - mode = MODE_MOD; -END - -OPTION(track,T,NUMBER, - [<set track number>]) +OPTION(query,q,[FLIST], + [<query mode>]) BEGIN - track = atoi(optarg); - mode = MODE_MOD; + SET_MODE(MODE_QUERY); + if (optarg) + parse_ed_items(optarg); END -OPTION(genre,g,NAME, - [<set genre>]) +OPTION(all,a,, + [<query all frames>]) BEGIN - genre = optarg; - mode = MODE_MOD; + SET_MODE(MODE_QUERY); + all_frames = 1; END -OPTION(query,q,, - [<query mode>]) +OPTION(set,s,FIELD=VALUE, + [<set FIELD to VALUE>]) BEGIN - mode = MODE_QUERY; + char *p; + + SET_MODE(MODE_MOD); + p = strchr(optarg, '='); + if (!p) + error(1, 0, "missing `=' sign in assignment"); + *p++ = 0; + ed_list_add_assignment(optarg, p); END + OPTION(id-version,V,VERSION, [<set ID3 version>]) @@ -65,6 +46,12 @@ BEGIN error(1, 0, "unsupported version"); END +OPTION(latin1,,, + [<force latin1 output>]) +BEGIN + latin1_output = 1; +END + OPTIONS_END void |