예제 #1
0
def elements(elType=None, sequence=None, shot=None, date=None):
	if elType:
		elType = elType.split(',')

	container = env.getShow()

	if sequence and shot:
		_, container = env.getShow().getShot(sequence, shot)
	elif sequence:
		container = env.getShow().getSequence(sequence)

	els = container.getElements(types=elType)

	if date:
		els = [e for e in els if e.isMoreRecent(date)]

	print '\n'.join([str(el) for el in els])
예제 #2
0
def get(elType, name=None, sequence=None, shot=None):
	if name == '-':
		name = None

	element = Element(name, elType, show=env.getShow(), sequence=sequence, shot=shot)

	if not element:
		raise DatabaseError('Element doesn\'t exist (Check for typos in the name, or make a new element)')

	env.setEnvironment('element', element.id)

	print 'Working on {}'.format(element)
예제 #3
0
def rmshot(seqNum, shotNum, clipName=None, clean=False):
	shot = env.getShow().getShot(seqNum, shotNum, clipName=clipName)

	if not shot:
		raise DatabaseError('Shot {} doesn\'t exist for sequence {}'.format(shotNum, seqNum))

	for el in shot.getElements(exclusive=True):
		if el.delete(clean):
			continue
		else:
			raise DatabaseError('Unable to delete: {}. Cannot continue deletion.'.format(el))

	if not shot.delete(clean):
		raise DatabaseError('Unable to delete shot')
	else:
		print 'Successfully removed shot'
예제 #4
0
def rme(elType, name, sequence=None, shot=None, clipName=None, clean=False):
	container = env.getShow() # Where to get element from

	if sequence and shot:
		container = Shot(shot, sequence, clipName=clipName)

		if not container.exists():
			raise DatabaseError('Invalid shot {}{} in sequence {}'.format(shot, clipName if clipName else '', sequence))
	elif sequence:
		container = Sequence(sequence)

		if not container.exists():
			raise DatabaseError('Invalid sequence {}'.format(sequence))

	elements = container.getElements(types=[elType.lower()], names=[name], exclusive=True)

	if elements:
		elements[0].delete(clean)

	print 'Successfully removed element {}'.format(elements[0])
예제 #5
0
def clone(show=None, sequence=None, shot=None):
	# TODO: consider an option for also cloning the work and/or release dirs of the element
	show = env.getShow() if not show else hxdb.getShow(show)
	container = None

	if not show:
		raise DatabaseError('Invalid show specified: {}'.format(show))

	if sequence and shot:
		_, container = show.getShot(sequence, shot)
	elif sequence:
		container = show.getSequence(sequence)
	elif not sequence and not shot:
		container = show
	else:
		raise HelixException('If specifying a shot to clone into, the sequence number must also be provided.')

	cloned = env.getWorkingElement().clone(container)

	os.path.makedirs(cloned.getDiskLocation())
예제 #6
0
def shots(seqNum):
	seq = env.getShow().getSequence(seqNum)

	print '\n'.join([str(s) for s in sorted(seq.getShots(), key=lambda x: x.get('num'))])
예제 #7
0
def sequences():
	print '\n'.join([str(s) for s in sorted(env.getShow().getSequences(), key=lambda x: x.get('num'))])
예제 #8
0
				from helix.utils.qtutils import ExceptionDialog

				ExceptionDialog(traceback.format_exc(e), str(e), parent=QApplication.instance().activeWindow()).exec_()
			else:
				print str(e)

			return False

if __name__ == '__main__':
	if len(sys.argv) > 2:
		if sys.argv[2] == '--debug':
			env.DEBUG = True
			print 'Enabled debug mode'
			if len(sys.argv) > 3:
				handleInput(' '.join(sys.argv[3:]))
		else:
			handleInput(' '.join(sys.argv[2:]))
	try:
		while True:
			print '\r{user} {show}@{element}>>> '.format(
				user=getpass.getuser(),
				show=env.getShow().alias if os.environ.get('HELIX_SHOW') else 'SHOW',
				element=env.getWorkingElement().name if os.environ.get('HELIX_ELEMENT') else 'ELEMENT'
			),
			line = sys.stdin.readline()

			handleInput(line)

	except KeyboardInterrupt:
		exit()