Facebook
From Sweet Dove, 7 Years ago, written in Python for S60.
Embed
Download Paste or View Raw
Hits: 281
  1. from os import listdir, system
  2. from subprocess import call
  3. from ntpath import basename
  4.  
  5. input_dir = 'input'
  6. output_dir = 'output'
  7. processing_app = 'texgloc.exe'
  8.  
  9. def processing_args(input_file_path):
  10.     def output_file_path(input_file_path):
  11.         return output_dir + "\\" + input_file_path
  12.     ainput = input_dir + "\\" + input_file_path
  13.     aoutput = output_file_path(input_file_path)
  14.     #aprec = "3" #3/5/7
  15.     #ascale = "2"
  16.     #aalpha = "1" # <= 3.f
  17.     #abeta = "20" # <= 255
  18.     aargs = [ainput, aoutput]#, aprec, ascale, aalpha, abeta]
  19.     result = " ".join(aargs)
  20.     print("args: " + result)
  21.     return result
  22.  
  23. def call_variations(ipath):
  24.     ainput = input_dir + "/" + ipath
  25.     aoutput = output_dir + "/" + ipath
  26.     for prec in [3, 5, 7]:
  27.         for scale in [1, 1.8, 2.6, 3.4]:
  28.             for alpha in [0.2, 1.2, 2.2, 3.0]:
  29.                 for beta in range(20, 255, 80):
  30.                     iterators_str_list = list(map(str, [prec, scale, alpha, beta]))
  31.                     aoutput = output_dir + "/" + "-".join(iterators_str_list) + "-" + ipath
  32.                     process([ainput, aoutput] + iterators_str_list)
  33.  
  34. def process(aargs):
  35.     procedure = processing_app + " " + " ".join(aargs)
  36.     print(procedure)
  37.     system(procedure)
  38.  
  39. input_files = listdir(input_dir)
  40. [call_variations(ipath) for ipath in input_files]
  41.