1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
Description: When a file's metadata is updated, the mtime is changed
to the current time. Whether this is correct or not is often a
religious issue (metadata-vs-data), but, generally, all other
tag-editing software choose to keep the timestamp.
.
Since the upstream fixed the issue, it is bad to ignore the fix
altogether. At the very least, there should be a command-line
option to follow the upstream and The Only Right(tm) behaviour.
Author: Adam Borowski <kilobyte@angband.pl>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=445958
---
vorbis.c | 18 ++++++++++--------
vorbis.h | 2 +-
vorbisgain.1 | 7 ++++++-
vorbisgain.c | 20 ++++++++++++++------
vorbisgain.h | 1 +
5 files changed, 32 insertions(+), 16 deletions(-)
--- a/vorbis.c
+++ b/vorbis.c
@@ -557,7 +557,8 @@
* message has been printed).
*/
int write_gains(const char *filename, float track_peak, float track_gain,
- float album_peak, float album_gain, int verbose, int remove_tags)
+ float album_peak, float album_gain, int verbose, int remove_tags,
+ SETTINGS* settings)
{
struct stat stat_buf;
struct utimbuf utime_buf;
@@ -778,15 +779,16 @@
file_error(_("Note: Couldn't set mode for file '%s': "), filename);
}
-#if 0 /* Disable for Debian, this surprises people and is not useful --liw */
- utime_buf.actime = stat_buf.st_atime;
- utime_buf.modtime = stat_buf.st_mtime;
-
- if (utime(filename, &utime_buf) != 0)
+ if (!settings->trample_mtime)
{
- file_error(_("Note: Couldn't set time for file '%s': "), filename);
+ utime_buf.actime = stat_buf.st_atime;
+ utime_buf.modtime = stat_buf.st_mtime;
+
+ if (utime(filename, &utime_buf) != 0)
+ {
+ file_error(_("Note: Couldn't set time for file '%s': "), filename);
+ }
}
-#endif
result = 0;
--- a/vorbisgain.1
+++ b/vorbisgain.1
@@ -72,6 +72,10 @@
.IP "-n, --no-progress"
Only display results, but don't show progress in percentages and times. This
can be useful if the output is piped into other programs.
+.IP "-p, --preserve-mtime"
+Do not trample upon the timestamps of any files being worked on. This obeys
+the expected data-vs-metadata behaviour, but can confuse some naive
+archivers.
.IP "-q, --quiet"
Do not display any output while processing. Only error and warning messages will
be printed.
@@ -200,7 +204,8 @@
.SH NOTE
The version of vorbisgain packaged for Debian differs in two ways from
the upstream version. First, it does not retain the modification time
-of the input file: if tags are changed in a file, the mtime will change.
+of the input file by default: if tags are changed in a file, the mtime will
+change; you can specify "-p" to get the normal behaviour.
Second, it does not try to process wildcards in filenames. This makes
it impossible to say "process all foo*.ogg in all subdirectories", but
also avoids problems with filenames that actually contain wildcards.
--- a/vorbisgain.c
+++ b/vorbisgain.c
@@ -235,7 +235,7 @@
{
if (write_gains(file->filename, file->track_peak,
file->track_gain, album_peak, file->album_gain,
- !settings->quiet, 0) < 0)
+ !settings->quiet, 0, settings) < 0)
{
return -1;
}
@@ -288,7 +288,7 @@
else
{
if (write_gains(file->filename, NO_PEAK, NO_GAIN,
- NO_PEAK, NO_GAIN, !settings->quiet, 1) < 0)
+ NO_PEAK, NO_GAIN, !settings->quiet, 1, settings) < 0)
{
return -1;
}
@@ -425,7 +425,8 @@
if (!settings->album)
{
if (!settings->display_only && write_gains(file->filename,
- file->track_peak, file->track_gain, NO_PEAK, NO_GAIN, 0, 0) < 0)
+ file->track_peak, file->track_gain, NO_PEAK, NO_GAIN, 0, 0,
+ settings) < 0)
{
return -1;
}
@@ -466,7 +467,7 @@
if (write_gains(file->filename, file->track_peak,
file->track_gain, album_peak, album_gain,
- !settings->quiet, 0) < 0)
+ !settings->quiet, 0, settings) < 0)
{
return -1;
}
@@ -497,6 +498,7 @@
fprintf(stderr, _(" -h, --help Print this help text\n"));
fprintf(stderr, _(" -n, --no-progress Don't show progress, just print results\n"));
fprintf(stderr, _(" -q, --quiet Don't print any output (except errors)\n"));
+ fprintf(stderr, _(" -p, --preserve-mtime Don't change the timestamps\n"));
#ifdef ENABLE_RECURSIVE
fprintf(stderr, _(" -r, --recursive Search for files recursivly, each folder as an album\n"));
#endif
@@ -522,6 +524,7 @@
{"fast", 0, NULL, 'f'},
{"help", 0, NULL, 'h'},
{"no-progress", 0, NULL, 'n'},
+ {"preserve-mtime",0,NULL, 'p'},
{"quiet", 0, NULL, 'q'},
#ifdef ENABLE_RECURSIVE
{"recursive", 0, NULL, 'r'},
@@ -533,9 +536,9 @@
#ifdef ENABLE_RECURSIVE
-#define ARG_STRING "acCdfg:hnqrst:v"
+#define ARG_STRING "acCdfg:hnpqrst:v"
#else
-#define ARG_STRING "acCdfg:hnqst:v"
+#define ARG_STRING "acCdfg:hnpqst:v"
#endif
@@ -549,6 +552,7 @@
memset(&settings, 0, sizeof(settings));
settings.first_file = 1;
settings.album_gain = NO_GAIN;
+ settings.trample_mtime = 1;
settings.show_progress = 1;
#ifdef WIN32
@@ -623,6 +627,10 @@
settings.show_progress = 0;
break;
+ case 'p':
+ settings.trample_mtime = 0;
+ break;
+
case 'q':
settings.quiet = 1;
break;
--- a/vorbisgain.h
+++ b/vorbisgain.h
@@ -31,6 +31,7 @@
int convert; /**< Convert old format tags to new format */
int display_only;
int fast; /**< Skip files that already have all needed tags */
+ int trample_mtime;
int quiet;
#ifdef ENABLE_RECURSIVE
int recursive;
--- a/vorbis.h
+++ b/vorbis.h
@@ -15,6 +15,6 @@
SETTINGS *settings);
extern int write_gains(const char *filename, float track_peak,
float track_gain, float album_gain, float album_peak, int verbose,
- int remove_tags);
+ int remove_tags, SETTINGS *settings);
#endif /* VG_VORBIS_H */
|