-
Notifications
You must be signed in to change notification settings - Fork 0
/
arguments.py
81 lines (64 loc) · 3.14 KB
/
arguments.py
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/python -tt
import argparse
import sys
import os
class argParse:
def parse(self):
descriptionStr = "vCutter simplifies your video editing job by providing you neat\
set of commands to cut, join or covert any video."
parser = argparse.ArgumentParser(prog = "vCutter", description = descriptionStr,
prefix_chars = '-',
add_help = True)
parser.add_argument('select',
metavar='N',
type = int,
nargs = 1,
help = 'See the help for correct option.')
parser.add_argument('-i','--input',
metavar = '',
type = argparse.FileType('r'),
help = 'input: file name or path of the input video')
parser.add_argument('-a','--add',
metavar = '',
type = argparse.FileType('r'),
help = 'add: Enables adding a video in beginning or end of other video')
parser.add_argument('-c','--cut',
metavar = '',
type = argparse.FileType('r'),
help = 'cut: cut the video at specified time')
parser.add_argument('-b','--beginning',
metavar = '',
type = argparse.FileType('r'),
help = 'beginning: add in the beginning')
parser.add_argument('-e','--end',
metavar = '',
type = argparse.FileType('r'),
help = 'end: add at the end')
parser.add_argument('-t','--time',
dest = 'time',
type = str,
metavar = '',
nargs = 2,
default = False,
help = 'start_time, end_time')
parser.add_argument('-I','--insert',
metavar = '',
type = argparse.FileType('r'),
help = 'beginning: add in the beginning')
parser.add_argument('-o','--out',
metavar = '',
## Removed FileType('w'),creates file unnecessary
help = 'output: output video')
parser.add_argument('--version', action='version', version='%(prog)s 1.0')
if len(sys.argv) <= 4:
parser.print_help()
# f = open('examples.txt','r')
# line = f.read()
# print line.strip('\n')
# f.close()
print "\n\nPlease check README for examples. "
parser.exit()
else:
parser.parse_args() # This will check the validity of options
args = sys.argv[1:] # If above line returns true then grab the args
return args