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):
|
def deploy(ticket, task):
|
||||||
for encoder in range(1, 6):
|
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)
|
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):
|
def deploy(ticket, task):
|
||||||
for encoder in range(1, 3):
|
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)
|
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,
|
'persons': personnames,
|
||||||
'personnames': ', '.join(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 renderlib
|
||||||
import c3t_rpc_client as rpc
|
import c3t_rpc_client as rpc
|
||||||
|
|
||||||
|
try:
|
||||||
|
from termcolor import colored
|
||||||
|
except ImportError:
|
||||||
|
def colored(str, col):
|
||||||
|
return str
|
||||||
|
|
||||||
print("C3TT preroll generator")
|
print("C3TT preroll generator")
|
||||||
renderlib.debug = True
|
renderlib.debug = True
|
||||||
|
|
||||||
|
@ -40,16 +46,16 @@ def generatePreroll(ticket):
|
||||||
task.outfile = os.path.join(ticket['Processing.Path.Intros'], ticket['Fahrplan.ID'] + '.dv')
|
task.outfile = os.path.join(ticket['Processing.Path.Intros'], ticket['Fahrplan.ID'] + '.dv')
|
||||||
task.workdir = os.path.join(os.getcwd(), projectname, 'artwork')
|
task.workdir = os.path.join(os.getcwd(), projectname, 'artwork')
|
||||||
|
|
||||||
print("rendering")
|
print(colored("rendering", 'green'))
|
||||||
renderlib.rendertask(task)
|
renderlib.rendertask(task)
|
||||||
|
|
||||||
if hasattr(project, 'deploy'):
|
if hasattr(project, 'deploy'):
|
||||||
print("deploying")
|
print(colored("deploying", 'green'))
|
||||||
project.deploy(ticket, task)
|
project.deploy(ticket, task)
|
||||||
|
|
||||||
|
|
||||||
while True:
|
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)
|
ticket_id = rpc.assignNextUnassignedForState(ticket_type, ticket_state, url, token, host, secret, filter)
|
||||||
if ticket_id != False:
|
if ticket_id != False:
|
||||||
|
@ -59,7 +65,7 @@ while True:
|
||||||
rpc.setTicketDone(str(ticket_id), url, token, host, secret)
|
rpc.setTicketDone(str(ticket_id), url, token, host, secret)
|
||||||
except:
|
except:
|
||||||
error = str(traceback.format_exc())
|
error = str(traceback.format_exc())
|
||||||
print(error)
|
print(colored(error, 'red'))
|
||||||
rpc.setTicketFailed(str(ticket_id), error, url, token, host, secret)
|
rpc.setTicketFailed(str(ticket_id), error, url, token, host, secret)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue