blob: e3b9a925ced8a61aecb3cc1bd18700eb1cf41cd4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
|