Comparing FLAC header before syncing
Cenedese at indel.ch
Tue Dec 2 00:37:21 MST 2014
At 02:24 02.12.2014, Mike Garey wrote:
>Hi all, I'd like to modify rsync to add a flag to compare the MD5 signature of the unencoded audio data in the header of a FLAC file to determine whether or not to transfer a file. Â
>The reason being that I've got a large number of FLAC files, many of which are corrupted in the destination volume, but many of which are valid but the tags have been modified.Â The sizes of both the source and destination files are the exact same, regardless of whether they're corrupted or not.Â If I were to rsync all files based on the modification date, it would overwrite these valid FLAC files whose tags have been altered, which I want to prevent.Â I only want to rsync new files and files whose MD5 signatures don't match.
>If anyone could point me in the right direction of where in the source code I should concentrate my efforts to add this modification, it would help greatly.
You'd probably get a result faster with less problems (future updates) if you
separate your logic into a single program instead of incorporating it into rsync.
If you have a way of accessing both the source and dest then you can create
a list of files to sync and feed this to rsync with --files-from. Or you run your
script/program on the destination, check all files and create the list which
you can then transfer to the source and let rsync run. Or you have rsync run
on the destination if you have a server on or direct access to the source.
If you really want to change rsync you can probably look at -c (checksum)
which you may be able to adjust to use the header's checksum instead
of generating a file's checksum. But I don't know the source code.
More information about the rsync