aboutsummaryrefslogtreecommitdiffstats
path: root/lvc/ui/console.py
diff options
context:
space:
mode:
Diffstat (limited to 'lvc/ui/console.py')
-rw-r--r--lvc/ui/console.py36
1 files changed, 21 insertions, 15 deletions
diff --git a/lvc/ui/console.py b/lvc/ui/console.py
index a0c373b..871bfd6 100644
--- a/lvc/ui/console.py
+++ b/lvc/ui/console.py
@@ -5,12 +5,17 @@ import time
import sys
import lvc
+
+from lvc.variables import (
+ __version__
+)
+
from lvc.widgets import app
from lvc.widgets import initialize
parser = optparse.OptionParser(
usage='%prog [-l] [--list-converters] [-c <converter> <filenames..>]',
- version='%prog ' + lvc.VERSION,
+ version='%prog ' + __version__,
prog='python -m lvc.ui.console')
parser.add_option('-j', '--json', action='store_true',
dest='json',
@@ -31,12 +36,12 @@ class Application(lvc.Application):
for c in sorted(self.converter_manager.list_converters(),
key=operator.attrgetter('name')):
if options.json:
- print json.dumps({'name': c.name,
- 'identifier': c.identifier})
+ print(json.dumps({'name': c.name,
+ 'identifier': c.identifier}))
else:
- print '%s (-c %s)' % (
+ print('%s (-c %s)' % (
c.name,
- c.identifier)
+ c.identifier))
return
try:
@@ -45,12 +50,12 @@ class Application(lvc.Application):
message = '%r is not a valid converter type.' % (
options.converter,)
if options.json:
- print json.dumps({'error': message})
+ print(json.dumps({'error': message}))
else:
- print 'ERROR:', message
- print 'Use "%s -l" to get a list of valid converters.' % (
- parser.prog,)
- print
+ print('ERROR:', message)
+ print('Use "%s -l" to get a list of valid converters.' % (
+ parser.prog,))
+ print('')
parser.print_help()
sys.exit(1)
@@ -71,7 +76,7 @@ class Application(lvc.Application):
}
if c.error is not None:
output['error'] = c.error
- print json.dumps(output)
+ print(json.dumps(output))
else:
if c.status == 'initialized':
line = 'starting (output: %s)' % (c.output,)
@@ -89,7 +94,7 @@ class Application(lvc.Application):
line = 'finished (output: %s)' % (c.output,)
else:
line = c.status
- print '%s: %s' % (c.video.filename, line)
+ print('%s: %s' % (c.video.filename, line))
for filename in args:
try:
@@ -98,10 +103,10 @@ class Application(lvc.Application):
message = 'could not parse %r' % filename
if options.json:
any_failed = True
- print json.dumps({'status': 'failed', 'error': message,
- 'filename': filename})
+ print(json.dumps({'status': 'failed', 'error': message,
+ 'filename': filename}))
else:
- print 'ERROR:', message
+ print('ERROR:', message)
continue
changed(c)
c.listen(changed)
@@ -114,6 +119,7 @@ class Application(lvc.Application):
sys.exit(0 if not any_failed else 1)
+
if __name__ == "__main__":
initialize(None)
app.widgetapp = Application()