Skip to content

Commit 4d08fe1

Browse files
committed
Merge pull request #495 from cchampet/fix_samDoEnhancements
sam do: enhancements
2 parents aef40c8 + b5d27d7 commit 4d08fe1

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

applications/sam/sam_do.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def __init__(self):
7878
Crop: sam do reader in.dpx // crop x1=20 x2=1000 y1=10 y2=300 // writer out.jpg
7979
Fill: sam do reader in.dpx // crop y1=10 y2=1060 mode=fill color=0.43,0.67,0.50,1 // writer out.jpg
8080
Resize: sam do reader in.####.dpx // resize size=1920,1080 // writer out.####.jpg
81-
Upscaling: sam do reader in.####.dpx // resize size=1920,1080 filter=lanczos // writer out.####.jpg
82-
Downscaling: sam do reader in.####.dpx // resize size=720,576 filter=mitchell // writer out.####.jpg
81+
Upscaling: sam do reader in.####.dpx // resize width=1920 filter=lanczos // writer out.####.jpg
82+
Downscaling: sam do reader in.####.dpx // resize width=720 filter=mitchell // writer out.####.jpg
8383
8484
''' + self._colorProcessing + '''
8585
Lut : sam do reader in.####.dpx // ocio.lut lutFile.3dl // writer out.jpg
@@ -115,6 +115,17 @@ def fillParser(self, parser):
115115
parser.add_argument('-v', '--verbose', dest='verbose', action=samUtils.SamSetVerboseAction, default=2, help='verbose level (0/fatal, 1/error, 2/warn(by default), 3/info, 4/debug, 5(or upper)/trace)')
116116
# parser.add_argument('-h', '--help', dest='help', action='store_true', help='show this help message and exit')
117117

118+
def _isCommandLineValid(self, inputsToProcess):
119+
"""
120+
Returns if the given sam do inputs to process is well written.
121+
@param inputsToProcess the 'inputs' argument of the user command line.
122+
"""
123+
# check if last input is the separator
124+
if inputsToProcess[-1] == '//':
125+
self.logger.info('The given inputs to process are invalid: ' + str(inputsToProcess))
126+
return False
127+
return True
128+
118129
def _setTimeRanges(self, computeOptions, ranges):
119130
"""
120131
Set time ranges of the given compute options.
@@ -194,7 +205,7 @@ def getListOfSupportedExtension(ofxhImageEffectNodeDescriptor):
194205
self._displayTitle('SUPPORTED INPUT FILE FORMATS')
195206
elif key == 'w':
196207
self._displayTitle('SUPPORTED OUTPUT FILE FORMATS')
197-
puts(', '.join(sorted(extensions)))
208+
puts(', '.join(sorted(set(extensions))))
198209

199210
def _displayParamHelp(self, param):
200211
"""
@@ -479,7 +490,8 @@ def run(self, parser):
479490
exit(0)
480491

481492
# sam-do --help
482-
if len(args.inputs) == 0 and (len(unknown) == 0 or '-h' in unknown or '--help' in unknown):
493+
if( not self._isCommandLineValid(args.inputs) or
494+
( len(args.inputs) == 0 and (len(unknown) == 0 or '-h' in unknown or '--help' in unknown) ) ):
483495
self._displayCommandLineHelp(parser)
484496
exit(0)
485497

@@ -490,6 +502,7 @@ def run(self, parser):
490502
splitCmd = samDoUtils.SplitCmd(args.inputs, args.recursive)
491503
graphsWithNodes = []
492504
for splitCmdGraph in splitCmd.getGraphs():
505+
self.logger.debug('Create the following tuttle graph: \n' + str(splitCmdGraph))
493506
try:
494507
graphsWithNodes.append(self._getTuttleGraph(splitCmdGraph))
495508
except Exception as e:

0 commit comments

Comments
 (0)