PDA

View Full Version : Easiest way to check flac files for corruption (linux)?



rkrug
2016-03-31, 06:23
Hi

I would like to check my flac files for corruption.

I know that they have a checksum included and that I can use

,----
| flac -t file.flac
`----

to check the file. I also know that I could iterate over all flacs and
check each and put it together to a script.

But I hate re-inventing the wheel - did somebody write a script for this
already?
Is there a plugin which I can use for this (would be quite nice to
have...)?

Ideally, I would like to run this script once a week to detect data rot
on the hdd and to be able to restore the rotten flac from a backup.

Any suggestions for this?

Rainer

--
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

Julf
2016-03-31, 09:23
But I hate re-inventing the wheel - did somebody write a script for this
already?


#!/bin/sh

if [ $# -ne 1 ]
then
echo usage: $0 music_dir
exit 1
fi

find $1 -type f -name '*.flac' | (
while read file
do
if ! flac -stw "$file"
then
echo $file
fi
done
)

rkrug
2016-04-01, 00:40
Julf <Julf.7dgelz (AT) no-mx (DOT) forums.slimdevices.com> writes:

> rkrug wrote:
>> But I hate re-inventing the wheel - did somebody write a script for
>> this
>> already?
>
>
> Code:
> --------------------
> #!/bin/sh
>
> if [ $# -ne 1 ]
> then
> echo usage: $0 music_dir
> exit 1
> fi
>
> find $1 -type f -name '*.flac' | (
> while read file
> do
> if ! flac -stw "$file"
> then
> echo $file
> fi
> done
> )
>
> --------------------

Thanks - this looks nice. I'll probably add some more logging and info,
but thanks a lot,

Rainer


>
>
>
> "To try to judge the real from the false will always be hard. In this
> fast-growing art of 'high fidelity' the quackery will bear a solid gilt
> edge that will fool many people" - Paul W Klipsch, 1953
> ------------------------------------------------------------------------
> Julf's Profile: http://forums.slimdevices.com/member.php?userid=42050
> View this thread: http://forums.slimdevices.com/showthread.php?t=105412
>
>

Julf
2016-04-01, 06:26
I'll probably add some more logging and info

Logging? Info? Next you will be suggesting comments and documentation! :)

Julf

rkrug
2016-04-01, 06:48
Julf <Julf.7di11c (AT) no-mx (DOT) forums.slimdevices.com> writes:

> rkrug wrote:
>> I'll probably add some more logging and info
>
> Logging? Info? Next you will be suggesting comments and documentation!
> :)

Sure - I'll do my best.

Cheers,

Rainer

>
> Julf
>
>
>
> "To try to judge the real from the false will always be hard. In this
> fast-growing art of 'high fidelity' the quackery will bear a solid gilt
> edge that will fool many people" - Paul W Klipsch, 1953
> ------------------------------------------------------------------------
> Julf's Profile: http://forums.slimdevices.com/member.php?userid=42050
> View this thread: http://forums.slimdevices.com/showthread.php?t=105412
>
>