color output if termcolor is installed
This commit is contained in:
parent
3f057cc5d4
commit
f425cc291c
4 changed files with 18 additions and 6 deletions
|
@ -202,5 +202,5 @@ def ticket(ticket):
|
|||
|
||||
def deploy(ticket, task):
|
||||
for encoder in range(1, 6):
|
||||
print("encoder{n}".format(n=encoder))
|
||||
print(colored("--> rsync'ing to encoder{n}".format(n=encoder), 'green'))
|
||||
subprocess.check_call('rsync -v --bwlimit=1000 --progress -e="ssh -A voc@gw.ep14.c3voc.de ssh -A voc@encoder{n}.lan.c3voc.de" {file} :{file}'.format(n=encoder, file=task.outfile), shell=True)
|
||||
|
|
|
@ -103,5 +103,5 @@ def ticket(ticket):
|
|||
|
||||
def deploy(ticket, task):
|
||||
for encoder in range(1, 3):
|
||||
print("encoder{n}".format(n=encoder))
|
||||
print(colored("--> rsync'ing to encoder{n}".format(n=encoder), 'green'))
|
||||
subprocess.check_call('rsync -v --bwlimit=1000 --progress -e="ssh -A voc@gw.ep14.c3voc.de ssh -A voc@encoder{n}.lan.c3voc.de" {file} :/tmp/'.format(n=encoder, file=task.outfile), shell=True)
|
||||
|
|
|
@ -180,3 +180,9 @@ def events(scheduleUrl, titlemap={}):
|
|||
'persons': personnames,
|
||||
'personnames': ', '.join(personnames)
|
||||
}
|
||||
|
||||
try:
|
||||
from termcolor import colored
|
||||
except ImportError:
|
||||
def colored(str, col):
|
||||
return str
|
||||
|
|
|
@ -9,6 +9,12 @@ import os
|
|||
import renderlib
|
||||
import c3t_rpc_client as rpc
|
||||
|
||||
try:
|
||||
from termcolor import colored
|
||||
except ImportError:
|
||||
def colored(str, col):
|
||||
return str
|
||||
|
||||
print("C3TT preroll generator")
|
||||
renderlib.debug = True
|
||||
|
||||
|
@ -40,16 +46,16 @@ def generatePreroll(ticket):
|
|||
task.outfile = os.path.join(ticket['Processing.Path.Intros'], ticket['Fahrplan.ID'] + '.dv')
|
||||
task.workdir = os.path.join(os.getcwd(), projectname, 'artwork')
|
||||
|
||||
print("rendering")
|
||||
print(colored("rendering", 'green'))
|
||||
renderlib.rendertask(task)
|
||||
|
||||
if hasattr(project, 'deploy'):
|
||||
print("deploying")
|
||||
print(colored("deploying", 'green'))
|
||||
project.deploy(ticket, task)
|
||||
|
||||
|
||||
while True:
|
||||
print('Asking RPC for {0}-tickets which are ready for state {1}'.format(ticket_type, ticket_state))
|
||||
print(colored('Asking RPC for {0}-tickets which are ready for state {1}'.format(ticket_type, ticket_state), 'yellow'))
|
||||
|
||||
ticket_id = rpc.assignNextUnassignedForState(ticket_type, ticket_state, url, token, host, secret, filter)
|
||||
if ticket_id != False:
|
||||
|
@ -59,7 +65,7 @@ while True:
|
|||
rpc.setTicketDone(str(ticket_id), url, token, host, secret)
|
||||
except:
|
||||
error = str(traceback.format_exc())
|
||||
print(error)
|
||||
print(colored(error, 'red'))
|
||||
rpc.setTicketFailed(str(ticket_id), error, url, token, host, secret)
|
||||
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue