@@ -9,10 +9,11 @@ RECURSIVE=0
99NOACTION=0
1010SYNC=1
1111FLAC_LEVEL=5 # Default FLAC compression level
12+ PRESERVE_MODTIME=" " # for -p|--preserve
1213
1314SELF=" $( readlink -f " $0 " ) "
14- OPTS=$( getopt -o Vvhrns012345678 \
15- -l version,verbose,help,recursive,no-action,no-sync,fast,best \
15+ OPTS=$( getopt -o Vvhrnps012345678 \
16+ -l version,verbose,help,recursive,preserve, no-action,no-sync,fast,best \
1617 -n reflac -- " $@ " )
1718TMPDIR=" $( mktemp --tmpdir -d reflac.XXXXXXXXXX) "
1819
@@ -35,6 +36,7 @@ Usage: reflac [OPTION]... [--] DIRECTORY...
3536 -r --recursive Recurse into directories.
3637 -n --no-action Do not recompress. With --verbose, displays a list of
3738 files that would be processed.
39+ -p --preserve Preserve file modification time.
3840 -s --no-sync Do not synchronize file data. Will return faster, with
3941 the potential danger to lose your files in a system crash.
4042 -0 --fast Use the fastest, but worst, compression possible.
@@ -72,7 +74,7 @@ recompress()
7274 " $TMPDIR /$( basename -s flac -- " $flac " ) rf64"
7375 fi
7476
75- metaflac --no-utf8-convert \
77+ metaflac --no-utf8-convert $PRESERVE_MODTIME \
7678 --import-tags-from=" $TMPDIR /$( basename -s flac -- " $flac " ) tag" \
7779 -- " $TMPDIR /$flac "
7880 mv -f -- " $TMPDIR /$flac " " $flac .new"
@@ -108,6 +110,9 @@ while true ; do
108110 -n|--no-action)
109111 NOACTION=1
110112 shift ;;
113+ -p|--preserve)
114+ PRESERVE_MODTIME=" --preserve-modtime"
115+ shift ;;
111116 -s|--no-sync)
112117 SYNC=0
113118 shift ;;
0 commit comments