Print worker results
This commit is contained in:
parent
a65b6dd6e3
commit
6f5bfef1ed
14
src/main.py
14
src/main.py
|
@ -34,9 +34,11 @@ def skip_album(path: Path):
|
||||||
def transcode(transcode_list: list, encoder: Path, workers=8):
|
def transcode(transcode_list: list, encoder: Path, workers=8):
|
||||||
worker_args = [(row[0], row[1], encoder) for row in transcode_list]
|
worker_args = [(row[0], row[1], encoder) for row in transcode_list]
|
||||||
with Pool(workers) as p:
|
with Pool(workers) as p:
|
||||||
print(p.starmap_async(transcode_worker, worker_args))
|
results = p.starmap_async(transcode_worker, worker_args)
|
||||||
p.close()
|
p.close()
|
||||||
p.join()
|
p.join()
|
||||||
|
for result in results.get():
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
|
||||||
def transcode_worker(in_track, out_track, encoder):
|
def transcode_worker(in_track, out_track, encoder):
|
||||||
|
@ -69,11 +71,11 @@ def main(input_dir: Path, output_dir: Path, encoder: Path):
|
||||||
album_out.mkdir()
|
album_out.mkdir()
|
||||||
done_file = album / 'DONE'
|
done_file = album / 'DONE'
|
||||||
open(done_file, 'a').close()
|
open(done_file, 'a').close()
|
||||||
for track in album.iterdir():
|
for file in album.iterdir():
|
||||||
if track.is_file() and track.suffix.lower() == '.flac':
|
if file.is_file() and file.suffix.lower() == '.flac':
|
||||||
transcode_list.append((str(track), str(album_out / f"{track.stem}.opus")))
|
transcode_list.append((str(file), str(album_out / f"{file.stem}.opus")))
|
||||||
elif track.is_file() and track.suffix.lower() in file_whitelist:
|
elif file.is_file() and file.suffix.lower() in file_whitelist:
|
||||||
shutil.copy(track, album_out / track.name)
|
shutil.copy(file, album_out / file.name)
|
||||||
else:
|
else:
|
||||||
print(f"Warning, skipping non-dir '{album}' found in artist '{artist.parts[-1]}'")
|
print(f"Warning, skipping non-dir '{album}' found in artist '{artist.parts[-1]}'")
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue
Block a user