summaryrefslogtreecommitdiff
path: root/test-flacs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@gytha>2009-11-13 19:33:37 +0200
committerLars Wirzenius <liw@gytha>2009-11-13 19:33:37 +0200
commite1cd0507964d05a49d81dd4b6f3ffce2fe5383fa (patch)
treefd96ce62df5181f654d2709c0e37ad3365161834 /test-flacs
parent71711b8ed729eb38dca8b89ffedcf479316f7c1e (diff)
downloadextrautils-e1cd0507964d05a49d81dd4b6f3ffce2fe5383fa.tar.gz
Wrote script to test flac files.
Diffstat (limited to 'test-flacs')
-rwxr-xr-xtest-flacs26
1 files changed, 26 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