Commit 1335318e authored by Cédric Marie's avatar Cédric Marie
Browse files

myaudiotags: Avoid rewriting files during 'clean'



In order to avoid rewriting FLAC files when cleaning them, the padding
should be kept for all transitional steps, and removed only at the end.

In case the 'clean' command is run several times, it will result in no
rewrite at all, since the tags will be written over the padding of the
same size (no change).

This will reduce HDD access, and speed up the 'clean' command.
Signed-off-by: default avatarCédric Marie <cedric@hjuvi.lautre.net>
parent 505ca7b6
......@@ -247,9 +247,10 @@ if [ "$command" = "clean" ]; then
printf "LICENSE=$tag_license\n" >> $tags_filename
fi
old_size=`stat -c %s "$file"`
metaflac --dont-use-padding --remove --block-type=SEEKTABLE,PICTURE,CUESHEET,PADDING "$file"
metaflac --remove-all-tags --dont-use-padding "$file"
metaflac --remove --block-type=SEEKTABLE,PICTURE,CUESHEET "$file"
metaflac --remove-all-tags "$file"
metaflac --import-tags-from=$tags_filename "$file"
metaflac --dont-use-padding --remove --block-type=PADDING "$file"
new_size=`stat -c %s "$file"`
printf "(saved %4d bytes) $file\n" $(($old_size - $new_size))
done
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment