Oh well... and here's the patch...
diff -Nurd vorbisgain-0.36/vorbis.c vorbisgain-0.36mtime/vorbis.c
--- vorbisgain-0.36/vorbis.c	2007-10-09 12:04:52.000000000 +0200
+++ vorbisgain-0.36mtime/vorbis.c	2007-10-09 12:04:22.003508825 +0200
@@ -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;
@@ -767,15 +768,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;
 
diff -Nurd vorbisgain-0.36/vorbisgain.1 vorbisgain-0.36mtime/vorbisgain.1
--- vorbisgain-0.36/vorbisgain.1	2007-10-09 12:04:52.000000000 +0200
+++ vorbisgain-0.36mtime/vorbisgain.1	2007-10-09 11:53:43.500068589 +0200
@@ -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.
diff -Nurd vorbisgain-0.36/vorbisgain.c vorbisgain-0.36mtime/vorbisgain.c
--- vorbisgain-0.36/vorbisgain.c	2005-02-06 18:41:19.000000000 +0100
+++ vorbisgain-0.36mtime/vorbisgain.c	2007-10-09 12:02:59.067786384 +0200
@@ -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
@@ -622,6 +626,10 @@
 	case 'n':
 	  settings.show_progress = 0;
 	  break;
+        
+        case 'p':
+            settings.trample_mtime = 0;
+            break;
 
         case 'q':
             settings.quiet = 1;
diff -Nurd vorbisgain-0.36/vorbisgain.h vorbisgain-0.36mtime/vorbisgain.h
--- vorbisgain-0.36/vorbisgain.h	2005-02-06 18:40:19.000000000 +0100
+++ vorbisgain-0.36mtime/vorbisgain.h	2007-10-09 11:57:21.088321064 +0200
@@ -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;
diff -Nurd vorbisgain-0.36/vorbis.h vorbisgain-0.36mtime/vorbis.h
--- vorbisgain-0.36/vorbis.h	2002-07-03 12:15:28.000000000 +0200
+++ vorbisgain-0.36mtime/vorbis.h	2007-10-09 12:02:08.195049683 +0200
@@ -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 */

Reply via email to