Hi everyone,
I just picked up IronPython and I've been trying to get this IronPython script going but I'm stuck at trying to get a Path input from raw_input to be a directory path. The first block of code is the broken one that I'm working on.
import System
from System import *
from System.IO import *
from System.Diagnostics import *
inputDirectory = raw_input("Enter Input Directory's full path [eg. c:\\vid\\]: ")
print ("In: "+inputDirectory)
outputDirectory = inputDirectory +"ipod\\"
print ("Out: "+outputDirectory)
#create the default output directory
for s in DirectoryInfo(inputDirectory).GetFiles("*.avi"):
print s.FullName
arg = String.Format('-i "{0}" -t 1 -c 1 -o "{1}" --preset="iPod"' , s.FullName, outputDirectory + s.Name.Replace(".avi", ".mp4"))
print arg
proc = Process.Start("C:\\Program Files\\Handbrake\\HandBrakeCLI.exe", arg) #path to handbrake goes here
proc.WaitForExit()
The following code block is what I have working at the moment.
import System
from System import *
from System.IO import *
from System.Diagnostics import *
for s in DirectoryInfo("F:\\Tomorrow\\").GetFiles("*.avi"):
arg = String.Format('-i "{0}" -t 1 -c 1 -o "{1}" --preset="iPod"' , s.FullName, "F:\\Tomorrow\\ipod\\" + s.Name.Replace(".avi", ".mp4"))
print arg
proc = Process.Start("C:\\Program Files\\Handbrake\\HandBrakeCLI.exe", arg) #path to handbrake goes here
proc.WaitForExit()
PS: Credit for the above working code goes to Joseph at jcooney.net