SHARE
TWEET

Untitled

a guest Oct 19th, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os, threadpool, strformat, strutils, sequtils
  2.  
  3. const
  4.   mkvmerge = r"d:\installer\mkvtoolnix\mkvmerge.exe"
  5.  
  6. proc remux(idx: int, filename: string) =
  7.   let
  8.     newcount = &"{idx:02}"
  9.     newname = newcount & ".mkv"
  10.     fonts = toseq(walkFiles("./" & newcount & "/*"))
  11.     att = " --attach-file "
  12.     muxing = execShellCmd(fmt"""{mkvmerge} -o {newname} "{filename}" """ &
  13.       fmt"""{fonts.mapIt(att & it.quoteShell).join()}""")
  14.  
  15.   if muxing == 0:
  16.     if tryRemoveFile filename:
  17.       newname.moveFile filename
  18.  
  19. proc main =
  20.   var count = 1
  21.   for file in walkFiles("*.mkv"):
  22.     echo file
  23.     spawn remux(count, file)
  24.     inc count
  25.  
  26.   sync()
  27.  
  28. main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top