def endjob(filename, cat, status, path, bytes, fail_msg, stages, script, script_output, script_ret, test=None):
 tr = sabnzbd.api.Ttemplate
 if ((not status) and fail_msg):
  xstages = {tr('stage-fail'): (fail_msg,)}
 else:
  xstages = {}
 for stage in stages:
  lines = []
  for line in stages[stage]:
   if (('\n' in line) or ('<br/>' in line)):
    lines.extend(line.replace('<br/>', '\n').split('\n'))
   else:
    lines.append(line)
  xstages[tr(('stage-' + stage.lower()))] = lines
 parm = {}
 parm['status'] = status
 parm['name'] = filename
 parm['path'] = path
 parm['msgid'] = ''
 parm['stages'] = xstages
 parm['script'] = script
 parm['script_output'] = script_output
 parm['script_ret'] = script_ret
 parm['cat'] = cat
 parm['size'] = ('%sB' % to_units(bytes))
 parm['end_time'] = time.strftime(time_format('%Y-%m-%d %H:%M:%S'), time.localtime(time.time())).decode(codepage)
 return send_with_template('email', parm, test)

def endjob ( filename , cat , status , path , bytes , fail_msg , stages , script , script_output , script_ret , test = None ) : tr = sabnzbd . api . Ttemplate if ( ( not status ) and fail_msg ) : xstages = { tr ( 'stage-fail' ) : ( fail_msg , ) } else : xstages = { } for stage in stages : lines = [ ] for line in stages [ stage ] : if ( ( '\n' in line ) or ( '<br/>' in line ) ) : lines . extend ( line . replace ( '<br/>' , '\n' ) . split ( '\n' ) ) else : lines . append ( line ) xstages [ tr ( ( 'stage-' + stage . lower ( ) ) ) ] = lines parm = { } parm [ 'status' ] = status parm [ 'name' ] = filename parm [ 'path' ] = path parm [ 'msgid' ] = '' parm [ 'stages' ] = xstages parm [ 'script' ] = script parm [ 'script_output' ] = script_output parm [ 'script_ret' ] = script_ret parm [ 'cat' ] = cat parm [ 'size' ] = ( '%sB' % to_units ( bytes ) ) parm [ 'end_time' ] = time . strftime ( time_format ( '%Y-%m-%d %H:%M:%S' ) , time . localtime ( time . time ( ) ) ) . decode ( codepage ) return send_with_template ( 'email' , parm , test )
send end-of-job email .