#!/usr/bin/env python
-import commands, optparse, subprocess, sys, os
+import commands, optparse, subprocess, sys, os, tempfile, shutil
class MencoderCommand(object):
codec2opts = {
parser.print_usage()
sys.exit(1)
- opts.input = input
- opts.output = output
+ if '://' not in input:
+ opts.input = os.path.join(os.getcwd(), input)
+ else:
+ if opts.dvd:
+ opts.dvd = os.path.join(os.getcwd(), opts.dvd)
+ opts.input = input
+
+ opts.output = os.path.join(os.getcwd(), output)
return opts
def run(args, dump):
print >>sys.stderr, "Profile '%s' not found!" % profile_name
sys.exit(1)
- cmd = profile.CommandClass(profile, opts)
- if run(cmd.pass1(), opts.dump) == 0 or opts.dump:
- run(cmd.pass2(), opts.dump)
+ tempdir = tempfile.mkdtemp()
+ try:
+ os.chdir(tempdir)
+ cmd = profile.CommandClass(profile, opts)
+ if run(cmd.pass1(), opts.dump) == 0 or opts.dump:
+ run(cmd.pass2(), opts.dump)
+ finally:
+ os.chdir('/')
+ shutil.rmtree(tempdir)
if __name__ == "__main__":
main()