diff --git a/animetosho2mks.py b/animetosho2mks.py index f4aa51e..9249b65 100755 --- a/animetosho2mks.py +++ b/animetosho2mks.py @@ -1,9 +1,11 @@ #!/usr/bin/env cached-nix-shell #!nix-shell -i python3 -p "python3.withPackages(ps: [ ps.tqdm ])" mkvtoolnix-cli -from subprocess import run -from tqdm import tqdm import glob +import multiprocessing import os.path +from subprocess import run + +from tqdm import tqdm class SubtitleTrack: @@ -69,5 +71,8 @@ class AnimeToshoFile: run(command, check=True) -for file in tqdm(list(map(AnimeToshoFile, glob.glob("*.mkv")))): - file.merge() +files = list(map(AnimeToshoFile, glob.glob("*.mkv"))) + + +with multiprocessing.Pool() as pool: + list(tqdm(pool.imap_unordered(AnimeToshoFile.merge, files), total=len(files)))