diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | src/cmdline.opt | 6 | ||||
-rw-r--r-- | src/idop.c | 24 | ||||
-rw-r--r-- | src/main.c | 9 |
4 files changed, 37 insertions, 7 deletions
@@ -1,4 +1,4 @@ -IdEst -- history of user-visible changes. 2010-04-13 +IdEst -- history of user-visible changes. 2011-03-20 Copyright (C) 2009-2011 Sergey Poznyakoff See the end of file for copying conditions. @@ -7,6 +7,9 @@ Please send bug reports to <gray@gnu.org.ua> Version 1.1.90 (Git) +* New option --verbose +* Improve signal handling + Version 1.1, 2009-03-29 diff --git a/src/cmdline.opt b/src/cmdline.opt index df8e26c..686ca0a 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt @@ -81,6 +81,12 @@ BEGIN latin1_option = 1; END +OPTION(verbose,v,, + [<verbosely list files processed>]) +BEGIN + verbose_option = 1; +END + GROUP([<Backup options>]) OPTION(backup,,[CONTROL], @@ -15,6 +15,7 @@ along with Idest. If not, see <http://www.gnu.org/licenses/>. */ #include "idest.h" +#include <signal.h> void set_frame_value(struct id3_frame *frame, const char *value) @@ -71,6 +72,21 @@ set_frame_value(struct id3_frame *frame, const char *value) } void +safe_id3_file_update_and_close(struct id3_file *file) +{ + sigset_t set, oldset; + + sigemptyset(&set); + sigaddset(&set, SIGINT); + sigaddset(&set, SIGTERM); + + sigprocmask(SIG_BLOCK, &set, &oldset); + id3_file_update(file); + id3_file_close(file); + sigprocmask(SIG_SETMASK, &oldset, NULL); +} + +void set_tags(const char *name) { struct id3_file *file; @@ -129,8 +145,9 @@ set_tags(const char *name) modified |= 1; } if (modified) - id3_file_update(file); - id3_file_close(file); + safe_id3_file_update_and_close(file); + else + id3_file_close(file); } void @@ -148,8 +165,7 @@ del_tags(const char *name) id3_tag_options(tag, ID3_TAG_OPTION_ID3V1|ID3_TAG_OPTION_NO_ID3V2, ID3_TAG_OPTION_NO_ID3V2); - id3_file_update(file); - id3_file_close(file); + safe_id3_file_update_and_close(file); } @@ -21,6 +21,7 @@ unsigned convert_version; int latin1_option = 0; enum backup_type backup_type = no_backups; char *backup_dir; +int verbose_option = 0; int all_frames = 0; gl_list_t ed_list; @@ -339,8 +340,12 @@ main(int argc, char **argv) if (convert_version) mode = MODE_MOD; - while (argc--) - id3_mode[mode](*argv++); + while (argc--) { + char *name = *argv++; + if (verbose_option) + printf("%s:\n", name); + id3_mode[mode](name); + } exit(0); } |