This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
VT
executable file
·64 lines (58 loc) · 2.27 KB
/
VT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! /usr/bin/env python2
# coding=UTF8
## This file is part of VideoTester
## See https://github.com/Enchufa2/video-tester for more information
## Copyright 2011-2016 Iñaki Úcar <[email protected]>
## This program is published under a GPLv3 license
import sys, os, textwrap, argparse
from VideoTester import VTLOG, __version__, __author__
if __name__ == '__main__':
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter,
description=textwrap.dedent('''\
VideoTester %s
Video Quality Assessment Tool
Visit https://github.com/Enchufa2/video-tester for support and updates
Copyright 2011-2016 %s
This program is published under a GPLv3 license
''' % (__version__, __author__)))
parser.add_argument(
'-c', '--conf', dest='conf', type=str, default='VT.conf',
help='configuration file (default: ./VT.conf)')
parser.add_argument(
'-v', '--verbose', dest='v', type=int, default=20,
help=textwrap.dedent('''\
verbosity level (default: 20)
CRITICAL = 50
ERROR = 40
WARNING = 30
INFO = 20 <--
DEBUG = 10
NOTSET = 0'''))
subparsers = parser.add_subparsers(title='subcommands', dest='mode')
parser_server = subparsers.add_parser('server', help='launch VT as server')
parser_client = subparsers.add_parser('client', help='launch VT as client')
parser_client.add_argument(
'-g', '--gui', dest='gui', action='store_true',
help='launch graphical interface')
args = parser.parse_args()
VTLOG.setLevel(args.v)
if args.mode == 'server':
from VideoTester import VTServer
server = VTServer(args.conf)
try:
server.serve_forever()
except KeyboardInterrupt:
pass
else:
if os.geteuid():
VTLOG.error('You need administrator privileges to run this program as client')
sys.exit()
if args.gui:
from VideoTester import VTApp
gui = VTApp(args.conf)
gui.MainLoop()
else:
from VideoTester import VTClient
client = VTClient(args.conf)
client.run()