# Royal Render plugin
#
# Information: RR reads the first comment block to get the settings for this plugin.
# You can write as many lines as you like
#
# These lines are just information lines for you and have no effect.  They are *not* required
# rrPluginName:		Shift job start time if job gets into main render approval
# rrPluginAuthor:	Holger Schoenberger
# rrPluginVersion:	1.0
# rrPluginType:		Job Status Plugin
# rrRRversion:		8.1
#
#
#
# These settings are important for server job plugins and have to be set.
# They tell the rrServer when the plugin should be executed. 
# A "1" activates the plugin for this execution step. Everything beside "1" (including nothing) disables it.
#
# rrJobExec FirstCheck:		   
# rrJobExec ScriptPreRender:	   
# rrJobExec PreviewRender:	   
# rrJobExec ScriptAfterPreview:	   
# rrJobExec WaitForApprovalMain:   1
# rrJobExec MainRender:		   
# rrJobExec ScriptPostRender:	   
# rrJobExec WaitForApprovalDone:   
# rrJobExec ScriptFinished:	   
# rrJobExec Finished:		   
#
#
#


# The first line without a # will stop the script header  parser.
# Therefore these lines are not read any more.


import datetime

job= rr.getJob()
if (job.rrParam(rrJob._RRParams.rrApproveJob)>0):
    rrGlobal.writeLog(rrGlobal.logLvL.info,  "Shift job, Job found: " +job.IDstr(),  "")
    job.userApproved= True
    nowTime = datetime.datetime.now()
    laterTime= nowTime.replace(hour=22, minute=00)
    job.timeToEnable= laterTime
    rr.setJob(job)
    




