@@ -29,6 +29,7 @@ public void start( String[] args )
29
29
String assetname = null ;
30
30
String paramfile = null ;
31
31
String outputdir = null ;
32
+ Boolean downloadfiles = true ;
32
33
33
34
Options opts = new Options ();
34
35
opts .addOption ("c" , "config" , true , "(Required) App config file. ex) app.config" );
@@ -45,8 +46,9 @@ public void start( String[] args )
45
46
);
46
47
opts .addOption ("f" , "file" , true , "(Optional) Uploading file. By specifing this, you start from uploading file" );
47
48
opts .addOption ("a" , "assetname" , true , "(Required) Asset Name to process media indexing" );
48
- opts .addOption ("p" , "params" , true , "(Optional ) Azure Media Processor Configuration XML/Json file. ex) default-indexer.config" );
49
+ opts .addOption ("p" , "params" , true , "(Required ) Azure Media Processor Configuration XML/Json file. ex) default-indexer.config" );
49
50
opts .addOption ("o" , "output" , true , "(Required) Output directory" );
51
+ opts .addOption ("d" , "download" , true , "(Optional) true/false (true by default) Set false if you don't want to download output files" );
50
52
BasicParser parser = new BasicParser ();
51
53
CommandLine cl ;
52
54
HelpFormatter help = new HelpFormatter ();
@@ -56,7 +58,7 @@ public void start( String[] args )
56
58
cl = parser .parse (opts , args );
57
59
// handle server option.
58
60
if ( !cl .hasOption ("-c" ) || !cl .hasOption ("-a" )
59
- || !cl .hasOption ("-t" ) || !cl .hasOption ("-o" )) {
61
+ || !cl .hasOption ("-t" ) || !cl .hasOption ("-o" ) || ! cl . hasOption ( "-p" ) ) {
60
62
throw new ParseException ("" );
61
63
}
62
64
// handle interface option.
@@ -66,11 +68,20 @@ public void start( String[] args )
66
68
assetname = cl .getOptionValue ("a" );
67
69
paramfile = cl .getOptionValue ("p" );
68
70
outputdir = cl .getOptionValue ("o" );
71
+ String dlopt = cl .getOptionValue ("d" );
69
72
if (conffile == null || assetname == null
70
73
|| mptype == null || paramfile == null || outputdir == null
71
74
|| !Constants .MediaProcessorType_MAP .containsKey (mptype ) ) {
72
75
throw new ParseException ("" );
73
76
}
77
+ // validate download files option
78
+ if (dlopt != null ) {
79
+ String dloptlc = dlopt .toLowerCase ();
80
+ if ( !"true" .equals (dloptlc ) && !"false" .equals (dloptlc ) ) {
81
+ throw new ParseException ("" );
82
+ }
83
+ downloadfiles = Boolean .valueOf (dloptlc );
84
+ }
74
85
75
86
// handlet destination option.
76
87
System .out .println ("Starting application..." );
@@ -84,9 +95,10 @@ public void start( String[] args )
84
95
System .out .println ("Asset name : " + assetname );
85
96
System .out .println ("Task param file : " + paramfile );
86
97
System .out .println ("Output dir : " + outputdir );
98
+ System .out .println ("Download output files : " + Boolean .toString (downloadfiles ));
87
99
88
100
} catch (IOException | ParseException e ) {
89
- help .printHelp ("App -c <app.config> [-f <uploadfile>] -a <assetname> -p <amitaskparam .config> -o <outputdir>" , opts );
101
+ help .printHelp ("App -c <app.config> [-f <uploadfile>] -a <assetname> -p <taskparam .config> -o <outputdir> [-d <true/false>] " , opts );
90
102
System .exit (1 );
91
103
}
92
104
@@ -119,7 +131,8 @@ public void start( String[] args )
119
131
Constants .MediaProcessorType_MAP .get (mptype ),
120
132
assetname ,
121
133
paramfile ,
122
- outputdir );
134
+ outputdir ,
135
+ downloadfiles );
123
136
} catch ( Exception e ){
124
137
System .err .println ("Video indexing failure:" + e );
125
138
System .exit (1 );
0 commit comments