1
0
Fork 0
mirror of https://git.suyu.dev/suyu/flatpak.git synced 2025-01-06 14:26:07 +00:00
yuzu-suyu-flatpak/shared-modules/vorbisgain/0004-vorbisgain_mtime.patch
2024-03-07 20:28:57 -03:00

183 lines
6.3 KiB
Diff

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 */