diff options
author | Lars Wirzenius <liw@gytha> | 2009-11-13 19:33:37 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@gytha> | 2009-11-13 19:33:37 +0200 |
commit | e1cd0507964d05a49d81dd4b6f3ffce2fe5383fa (patch) | |
tree | fd96ce62df5181f654d2709c0e37ad3365161834 | |
parent | 71711b8ed729eb38dca8b89ffedcf479316f7c1e (diff) | |
download | extrautils-e1cd0507964d05a49d81dd4b6f3ffce2fe5383fa.tar.gz |
Wrote script to test flac files.
-rwxr-xr-x | test-flacs | 26 | ||||
-rw-r--r-- | test-flacs.1 | 25 |
2 files changed, 51 insertions, 0 deletions
diff --git a/test-flacs b/test-flacs new file mode 100755 index 0000000..e3b9a92 --- /dev/null +++ b/test-flacs @@ -0,0 +1,26 @@ +#!/usr/bin/python + + +import multiprocessing +import os +import subprocess +import sys + + +def test_flac(filename): + p = subprocess.Popen(['flac', '--totally-silent', '--test', filename]) + p.communicate() + return filename, p.returncode == 0 + +def find_files(root): + pathnames = set() + for dirname, subdirs, filenames in os.walk(root): + for pathname in [os.path.join(dirname, x) for x in filenames]: + if pathname.endswith('.flac'): + pathnames.add(pathname) + return pathnames + +pool = multiprocessing.Pool() +for filename, ok in pool.map(test_flac, find_files(sys.argv[1])): + if not ok: + print 'FAIL:', filename diff --git a/test-flacs.1 b/test-flacs.1 new file mode 100644 index 0000000..aabf8ce --- /dev/null +++ b/test-flacs.1 @@ -0,0 +1,25 @@ +.\" Copyright (C) 2009 Lars Wirzenius +.\" +.\" This program is free software: you can redistribute it and/or modify +.\" it under the terms of the GNU General Public License as published by +.\" the Free Software Foundation, either version 3 of the License, or +.\" (at your option) any later version. +.\" +.\" This program is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program. If not, see <http://www.gnu.org/licenses/>. +.\" +.TH TEST-FLACS 1 +.SH NAME +test-flacs \- check FLAC files for correctness +.SH SYNOPSIS +.B test-flacs +.IR dirname ... +.SH DESCRIPTION +.B test-flacs +checks that FLAC files (*.flac) are OK, using "flac --test". +It reports the names of the files that are not OK. |