def convert_video_status(video):
 now = datetime.now(video['created'].tzinfo)
 if ((video['status'] == 'upload') and ((now - video['created']) > timedelta(hours=MAX_UPLOAD_HOURS))):
  new_status = 'upload_failed'
  status = StatusDisplayStrings.get(new_status)
  message = ('Video with id [%s] is still in upload after [%s] hours, setting status to [%s]' % (video['edx_video_id'], MAX_UPLOAD_HOURS, new_status))
  send_video_status_update([{'edxVideoId': video['edx_video_id'], 'status': new_status, 'message': message}])
 elif (video['status'] == 'invalid_token'):
  status = StatusDisplayStrings.get('youtube_duplicate')
 else:
  status = StatusDisplayStrings.get(video['status'])
 return status

def convert_video_status ( video ) : now = datetime . now ( video [ 'created' ] . tzinfo ) if ( ( video [ 'status' ] == 'upload' ) and ( ( now - video [ 'created' ] ) > timedelta ( hours = MAX_UPLOAD_HOURS ) ) ) : new_status = 'upload_failed' status = StatusDisplayStrings . get ( new_status ) message = ( 'Video with id [%s] is still in upload after [%s] hours, setting status to [%s]' % ( video [ 'edx_video_id' ] , MAX_UPLOAD_HOURS , new_status ) ) send_video_status_update ( [ { 'edxVideoId' : video [ 'edx_video_id' ] , 'status' : new_status , 'message' : message } ] ) elif ( video [ 'status' ] == 'invalid_token' ) : status = StatusDisplayStrings . get ( 'youtube_duplicate' ) else : status = StatusDisplayStrings . get ( video [ 'status' ] ) return status
convert status of a video .