import datetime
import json
import os
import subprocess
import sys
import threading
import time
if 82 - 82: Iii1i
from flask import Blueprint , render_template , request , g , redirect , url_for , flash
import http
# from PIL import Image
import vwAppConfig
from blueprints . wgcomm_pri import WGControllerPri2023
from decorators import login_required
from forms . wgcommform import AddThirdpartynetdeviceForm
from exts import db
from sqlalchemy import or_ , and_
import re
if 87 - 87: Ii % i1i1i1111I . Oo / OooOoo * I1Ii1I1 - I1I
__all__ = [
 "bp" ,
 "web_user_selectphoto" ,
 "web_user_selectphotoByOpenCV" ,

# ooo0oOoooOOO0 % Ii1I111 + iIII . IiIIii11Ii * OOoOoo000O00 * Ooo0Ooo
"web_thirdpartynetdevice_list" ,
 "web_thirdpartynetdevice_add" ,
 "web_thirdpartynetdevice_edit" ,
 "web_thirdpartynetdevice_del" ,
 "web_thirdpartynetdevice_uploadface" ,
 "web_face_allowselected" ,
 "web_face_disallowselected" ,
 "web_face_clearselected" ,
 "web_face_adjusttimeselected" ,


# iI1iII1I1I1i
# IIiIIiIi11I1 * I11iiIi11i1I / iIiii1i - ooo0O0oO00 . iII11II1Iiiii - o0o0ooo00oo
]
if 9 - 9: IiIIii11Ii
from models . iccard import TBThirdpartynetdevice , TBDoor , TBController , TBConsumer , TBGroup
if 10 - 10: Ii1I111 / I11iiIi11i1I * ooo0O0oO00 / iII11II1Iiiii / iII11II1Iiiii
from vwAppConfigParam import vwAppConfigParam
if 61 - 61: iI1iII1I1I1i - I1I
bp = Blueprint ( 'wgcomm_face' , __name__ , url_prefix = '/' )
if 13 - 13: iI1iII1I1I1i
if 46 - 46: IIiIIiIi11I1 - Ii * Oo * Ii
def Ooo ( filename ) :
 return '.' in filename and filename . rsplit ( '.' , 1 ) [ 1 ] . lower ( ) in set ( [ 'jpg' , 'png' ] )
 if 25 - 25: OooOoo - I1Ii1I1 - IIiIIiIi11I1 + i1i1i1111I / IIiIIiIi11I1
 if 71 - 71: Ii
 if 84 - 84: i1i1i1111I . I1Ii1I1 / I11iiIi11i1I - I1I - Ooo0Ooo
 if 8 - 8: Iii1i - Ooo0Ooo
 if 34 - 34: iI1iII1I1I1i + ooo0O0oO00 * I11iiIi11i1I * OooOoo
 if 25 - 25: Ii / ooo0O0oO00 % Ii
 if 96 - 96: Ii . I11iiIi11i1I % iIiii1i
 if 68 - 68: iIiii1i . i1i1i1111I
 if 24 - 24: o0o0ooo00oo
 if 9 - 9: Ooo0Ooo / iII11II1Iiiii . iII11II1Iiiii / Ii % i1i1i1111I % iI1iII1I1I1i
 if 85 - 85: iIiii1i % Ii1I111 + IiIIii11Ii / Ii1I111 / Ooo0Ooo
 if 17 - 17: iIII * IiIIii11Ii - Iii1i . o0o0ooo00oo - Oo % i1i1i1111I
 if 69 - 69: Ii1I111 % OooOoo
 if 45 - 45: ooo0oOoooOOO0
 if 48 - 48: IIiIIiIi11I1 / iIII % o0o0ooo00oo
 if 84 - 84: ooo0O0oO00 . Oo + Ii1I111 / Oo . ooo0O0oO00
 if 20 - 20: o0o0ooo00oo + IiIIii11Ii / I1I
 if 88 - 88: iIiii1i + Ii1I111 - i1i1i1111I . iI1iII1I1I1i * Ii + Iii1i
 if 43 - 43: Ii1I111 * I1Ii1I1
 if 95 - 95: iI1iII1I1I1i % Iii1i % i1i1i1111I . OooOoo
 if 70 - 70: OOoOoo000O00
 if 75 - 75: iI1iII1I1I1i / Ii / OOoOoo000O00 + OOoOoo000O00 . I1I
 if 88 - 88: Oo * OOoOoo000O00
 if 100 - 100: o0o0ooo00oo - OooOoo * I1Ii1I1 / iI1iII1I1I1i / Iii1i
 if 23 - 23: iI1iII1I1I1i + ooo0oOoooOOO0 * I1Ii1I1 + Oo * Ii - I11iiIi11i1I
 if 29 - 29: OOoOoo000O00 - iIII
 if 30 - 30: I1I . Ooo0Ooo
 if 43 - 43: Ii1I111 . iIiii1i + Ooo0Ooo
 if 87 - 87: Iii1i + Ii1I111 . iII11II1Iiiii / Ii + Oo
def OOO00oO0oOo0O ( filename ) :
 if os . path . exists ( filename ) :
  os . remove ( filename )
  if 1 - 1: I1I % iI1iII1I1I1i + IiIIii11Ii . IiIIii11Ii % Oo
 else :
  pass
  if 93 - 93: iIII % iI1iII1I1I1i * IiIIii11Ii
  if 52 - 52: ooo0O0oO00 + I1I / Ooo0Ooo - I1Ii1I1 * iII11II1Iiiii % iIII
  if 52 - 52: iIII . I1I + iII11II1Iiiii - IiIIii11Ii % IIiIIiIi11I1
def web_user_selectphoto ( request , f_CardNO , f_photostr ) :
 try :
  if len ( f_photostr ) > 10 :
   Oo0O0o0oO000 = f_photostr
   Oo0O0o0oO000 = Oo0O0o0oO000 . replace ( "data:image/jpeg;base64," , '' )
   o0Ooo = 4 - len ( Oo0O0o0oO000 ) % 4
   Oo0O0o0oO000 += '=' * o0Ooo
   ii = base64 . b64decode ( Oo0O0o0oO000 )
   if 61 - 61: IIiIIiIi11I1 . iII11II1Iiiii - Ooo0Ooo / Ooo0Ooo - ooo0oOoooOOO0
   iIi = "{}{}.{}" . format ( vwAppConfigParam . wgcloudphotodir , f_CardNO , "jpg" )
   OOO00oO0oOo0O ( iIi )
   if 23 - 23: IIiIIiIi11I1 % ooo0O0oO00 . Oo / OooOoo - iIiii1i - ooo0O0oO00
   with open ( iIi , "wb" ) as O00O0Oo0OOO :
    O00O0Oo0OOO . write ( ii )
   O00O0Oo0OOO . close ( )
   return
   if 97 - 97: Ii1I111 * iIiii1i
 except Exception as oOo0Oo :
  print ( oOo0Oo )
 try :
  if 35 - 35: ooo0O0oO00 + OooOoo . OooOoo
  Ii1iiIII1IIii = request . files [ 'file' ]
  if Ii1iiIII1IIii and Ooo ( Ii1iiIII1IIii . filename ) and f_CardNO > 0 :
   if 54 - 54: Iii1i % Ooo0Ooo % Iii1i - OOoOoo000O00
   if 39 - 39: ooo0O0oO00 - ooo0O0oO00 * ooo0oOoooOOO0 % I11iiIi11i1I
   if 29 - 29: I11iiIi11i1I - Ooo0Ooo . IiIIii11Ii
   if 86 - 86: I1Ii1I1 - OooOoo - ooo0O0oO00 % Ooo0Ooo . iII11II1Iiiii % Iii1i
   if 11 - 11: OooOoo - I1Ii1I1 - Ii1I111 . IiIIii11Ii - IIiIIiIi11I1 / IiIIii11Ii
   iIi = "{}{}.{}" . format ( vwAppConfigParam . wgcloudphotodir , f_CardNO , "jpg" )
   OOO00oO0oOo0O ( iIi )
   Ii1iiIII1IIii . save ( iIi )
   if 44 - 44: iI1iII1I1I1i + i1i1i1111I + Iii1i - ooo0O0oO00
   if 7 - 7: i1i1i1111I / Ii * Iii1i
   if 32 - 32: o0o0ooo00oo . OooOoo
   if 31 - 31: Oo - iII11II1Iiiii
   if 28 - 28: Ii1I111 * I1Ii1I1 + o0o0ooo00oo % Oo
   if 100 - 100: Oo + iII11II1Iiiii
   if 4 - 4: Ooo0Ooo % I1I - i1i1i1111I
   if 76 - 76: ooo0oOoooOOO0 * iIII . o0o0ooo00oo * iII11II1Iiiii . OOoOoo000O00 . ooo0O0oO00
   if 55 - 55: i1i1i1111I + IiIIii11Ii % iI1iII1I1I1i . Oo - OOoOoo000O00 - IIiIIiIi11I1
   if 91 - 91: I1Ii1I1 - iIiii1i
   if 84 - 84: ooo0O0oO00 % IIiIIiIi11I1 - iI1iII1I1I1i
   if 94 - 94: IiIIii11Ii + i1i1i1111I / IIiIIiIi11I1 + IIiIIiIi11I1 / iII11II1Iiiii
   if 79 - 79: IiIIii11Ii - I11iiIi11i1I . I1Ii1I1 + I1I - Ii1I111 + IiIIii11Ii
   if 36 - 36: Ii1I111 * Iii1i % I1I % ooo0oOoooOOO0 . iI1iII1I1I1i
   if 63 - 63: I11iiIi11i1I / I11iiIi11i1I * Iii1i - iIII . ooo0oOoooOOO0
   if 52 - 52: iIII / iII11II1Iiiii * I11iiIi11i1I + iIiii1i % iI1iII1I1I1i + ooo0O0oO00
   if 43 - 43: IIiIIiIi11I1 * iIII + Ii1I111
   if 30 - 30: I1I
   if 41 - 41: ooo0O0oO00
   if 98 - 98: I1I / I11iiIi11i1I / iII11II1Iiiii + o0o0ooo00oo % Oo + I1I
   if 38 - 38: I1Ii1I1 + iIII
   if 2 - 2: OooOoo % Ii + ooo0O0oO00 . OooOoo + I11iiIi11i1I * Oo
   if 2 - 2: I11iiIi11i1I + IIiIIiIi11I1 - I1Ii1I1 + Ii1I111 . I11iiIi11i1I
   if 15 - 15: Ooo0Ooo
   if 63 - 63: iII11II1Iiiii
   if 81 - 81: OooOoo . iII11II1Iiiii / i1i1i1111I + Oo / iI1iII1I1I1i % o0o0ooo00oo
   if 77 - 77: iIiii1i / IIiIIiIi11I1 - iIII - iI1iII1I1I1i % iIII
   if 73 - 73: o0o0ooo00oo . Oo * I1I / i1i1i1111I + I1Ii1I1
   if 31 - 31: i1i1i1111I % I1Ii1I1
   if 1 - 1: o0o0ooo00oo - iIII - ooo0oOoooOOO0 . iIII
   if 91 - 91: IIiIIiIi11I1 * ooo0oOoooOOO0 . Ii1I111
   if 81 - 81: I1I * Oo - ooo0oOoooOOO0 % OooOoo * Ii1I111
   if 19 - 19: Ii
   if 22 - 22: iII11II1Iiiii % IIiIIiIi11I1 + Oo
   if 60 - 60: Ooo0Ooo + iIiii1i + I11iiIi11i1I % i1i1i1111I - Ii % iI1iII1I1I1i
   if 95 - 95: Ii1I111 % i1i1i1111I . ooo0oOoooOOO0
   if 87 - 87: Iii1i % Ii1I111 * Ii % I11iiIi11i1I / iIiii1i
   if 84 - 84: I1Ii1I1 + iI1iII1I1I1i % I11iiIi11i1I * i1i1i1111I
   if 61 - 61: IiIIii11Ii - Oo + I1Ii1I1
   if 43 - 43: I11iiIi11i1I * Ooo0Ooo + Ii % IIiIIiIi11I1
   if 12 - 12: IiIIii11Ii + Ooo0Ooo . iIiii1i
   if 1 - 1: IIiIIiIi11I1 % Ii - iIiii1i / o0o0ooo00oo + IIiIIiIi11I1 - Ii
   if 27 - 27: OooOoo % IIiIIiIi11I1 + I11iiIi11i1I
   if 16 - 16: o0o0ooo00oo
   if 31 - 31: iIII / Iii1i % iI1iII1I1I1i % ooo0oOoooOOO0 . IIiIIiIi11I1 . Oo
   if 83 - 83: iIII - iIiii1i
   if 91 - 91: I11iiIi11i1I - ooo0oOoooOOO0 - IIiIIiIi11I1
   if 71 - 71: I1I - o0o0ooo00oo
   if 66 - 66: i1i1i1111I / iI1iII1I1I1i + iIiii1i + Iii1i + iIII + iII11II1Iiiii
   if 75 - 75: OooOoo - ooo0O0oO00 - OOoOoo000O00 - ooo0O0oO00 + Ooo0Ooo % IIiIIiIi11I1
 except Exception as oOo0Oo :
  print ( oOo0Oo )
  if 42 - 42: ooo0oOoooOOO0 * iII11II1Iiiii
  if 50 - 50: Ii - IiIIii11Ii
def web_user_selectphotoByOpenCV ( request , f_CardNO ) :
 try :
  if 96 - 96: Ooo0Ooo * OooOoo - Ii - OooOoo
  Ii1iiIII1IIii = request . files [ 'file' ]
  if Ii1iiIII1IIii and Ooo ( Ii1iiIII1IIii . filename ) and f_CardNO > 0 :
   if 65 - 65: Oo + Oo - IIiIIiIi11I1 % OooOoo . iI1iII1I1I1i
   if 84 - 84: I11iiIi11i1I . Ii1I111
   if 44 - 44: Ooo0Ooo * i1i1i1111I * ooo0O0oO00 + IiIIii11Ii - I11iiIi11i1I
   if 70 - 70: o0o0ooo00oo
   iIi = "{}{}.{}" . format ( vwAppConfigParam . wgcloudphotodir , f_CardNO , "jpg" )
   Ii1iiIII1IIii . save ( iIi )
   if 9 - 9: iIII * ooo0oOoooOOO0
   import cv2
   if Ii1iiIII1IIii . filename . rsplit ( '.' , 1 ) [ 1 ] == 'png' :
    if 96 - 96: iI1iII1I1I1i
    if 13 - 13: Oo * I1Ii1I1 - iIII * Ii . Ii + iIII
    Ooo0O00o = cv2 . imread ( iIi , cv2 . IMREAD_UNCHANGED )
    if 22 - 22: o0o0ooo00oo . Ooo0Ooo
    if 80 - 80: I11iiIi11i1I / OooOoo % IIiIIiIi11I1 / Ii1I111 * Ii1I111 - Iii1i
    O0ooOO0O0O0O = cv2 . cvtColor ( Ooo0O00o , cv2 . COLOR_RGBA2BGR )
    if 59 - 59: Ooo0Ooo / Oo - ooo0oOoooOOO0
    cv2 . imwrite ( iIi , O0ooOO0O0O0O , [ int ( cv2 . IMWRITE_JPEG_QUALITY ) , 90 ] )
    if 49 - 49: iII11II1Iiiii + iIII + Ooo0Ooo . Iii1i + iII11II1Iiiii
    if 88 - 88: o0o0ooo00oo . I11iiIi11i1I * ooo0oOoooOOO0 + OOoOoo000O00 % I1I / o0o0ooo00oo
   oo00oOOo0O0o = iIi
   I1Iiii1 = iIi
   if 47 - 47: Ii1I111 % Ii1I111 / iIII - IiIIii11Ii * Oo
   oo00 = cv2 . imread ( oo00oOOo0O0o )
   if 87 - 87: OOoOoo000O00 % Ooo0Ooo . Ii1I111 . ooo0O0oO00
   if 16 - 16: Ii1I111 + Ooo0Ooo % OOoOoo000O00 * Oo
   if 87 - 87: Iii1i - o0o0ooo00oo
   if 72 - 72: ooo0oOoooOOO0 % i1i1i1111I * IIiIIiIi11I1
   if 90 - 90: iI1iII1I1I1i * OooOoo . Ii
   Iiii1iIII , o0oO0OOo = oo00 . shape [ : 2 ]
   if 89 - 89: IIiIIiIi11I1 / ooo0oOoooOOO0 - OOoOoo000O00
   I1IiIIiiIi = Iiii1iIII
   iI = o0oO0OOo
   iii1i1iiIi1 = 300
   Ii1I = 300
   iiiiIi1IiiIi = Iiii1iIII
   Ii1iIII11i = o0oO0OOo
   if 58 - 58: o0o0ooo00oo / iIiii1i . IIiIIiIi11I1 + Iii1i * Ii
   print ( Iiii1iIII , o0oO0OOo )
   if I1IiIIiiIi > iI :
    if I1IiIIiiIi > iii1i1iiIi1 :
     iiiiIi1IiiIi = iii1i1iiIi1
     Ii1iIII11i = iI / ( I1IiIIiiIi / iiiiIi1IiiIi )
   elif iI > Ii1I :
    Ii1iIII11i = Ii1I
    iiiiIi1IiiIi = I1IiIIiiIi / ( iI / Ii1iIII11i )
   if ( I1IiIIiiIi == iiiiIi1IiiIi ) and ( iI == Ii1iIII11i ) :
    if 62 - 62: Oo - IIiIIiIi11I1 - i1i1i1111I . IiIIii11Ii
    pass
   else :
    if 78 - 78: OooOoo . Ii1I111
    O0OO00Oo0o0 = cv2 . resize ( oo00 , ( int ( iiiiIi1IiiIi ) , int ( Ii1iIII11i ) ) , cv2 . INTER_LINEAR )
    O0OO00Oo0o0 . save ( I1Iiii1 )
    if 84 - 84: I1I * IIiIIiIi11I1 - iI1iII1I1I1i / IIiIIiIi11I1 + Ooo0Ooo
    if 54 - 54: IiIIii11Ii . IiIIii11Ii - Ii1I111 * OooOoo + I11iiIi11i1I * i1i1i1111I
    if 12 - 12: i1i1i1111I
    if 56 - 56: OOoOoo000O00
    if 17 - 17: iII11II1Iiiii . ooo0O0oO00 % Oo + OOoOoo000O00 - iI1iII1I1I1i
    if 93 - 93: iIII
   oo00 . close ( )
 except Exception as oOo0Oo :
  print ( oOo0Oo )
  if 77 - 77: Oo + iIiii1i % I1I
  if 20 - 20: ooo0oOoooOOO0 - OOoOoo000O00 . OOoOoo000O00 % Ii1I111 . ooo0oOoooOOO0 % iI1iII1I1I1i
import base64
if 72 - 72: ooo0O0oO00 % o0o0ooo00oo . Ii1I111 * I1Ii1I1 . Ii1I111
if 90 - 90: OOoOoo000O00 + I1Ii1I1 . OooOoo
if 73 - 73: i1i1i1111I - Iii1i / iIiii1i . Ooo0Ooo / IIiIIiIi11I1 - IiIIii11Ii
def I1I11i ( image_path ) :
 try :
  with open ( image_path , 'rb' ) as i1i1 :
   I1II1IIIi = base64 . b64encode ( i1i1 . read ( ) )
  return I1II1IIIi . decode ( 'utf-8' )
 except Exception as IiI111I1 :
  print ( IiI111I1 )
  return None
  if 86 - 86: ooo0oOoooOOO0 . o0o0ooo00oo - Ii
  if 1 - 1: I1I + OooOoo
  if 98 - 98: IiIIii11Ii + Iii1i . I11iiIi11i1I
  if 96 - 96: OooOoo / ooo0O0oO00 - ooo0oOoooOOO0 * iIiii1i
  if 72 - 72: i1i1i1111I + Ii - Iii1i - i1i1i1111I - iII11II1Iiiii + iI1iII1I1I1i
  if 74 - 74: iI1iII1I1I1i * Oo + Iii1i - IiIIii11Ii
  if 22 - 22: OOoOoo000O00 - iI1iII1I1I1i . ooo0oOoooOOO0 . iII11II1Iiiii - Ooo0Ooo
  if 68 - 68: Ooo0Ooo
  if 40 - 40: ooo0oOoooOOO0 + I1Ii1I1 + iIiii1i . Oo * iIiii1i % I1I
  if 100 - 100: OooOoo + Oo / OooOoo
  if 33 - 33: o0o0ooo00oo / OooOoo
  if 98 - 98: I1Ii1I1 . I11iiIi11i1I * iII11II1Iiiii - IIiIIiIi11I1 % iII11II1Iiiii * o0o0ooo00oo
  if 42 - 42: OooOoo + i1i1i1111I - IIiIIiIi11I1 - iIII * iII11II1Iiiii + Ii
  if 46 - 46: iIII . IIiIIiIi11I1 - Ii . iIII + i1i1i1111I
  if 83 - 83: o0o0ooo00oo
  if 77 - 77: IIiIIiIi11I1 - ooo0O0oO00 % Ii * iII11II1Iiiii - I1I
  if 42 - 42: iIiii1i - Ii / Oo - i1i1i1111I + iIiii1i
  if 83 - 83: ooo0oOoooOOO0 . IIiIIiIi11I1
  if 57 - 57: o0o0ooo00oo % OOoOoo000O00 / iIII + iI1iII1I1I1i - IiIIii11Ii
  if 87 - 87: IiIIii11Ii . IiIIii11Ii . ooo0O0oO00 . Ooo0Ooo * iIII
  if 33 - 33: o0o0ooo00oo * IiIIii11Ii / iII11II1Iiiii . OooOoo * iIII + Ooo0Ooo
  if 17 - 17: i1i1i1111I * ooo0O0oO00 + IiIIii11Ii - iIiii1i / i1i1i1111I
  if 83 - 83: iIiii1i - Iii1i + iIII + I1I / I11iiIi11i1I + I1I
  if 29 - 29: i1i1i1111I / iIII
  if 13 - 13: iIiii1i % IiIIii11Ii . OooOoo % Ooo0Ooo % OooOoo
  if 21 - 21: o0o0ooo00oo * I1Ii1I1
  if 93 - 93: iI1iII1I1I1i . ooo0oOoooOOO0 + o0o0ooo00oo - iIII
  if 97 - 97: ooo0oOoooOOO0 - ooo0oOoooOOO0 % I11iiIi11i1I + OOoOoo000O00 / iII11II1Iiiii * IIiIIiIi11I1
  if 60 - 60: iIiii1i - iI1iII1I1I1i % I1Ii1I1
  if 26 - 26: Ii1I111 / I11iiIi11i1I . ooo0O0oO00 + iIiii1i . Oo
  if 37 - 37: I1Ii1I1
  if 35 - 35: OooOoo % i1i1i1111I - IIiIIiIi11I1 / OOoOoo000O00
  if 4 - 4: Ooo0Ooo . OOoOoo000O00 % Ooo0Ooo / i1i1i1111I
  if 48 - 48: IiIIii11Ii . Oo
  if 92 - 92: OooOoo + Ii / I11iiIi11i1I + OooOoo * I11iiIi11i1I * IIiIIiIi11I1
  if 79 - 79: i1i1i1111I
  if 3 - 3: OooOoo / o0o0ooo00oo % iIiii1i
  if 55 - 55: iIII
  if 31 - 31: Ii . iI1iII1I1I1i / o0o0ooo00oo
  if 59 - 59: Oo
  if 64 - 64: Iii1i % iIiii1i * ooo0oOoooOOO0 % OooOoo * iIII
  if 55 - 55: o0o0ooo00oo
  if 46 - 46: iI1iII1I1I1i % I1Ii1I1
  if 86 - 86: iIiii1i . i1i1i1111I + ooo0O0oO00 % iIiii1i % Iii1i % Ooo0Ooo
  if 61 - 61: Ooo0Ooo
  if 48 - 48: Iii1i * i1i1i1111I + OOoOoo000O00
  if 31 - 31: Oo * IiIIii11Ii % Ii / ooo0O0oO00 + I1Ii1I1 + IIiIIiIi11I1
  if 90 - 90: I1Ii1I1 * i1i1i1111I / IIiIIiIi11I1 * Ii
  if 38 - 38: I1I . Ii
  if 41 - 41: Ooo0Ooo % I11iiIi11i1I % Ii1I111
  if 5 - 5: iIII / Ii + IiIIii11Ii * Oo + iI1iII1I1I1i + Ooo0Ooo
  if 96 - 96: IiIIii11Ii - I11iiIi11i1I / I11iiIi11i1I * OOoOoo000O00
  if 67 - 67: iI1iII1I1I1i . iI1iII1I1I1i . o0o0ooo00oo
  if 24 - 24: IiIIii11Ii + i1i1i1111I . iIII + IIiIIiIi11I1 + o0o0ooo00oo
  if 92 - 92: IIiIIiIi11I1 / IIiIIiIi11I1 + OOoOoo000O00 . o0o0ooo00oo
  if 56 - 56: Ii * Ooo0Ooo . OOoOoo000O00
  if 66 - 66: I1Ii1I1 * OooOoo . IIiIIiIi11I1 % OooOoo . ooo0oOoooOOO0 . OOoOoo000O00
  if 47 - 47: Ii % OooOoo % IIiIIiIi11I1 * OOoOoo000O00
  if 48 - 48: iII11II1Iiiii . iIiii1i / Ooo0Ooo + IiIIii11Ii
  if 84 - 84: Oo / I1Ii1I1 . I11iiIi11i1I
  if 67 - 67: Oo % Ii1I111 + IIiIIiIi11I1 * I1I
  if 79 - 79: I11iiIi11i1I * Oo / OooOoo
  if 10 - 10: IIiIIiIi11I1 / IiIIii11Ii . OOoOoo000O00 * i1i1i1111I
  if 71 - 71: iIII + I1Ii1I1 / iIiii1i + Oo / I1I
  if 18 - 18: Iii1i - OOoOoo000O00
  if 71 - 71: IIiIIiIi11I1 + OooOoo % i1i1i1111I % iIII . Ooo0Ooo
  if 92 - 92: iIiii1i - iI1iII1I1I1i - i1i1i1111I % IiIIii11Ii / i1i1i1111I * IIiIIiIi11I1
  if 60 - 60: OOoOoo000O00 % ooo0O0oO00 / iII11II1Iiiii * OooOoo / iIiii1i - Ii
  if 16 - 16: iIII / I1Ii1I1 / ooo0oOoooOOO0 + iIiii1i + iIII
  if 11 - 11: ooo0O0oO00 / OooOoo + iIII
  if 79 - 79: iIiii1i . I1Ii1I1 * iII11II1Iiiii % I1Ii1I1 / o0o0ooo00oo
  if 93 - 93: iII11II1Iiiii + Iii1i . Ii . iII11II1Iiiii * Ii1I111
  if 84 - 84: iI1iII1I1I1i % o0o0ooo00oo
  if 82 - 82: I11iiIi11i1I
  if 81 - 81: iIII + ooo0oOoooOOO0 - Ooo0Ooo * IIiIIiIi11I1 + i1i1i1111I
  if 89 - 89: I1Ii1I1
  if 57 - 57: IIiIIiIi11I1 - IiIIii11Ii / OooOoo % IiIIii11Ii
  if 92 - 92: OOoOoo000O00 * OooOoo - OOoOoo000O00
  if 66 - 66: IiIIii11Ii . IIiIIiIi11I1 / Ii1I111 . ooo0oOoooOOO0 - OooOoo
  if 13 - 13: iIII
  if 50 - 50: ooo0oOoooOOO0 - IiIIii11Ii / IiIIii11Ii % I1Ii1I1 / I11iiIi11i1I
  if 66 - 66: iIII - Iii1i - Ooo0Ooo . iIiii1i
  if 59 - 59: iII11II1Iiiii / OOoOoo000O00
  if 7 - 7: iIII
  if 64 - 64: I11iiIi11i1I * ooo0O0oO00 + Oo . OooOoo - Ii1I111
  if 94 - 94: OOoOoo000O00 - Ooo0Ooo . Ii
  if 73 - 73: OOoOoo000O00 / iIII % Ooo0Ooo . IIiIIiIi11I1 % ooo0O0oO00
  if 36 - 36: o0o0ooo00oo * OooOoo . Ooo0Ooo . IiIIii11Ii + ooo0O0oO00
  if 47 - 47: o0o0ooo00oo / iIiii1i
  if 52 - 52: Ii . OooOoo . IiIIii11Ii * iIiii1i - IIiIIiIi11I1
  if 20 - 20: OooOoo % o0o0ooo00oo + I1Ii1I1 + o0o0ooo00oo - iIII
  if 76 - 76: iIiii1i % I11iiIi11i1I % iII11II1Iiiii
  if 39 - 39: OOoOoo000O00 . Oo + iII11II1Iiiii - iIII
  if 93 - 93: Iii1i * I11iiIi11i1I % iII11II1Iiiii + ooo0oOoooOOO0 % Ii * iII11II1Iiiii
  if 62 - 62: o0o0ooo00oo % Ooo0Ooo
  if 19 - 19: Ii / Oo % Iii1i / IiIIii11Ii - OooOoo - iI1iII1I1I1i
  if 89 - 89: iIiii1i - o0o0ooo00oo
  if 61 - 61: Ii * OooOoo * I1I % IiIIii11Ii % I11iiIi11i1I * iIiii1i
  if 49 - 49: IIiIIiIi11I1 / IiIIii11Ii % ooo0O0oO00
  if 46 - 46: Ii1I111 * I11iiIi11i1I % ooo0oOoooOOO0 / ooo0O0oO00 + ooo0oOoooOOO0 + iIII
  if 99 - 99: I1I * I11iiIi11i1I * IiIIii11Ii
  if 62 - 62: Ii1I111 % Oo + iII11II1Iiiii
  if 87 - 87: Ooo0Ooo - OooOoo + Ii + i1i1i1111I + OOoOoo000O00
  if 57 - 57: I11iiIi11i1I + I1I / Ii1I111 % Ii1I111 % Oo / o0o0ooo00oo
  if 95 - 95: ooo0oOoooOOO0 / iIiii1i . ooo0oOoooOOO0 / Oo . iI1iII1I1I1i
  if 43 - 43: Oo - OooOoo * ooo0O0oO00 . iI1iII1I1I1i / I11iiIi11i1I * I11iiIi11i1I
  if 84 - 84: IiIIii11Ii + iIII
  if 83 - 83: i1i1i1111I
  if 84 - 84: ooo0O0oO00 / Ii * iI1iII1I1I1i / Ii / Ooo0Ooo
  if 64 - 64: iIII * Ii
  if 2 - 2: o0o0ooo00oo % IiIIii11Ii . iIII
  if 59 - 59: iIiii1i % OooOoo - IIiIIiIi11I1 % I1I + IiIIii11Ii . I1Ii1I1
  if 94 - 94: Ii1I111 * I1Ii1I1 * IiIIii11Ii . iIII
  if 73 - 73: I1Ii1I1 / Ooo0Ooo % iIiii1i - i1i1i1111I + Oo - I1Ii1I1
  if 18 - 18: ooo0oOoooOOO0 + Ii1I111 . ooo0oOoooOOO0 - IIiIIiIi11I1
  if 97 - 97: iIII + iII11II1Iiiii % Iii1i
  if 34 - 34: ooo0oOoooOOO0 + Oo . iIII - Ooo0Ooo / iIiii1i * iIII
  if 89 - 89: iIII
  if 48 - 48: ooo0oOoooOOO0 / I11iiIi11i1I / IIiIIiIi11I1 / o0o0ooo00oo * OOoOoo000O00
  if 54 - 54: I11iiIi11i1I % I1I % o0o0ooo00oo / iIiii1i . iIiii1i - OOoOoo000O00
  if 10 - 10: Ii . iIiii1i % iII11II1Iiiii / OooOoo % I1Ii1I1
  if 42 - 42: Oo - I1I * iII11II1Iiiii * i1i1i1111I - iIiii1i
  if 58 - 58: IIiIIiIi11I1
  if 17 - 17: IIiIIiIi11I1 - Ii % IIiIIiIi11I1 % iIII * Iii1i
  if 51 - 51: I1I . i1i1i1111I % Ii
  if 55 - 55: i1i1i1111I * Ii % i1i1i1111I
  if 61 - 61: iIII
  if 53 - 53: iI1iII1I1I1i / OOoOoo000O00
  if 49 - 49: Ooo0Ooo - ooo0O0oO00 . OOoOoo000O00 / Oo
  if 23 - 23: iIiii1i - ooo0oOoooOOO0 / Iii1i . IIiIIiIi11I1 + ooo0O0oO00
  if 55 - 55: ooo0oOoooOOO0 - IIiIIiIi11I1 / OooOoo + I1I + Oo
  if 5 - 5: o0o0ooo00oo - ooo0oOoooOOO0 . i1i1i1111I / o0o0ooo00oo . IIiIIiIi11I1 . o0o0ooo00oo
  if 87 - 87: ooo0oOoooOOO0 . Ii * IIiIIiIi11I1 - ooo0O0oO00 / Ii / OooOoo
  if 65 - 65: iII11II1Iiiii / iII11II1Iiiii + o0o0ooo00oo
  if 99 - 99: ooo0oOoooOOO0 + OooOoo + iIiii1i * iI1iII1I1I1i / Ii1I111 + Ii
  if 72 - 72: I1Ii1I1 * iI1iII1I1I1i * I11iiIi11i1I % OOoOoo000O00 . Ooo0Ooo
  if 68 - 68: iI1iII1I1I1i * OooOoo - iIII
  if 49 - 49: I11iiIi11i1I % ooo0oOoooOOO0
  if 29 - 29: OooOoo * Ii - ooo0O0oO00
  if 53 - 53: iIiii1i % Ooo0Ooo / Ii1I111 / I1I
  if 43 - 43: IIiIIiIi11I1 . i1i1i1111I + I1I % Ii1I111 . o0o0ooo00oo - o0o0ooo00oo
  if 6 - 6: I1I
@ bp . route ( '/thirdpartynetdevicelist' , methods = [ 'GET' , 'POST' ] )
@ login_required
def web_thirdpartynetdevice_list ( ) :
 if 98 - 98: ooo0O0oO00 * I11iiIi11i1I / IiIIii11Ii / Iii1i + I1I
 iIi111iIi1III = TBThirdpartynetdevice . query
 OOO0OO = iIi111iIi1III . all ( )
 if 13 - 13: IiIIii11Ii - OOoOoo000O00 / iI1iII1I1I1i + iII11II1Iiiii . OooOoo / Iii1i
 OooOoO = {
 "objlist" : OOO0OO ,
 "deleteUrl" : "/thirdpartynetdevice_del"
 }
 return render_template ( 'wgcomm/thirdpartynetdevice-list.html' , ** OooOoO )
 if 73 - 73: ooo0O0oO00 - IiIIii11Ii
 if 33 - 33: I11iiIi11i1I * I1Ii1I1 - OOoOoo000O00 * I1Ii1I1
@ bp . route ( '/thirdpartynetdevice_listpage' , methods = [ 'GET' , 'POST' ] )
@ login_required
def I11i ( ) :
 iiiIi1ii1iii = ''
 if request . method == 'GET' :
  O0 = int ( request . args . get ( 'draw' ) )
  Ooo0 = int ( request . args . get ( 'length' ) )
  O0oo0 = int ( request . args . get ( 'start' ) )
  i11II = request . args . get ( 'search[value]' )
 else :
  O0 = int ( request . form . get ( 'draw' ) )
  Ooo0 = int ( request . form . get ( 'length' ) )
  O0oo0 = int ( request . form . get ( 'start' ) )
  i11II = request . form . get ( 'search[value]' )
  iiiIi1ii1iii = request . form . get ( 'csrf_token' )
 OOO = [ ]
 iIi111iIi1III = TBThirdpartynetdevice . query
 if 59 - 59: ooo0oOoooOOO0 / i1i1i1111I + Ii * Ooo0Ooo . Ooo0Ooo
 if Ooo0 == - 1 :
  O0oo0 = 0
  Ooo0 = 2147483647
  if 49 - 49: Ii - Iii1i * I1Ii1I1 * I11iiIi11i1I . iI1iII1I1I1i
 if i11II :
  i11II = i11II . strip ( )
  oooo00OOoo = i11II . split ( ' ' )
  if len ( oooo00OOoo ) >= 1 :
   oOoo = and_ ( 1 > 0 )
   for IIi in oooo00OOoo :
    I1II1i11i11I = or_ ( TBThirdpartynetdevice . f_DeviceIP . like ( "%%%s%%" % IIi ) ,
 TBThirdpartynetdevice . f_DeviceName . like ( "%%%s%%" % IIi ) )
    oOoo = and_ ( oOoo , I1II1i11i11I )
   I1II1i11i11I = oOoo
   iIi111iIi1III = iIi111iIi1III . filter ( I1II1i11i11I )
   iiiI111I = iIi111iIi1III . count ( )
  else :
   iiiI111I = TBThirdpartynetdevice . query . count ( )
 else :
  iiiI111I = TBThirdpartynetdevice . query . count ( )
  if 100 - 100: Ii1I111 . I11iiIi11i1I - ooo0oOoooOOO0
  if 46 - 46: iI1iII1I1I1i - iII11II1Iiiii / Ooo0Ooo * o0o0ooo00oo . iIII
 iIioOOOoooOOOOoo = O0oo0
 if O0oo0 <= iiiI111I :
  OOO0OO = iIi111iIi1III . order_by ( TBThirdpartynetdevice . f_DeviceName ) . offset ( O0oo0 ) . limit ( Ooo0 ) . all ( )
  iIioOOOoooOOOOoo = O0oo0 + Ooo0
 else :
  OOO0OO = iIi111iIi1III . order_by ( TBThirdpartynetdevice . f_DeviceName ) . offset ( 0 ) . limit ( Ooo0 ) . all ( )
  iIioOOOoooOOOOoo = 1
  if 12 - 12: IIiIIiIi11I1 - ooo0O0oO00
  if 72 - 72: Oo - i1i1i1111I . ooo0O0oO00 + o0o0ooo00oo . o0o0ooo00oo
  if 42 - 42: iIII . Ooo0Ooo - ooo0O0oO00 . ooo0oOoooOOO0
  if 74 - 74: Ooo0Ooo / OooOoo / iIII + I11iiIi11i1I + OooOoo
 for iIIIIiII in OOO0OO :
  I1iIiiIiII1 = '<div class="d-flex align-items-stretch">'
  I1iIiiIiII1 += '<form action="/thirdpartynetdevice_edit" method="post">  '
  I1iIiiIiII1 += '<input type="hidden" name="csrf_token"              '
  if 49 - 49: IiIIii11Ii - o0o0ooo00oo - OooOoo
  I1iIiiIiII1 += 'value="{}">                         ' . format ( iiiIi1ii1iii )
  I1iIiiIiII1 += '<input type="hidden" name="conID"                   '
  I1iIiiIiII1 += 'value="{}"> ' . format ( iIIIIiII . f_DeviceId )
  I1iIiiIiII1 += '<button class="btn btn-icon btn-primary-light me-2" '
  I1iIiiIiII1 += 'data-id="{}"' . format ( iIIIIiII . f_DeviceId )
  if 39 - 39: I1I % IiIIii11Ii - I1Ii1I1
  I1iIiiIiII1 += 'data-bs-toggle="tooltip" title="Edit"'
  I1iIiiIiII1 += 'data-bs-original-title="Edit">'
  I1iIiiIiII1 += '<i class="fe fe-edit"></i></button> '
  I1iIiiIiII1 += '</form>'
  if 51 - 51: I11iiIi11i1I + ooo0oOoooOOO0 % IiIIii11Ii
  I1iIiiIiII1 += '<button href="#"'
  I1iIiiIiII1 += 'class="btn btn-icon btn-warning-light me-2 active-btn"'
  I1iIiiIiII1 += 'data-id="' + str ( iIIIIiII . f_DeviceId ) + '"'
  I1iIiiIiII1 += 'data-name="' + str ( iIIIIiII . f_DeviceName ) + '"'
  if 49 - 49: OOoOoo000O00 - iII11II1Iiiii . I1I
  if 76 - 76: ooo0O0oO00 / IIiIIiIi11I1 . I1I * iIII - i1i1i1111I
  O0Oo = '/thirdpartynetdevice_del'
  I1iIiiIiII1 += 'data-url="{}"' . format ( O0Oo )
  I1iIiiIiII1 += 'data-bs-toggle="tooltip" title="Delete"'
  I1iIiiIiII1 += 'data-op="delete"'
  I1iIiiIiII1 += 'data-bs-original-title="Delete">'
  I1iIiiIiII1 += '<i class="fe fe-trash"></i>'
  I1iIiiIiII1 += '</button>'
  I1iIiiIiII1 += '  </div>'
  if 33 - 33: iI1iII1I1I1i / i1i1i1111I - o0o0ooo00oo - iII11II1Iiiii - ooo0O0oO00 - iIiii1i
  if 89 - 89: Ii % ooo0O0oO00 + i1i1i1111I % Oo
  if 99 - 99: OOoOoo000O00 * I1Ii1I1
  if 83 - 83: iII11II1Iiiii . Ooo0Ooo * iI1iII1I1I1i + Iii1i . Oo
  if 34 - 34: iIiii1i % ooo0O0oO00
  if 75 - 75: ooo0oOoooOOO0 % OOoOoo000O00 - IIiIIiIi11I1 - iII11II1Iiiii * iIiii1i * OooOoo
  if 45 - 45: I11iiIi11i1I
  Iii1iIII = [ iIIIIiII . f_DeviceName , iIIIIiII . f_DeviceIP ,
 iIIIIiII . f_ReaderID , I1iIiiIiII1 ]
  OOO . append ( Iii1iIII )
  if 59 - 59: I11iiIi11i1I % OOoOoo000O00
 o00OOoOo0 = {
 "draw" : O0 ,
 "recordsTotal" : iiiI111I ,
 "recordsFiltered" : iiiI111I ,
 "data" : OOO ,
 'start' : iIioOOOoooOOOOoo
 }
 return json . dumps ( o00OOoOo0 )
 if 15 - 15: IiIIii11Ii
 if 83 - 83: I1Ii1I1
def iiI1IIiI1i ( address ) :
 if not address :
  return False
  if 24 - 24: iI1iII1I1I1i * Iii1i - o0o0ooo00oo * IIiIIiIi11I1 / iI1iII1I1I1i % Ooo0Ooo
 iI1i1 = "^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$"
 if not re . match ( iI1i1 , address ) :
  return False
 return True
 if 14 - 14: OOoOoo000O00 / I1I + Oo - I11iiIi11i1I + iIiii1i
 if 82 - 82: Ooo0Ooo % Ooo0Ooo % iII11II1Iiiii
@ bp . route ( '/thirdpartynetdevice_add' , methods = [ 'GET' , 'POST' ] )
@ login_required
def web_thirdpartynetdevice_add ( ) :
 II1i11I = "wgcomm/thirdpartynetdevice-add.html"
 iiiIiiI = "wgcomm_face.web_thirdpartynetdevice_list"
 if request . method == 'GET' :
  I1i1IIiI = AddThirdpartynetdeviceForm ( )
  return render_template ( II1i11I , wgform = I1i1IIiI )
 else :
  if 82 - 82: I1Ii1I1 * I1Ii1I1 % iIII - I1Ii1I1 / IiIIii11Ii
  I1i1IIiI = AddThirdpartynetdeviceForm ( request . form )
  if 58 - 58: OOoOoo000O00 . I11iiIi11i1I . I1I / ooo0O0oO00 - iIiii1i
  if I1i1IIiI . submitcancel . data :
   return redirect ( url_for ( iiiIiiI ) )
  if I1i1IIiI . validate ( ) :
   OOO0OOoo0ooO = I1i1IIiI . f_DeviceName . data
   I1IiI = I1i1IIiI . f_DeviceIP . data
   if 73 - 73: ooo0O0oO00 - Oo % Oo % ooo0O0oO00 + ooo0O0oO00 + Ii
   oo00oOoO = TBThirdpartynetdevice . query . filter_by ( f_DeviceName = OOO0OOoo0ooO ) . first ( )
   if oo00oOoO :
    flash ( "Device Name Duplicated" )
    return render_template ( II1i11I , wgform = I1i1IIiI )
    if 34 - 34: IIiIIiIi11I1 . ooo0oOoooOOO0 . I1I
   if not iiI1IIiI1i ( I1IiI ) :
    O0oo = ( "IP {}  invalid. please input valid value" . format ( I1IiI ) )
    flash ( O0oo )
    return render_template ( II1i11I , wgform = I1i1IIiI )
   oo00oOoO = TBThirdpartynetdevice . query . filter_by ( f_DeviceIP = I1IiI ) . first ( )
   if oo00oOoO :
    flash ( "IP Address Duplicated" )
    return render_template ( II1i11I , wgform = I1i1IIiI )
    if 27 - 27: iII11II1Iiiii
    if 45 - 45: o0o0ooo00oo + I1Ii1I1 % iIII + iII11II1Iiiii + Ii1I111
   iiI1i1ii = TBThirdpartynetdevice ( f_DeviceName = OOO0OOoo0ooO , f_DeviceIP = I1IiI ,
 f_Enabled = 1 ,
 f_DevicePort = I1i1IIiI . f_DevicePort . data ,
 f_DeviceType = 0 , f_Factory = '' , f_CardNOWorkNODiff = 0 , f_Notes = '' )
   if 19 - 19: ooo0oOoooOOO0 + Ooo0Ooo * OooOoo - Ii1I111 % iI1iII1I1I1i * Ooo0Ooo
   try :
    db . session . add ( iiI1i1ii )
    db . session . commit ( )
    vwAppConfig . setcontrollerdoorChangeTime ( )
    flash ( "Face Device {}  Add Successfully ！" . format ( OOO0OOoo0ooO ) )
    vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName , "Face Device {}  Add Successfully ！" . format (
 OOO0OOoo0ooO ) ) )
    if 58 - 58: i1i1i1111I
    if I1i1IIiI . submitsaveandadd . data :
     return redirect ( url_for ( "wgcomm.thirdpartynetdevice_add" ) )
    return redirect ( url_for ( iiiIiiI ) )
   except Exception as OOOOO0o0o0O00 :
    print ( OOOOO0o0o0O00 )
    vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName , "Face Device {}  Add Failed ！" . format (
 OOO0OOoo0ooO ) , OOOOO0o0o0O00 ) )
    if 90 - 90: ooo0O0oO00 . I1I - iI1iII1I1I1i
    db . session . rollback ( )
    flash ( "Face Device Add Failed ！" )
    return render_template ( II1i11I , wgform = I1i1IIiI )
  else :
   for OOO in I1i1IIiI . messages :
    flash ( OOO )
   return render_template ( II1i11I , wgform = I1i1IIiI )
   if 28 - 28: IiIIii11Ii + IiIIii11Ii + iII11II1Iiiii % OooOoo
   if 73 - 73: Ii + Oo . IIiIIiIi11I1 * Iii1i
@ bp . route ( '/thirdpartynetdevice_edit' , methods = [ 'GET' , 'POST' ] )
@ login_required
def web_thirdpartynetdevice_edit ( ) :
 II1i11I = "wgcomm/thirdpartynetdevice-edit.html"
 iiiIiiI = "wgcomm_face.web_thirdpartynetdevice_list"
 if 16 - 16: IIiIIiIi11I1 - Iii1i
 if request . form . get ( 'conID' ) :
  oo0OoOo0OOoO0 = request . form . get ( 'conID' )
  I1i1IIiI = AddThirdpartynetdeviceForm ( )
  i1I11iI1 = TBThirdpartynetdevice . query . get ( oo0OoOo0OOoO0 )
  if i1I11iI1 :
   I1i1IIiI . f_DeviceId . data = oo0OoOo0OOoO0
   I1i1IIiI . f_DeviceName . data = i1I11iI1 . f_DeviceName
   I1i1IIiI . f_DeviceIP . data = i1I11iI1 . f_DeviceIP
  return render_template ( II1i11I , wgform = I1i1IIiI )
  if 12 - 12: Iii1i . I11iiIi11i1I / OooOoo . ooo0oOoooOOO0 % IIiIIiIi11I1 % Iii1i
 if request . form . get ( 'f_DeviceId' ) :
  if 2 - 2: Oo + OooOoo - i1i1i1111I - Ooo0Ooo / Oo . Oo
  I1i1IIiI = AddThirdpartynetdeviceForm ( request . form )
  if 41 - 41: OooOoo + OooOoo - OooOoo
  if I1i1IIiI . submitcancel . data :
   return redirect ( url_for ( iiiIiiI ) )
  if I1i1IIiI . validate ( ) :
   OOO0OOoo0ooO = I1i1IIiI . f_DeviceName . data
   I1IiI = I1i1IIiI . f_DeviceIP . data
   i1iII1i11iI = I1i1IIiI . f_DeviceId . data
   if 79 - 79: I1I - Oo . Oo / Ooo0Ooo % iI1iII1I1I1i + IiIIii11Ii
   oo00oOoO = TBThirdpartynetdevice . query . filter_by (
 f_DeviceName = OOO0OOoo0ooO ) . all ( )
   if 18 - 18: i1i1i1111I + ooo0oOoooOOO0
   if 71 - 71: o0o0ooo00oo % Iii1i + iIII * iIiii1i / o0o0ooo00oo
   if 66 - 66: Ooo0Ooo * iIII
   if oo00oOoO :
    for iIIIIiII in oo00oOoO :
     if not iIIIIiII . f_DeviceId == i1iII1i11iI :
      flash ( "Device Name Duplicated" )
      return render_template ( II1i11I , wgform = I1i1IIiI )
   if not iiI1IIiI1i ( I1IiI ) :
    O0oo = ( "IP {}  invalid. please input valid value" . format ( I1IiI ) )
    flash ( O0oo )
    return render_template ( II1i11I , wgform = I1i1IIiI )
    if 83 - 83: ooo0oOoooOOO0
   oo00oOoO = TBThirdpartynetdevice . query . filter_by (
 f_DeviceIP = I1IiI ) . all ( )
   if 64 - 64: ooo0oOoooOOO0 . o0o0ooo00oo - iIiii1i . Iii1i
   if 47 - 47: Ooo0Ooo / iI1iII1I1I1i % OOoOoo000O00
   if 70 - 70: I11iiIi11i1I / Iii1i . i1i1i1111I % Ii1I111 . Ii / Ii
   if oo00oOoO :
    for iIIIIiII in oo00oOoO :
     if not iIIIIiII . f_DeviceId == i1iII1i11iI :
      flash ( "IP Address Duplicated" )
      return render_template ( II1i11I , wgform = I1i1IIiI )
      if 51 - 51: iIiii1i + iI1iII1I1I1i - Ooo0Ooo * ooo0O0oO00 . ooo0O0oO00
   TBThirdpartynetdevice . query . filter_by ( f_DeviceId = i1iII1i11iI ) . update (
 { "f_DeviceName" : OOO0OOoo0ooO , "f_DeviceIP" : I1IiI } , synchronize_session = False )
   try :
    if 79 - 79: i1i1i1111I + iIII
    db . session . commit ( )
    vwAppConfig . setcontrollerdoorChangeTime ( )
    flash ( "Face Device {}  Edit Successfully ！" . format ( OOO0OOoo0ooO ) )
    vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName , "Face Device {}  Edit Successfully ！" . format (
 OOO0OOoo0ooO ) ) )
    if 11 - 11: OooOoo / IiIIii11Ii % iII11II1Iiiii - i1i1i1111I * iIII
    if I1i1IIiI . submitsaveandadd . data :
     return redirect ( url_for ( "wgcomm.thirdpartynetdevice_add" ) )
    return redirect ( url_for ( iiiIiiI ) )
   except Exception as OOOOO0o0o0O00 :
    print ( OOOOO0o0o0O00 )
    vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName , "Face Device {}  Edit Failed ！" . format (
 OOO0OOoo0ooO ) , OOOOO0o0o0O00 ) )
    if 90 - 90: ooo0oOoooOOO0 * ooo0oOoooOOO0 . iI1iII1I1I1i . Oo
    db . session . rollback ( )
    flash ( "Face Device Edit Failed ！" )
    return render_template ( II1i11I , wgform = I1i1IIiI )
  else :
   for OOO in I1i1IIiI . messages :
    flash ( OOO )
   return render_template ( II1i11I , wgform = I1i1IIiI )
   if 59 - 59: Ii % I1Ii1I1 + Iii1i . OooOoo * Iii1i
   if 21 - 21: iIiii1i + Ii1I111 % OOoOoo000O00 / OooOoo
@ bp . route ( '/thirdpartynetdevice_del' , methods = [ 'POST' ] )
@ login_required
def web_thirdpartynetdevice_del ( ) :
 oO = request . form . get ( "primaryID" )
 if oO :
  iiiIiiI = "wgcomm_face.web_thirdpartynetdevice_list"
  oo00oOoO = TBThirdpartynetdevice . query . filter_by ( f_DeviceId = oO ) . first ( )
  OoO000oOO0 = oo00oOoO . f_DeviceName
  TBThirdpartynetdevice . query . filter_by ( f_DeviceId = oO ) . delete ( )
  db . session . commit ( )
  flash ( "DeleteFace Device {} Successfully " . format ( OoO000oOO0 ) )
  vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName ,
 "Face Device {} Delete Successfully ！" . format ( OoO000oOO0 ) ) )
  if 47 - 47: I11iiIi11i1I
  return redirect ( url_for ( iiiIiiI ) )
  if 73 - 73: I1Ii1I1 + Ii1I111
  if 99 - 99: iII11II1Iiiii
@ bp . route ( '/thirdpartynetdevice_uploadface' , methods = [ 'GET' , 'POST' ] )
@ login_required
def web_thirdpartynetdevice_uploadface ( ) :
 i1iiiiiIIIiii = TBThirdpartynetdevice . query . order_by ( TBThirdpartynetdevice . f_DeviceName ) . all ( )
 if 71 - 71: iI1iII1I1I1i * IiIIii11Ii / iI1iII1I1I1i / IiIIii11Ii * i1i1i1111I + iII11II1Iiiii
 if 48 - 48: iIiii1i
 if 87 - 87: I1Ii1I1
 if 29 - 29: Ooo0Ooo . IIiIIiIi11I1 . iIII + i1i1i1111I + ooo0O0oO00
 if 59 - 59: OOoOoo000O00
 if 26 - 26: iIII % o0o0ooo00oo * ooo0oOoooOOO0
 if 60 - 60: I11iiIi11i1I % ooo0O0oO00 / ooo0oOoooOOO0
 if 20 - 20: iI1iII1I1I1i
 OOO0OO = [ ]
 if 4 - 4: OOoOoo000O00 % Iii1i
 OooOoO = {
 "objlist" : OOO0OO ,
 "objlistNetdevice" : i1iiiiiIIIiii ,
 "deleteUrl" : "/user_del" ,
 "losecardUrl" : "/user_losecard"
 }
 return render_template ( "wgcomm/thirdpartynetdevice-uploadface.html" , ** OooOoO )
 if 43 - 43: Ooo0Ooo
@ bp . route ( '/thirdpartynetdevice_uploadface_page' , methods = [ 'GET' , 'POST' ] )
@ login_required
def o0oOO ( ) :
 iiiIi1ii1iii = ''
 if request . method == 'GET' :
  O0 = int ( request . args . get ( 'draw' ) )
  Ooo0 = int ( request . args . get ( 'length' ) )
  O0oo0 = int ( request . args . get ( 'start' ) )
  i11II = request . args . get ( 'search[value]' )
 else :
  O0 = int ( request . form . get ( 'draw' ) )
  Ooo0 = int ( request . form . get ( 'length' ) )
  O0oo0 = int ( request . form . get ( 'start' ) )
  i11II = request . form . get ( 'search[value]' )
  iiiIi1ii1iii = request . form . get ( 'csrf_token' )
 OOO = [ ]
 if 8 - 8: Ii1I111 * i1i1i1111I
 if 6 - 6: iI1iII1I1I1i % OOoOoo000O00
 if 59 - 59: iII11II1Iiiii . iIiii1i . Ooo0Ooo / iII11II1Iiiii . Ii % iI1iII1I1I1i
 if 85 - 85: iIII / Ii1I111
 if 41 - 41: IiIIii11Ii * IIiIIiIi11I1 + ooo0oOoooOOO0 + i1i1i1111I
 if 26 - 26: Oo % OooOoo
 iIi111iIi1III = db . session . query ( TBConsumer . f_ConsumerID , TBConsumer . f_ConsumerNO , TBConsumer . f_ConsumerName ,
 TBConsumer . f_CardNO , TBConsumer . f_BeginYMD ,
 TBConsumer . f_EndYMD , TBGroup . f_GroupName ) . join ( TBGroup ,
 TBConsumer . f_GroupID == TBGroup . f_GroupID ,
 isouter = True ) . order_by (
 TBConsumer . f_ConsumerNO )
 if 14 - 14: IIiIIiIi11I1 - IiIIii11Ii
 if Ooo0 == - 1 :
  O0oo0 = 0
  Ooo0 = 2147483647
  if 53 - 53: ooo0O0oO00
 if i11II :
  i11II = i11II . strip ( )
  oooo00OOoo = i11II . split ( ' ' )
  if len ( oooo00OOoo ) >= 1 :
   oOoo = and_ ( 1 > 0 )
   for IIi in oooo00OOoo :
    I1II1i11i11I = or_ ( TBConsumer . f_ConsumerNO . like ( "%%%s%%" % IIi ) ,
 TBConsumer . f_ConsumerName . like ( "%%%s%%" % IIi ) ,
 TBGroup . f_GroupName . like ( "%%%s%%" % IIi ) )
    if vwAppConfig . parseInt ( IIi ) > 0 :
     oOOOooo0O = vwAppConfig . parseInt ( IIi )
     I1II1i11i11I = or_ ( TBConsumer . f_CardNO == oOOOooo0O , I1II1i11i11I )
    oOoo = and_ ( oOoo , I1II1i11i11I )
   I1II1i11i11I = oOoo
   iIi111iIi1III = iIi111iIi1III . filter ( I1II1i11i11I )
   iiiI111I = iIi111iIi1III . count ( )
  else :
   iiiI111I = TBConsumer . query . count ( )
 else :
  iiiI111I = TBConsumer . query . count ( )
  if 91 - 91: Ii % IiIIii11Ii / i1i1i1111I / ooo0oOoooOOO0 * Ooo0Ooo + iIiii1i
  if 7 - 7: Ii1I111 + Iii1i / IIiIIiIi11I1 - ooo0O0oO00 % Oo / IIiIIiIi11I1
 iIioOOOoooOOOOoo = O0oo0
 if O0oo0 <= iiiI111I :
  OOO0OO = iIi111iIi1III . order_by ( TBConsumer . f_ConsumerNO ) . offset ( O0oo0 ) . limit ( Ooo0 ) . all ( )
  iIioOOOoooOOOOoo = O0oo0 + Ooo0
 else :
  OOO0OO = iIi111iIi1III . order_by ( TBConsumer . f_ConsumerNO ) . offset ( 0 ) . limit ( Ooo0 ) . all ( )
  iIioOOOoooOOOOoo = 1
  if 14 - 14: Iii1i . Ii
 for iIIIIiII in OOO0OO :
  iII11 = """                                                                            <div class="custom-checkbox custom-control">
                                                                                 <input type="checkbox"
                                                                                        data-bs-checkboxes="mygroup"
                                                                                        class="custom-control-input call-checkbox"
                                                                                        id="chk{0}">
                                                                                 <label for="chk{1}"
                                                                                        class="custom-control-label"></label>
                                                                             </div>""" . format ( iIIIIiII . f_ConsumerID , iIIIIiII . f_ConsumerID )
  if 83 - 83: iII11II1Iiiii
  oo = iIIIIiII . f_CardNO
  if oo is None or oo == 0 :
   oo = ''
  else :
   if 26 - 26: OooOoo - IiIIii11Ii . Ii . Ii - iII11II1Iiiii / iI1iII1I1I1i
   oo = '<text id="cardno-{}" >{}</text>' . format ( iIIIIiII . f_ConsumerID , oo )
  OO = iIIIIiII . f_GroupName
  if OO is None :
   OO = ''
   if 88 - 88: OOoOoo000O00 / I1Ii1I1 / Ii1I111 + IIiIIiIi11I1
   if 20 - 20: o0o0ooo00oo
   if 80 - 80: iIII / iI1iII1I1I1i - I11iiIi11i1I % i1i1i1111I . Ii1I111
  Iii1iIII = [ iII11 , iIIIIiII . f_ConsumerNO , iIIIIiII . f_ConsumerName ,
 oo , OO ]
  OOO . append ( Iii1iIII )
  if 50 - 50: I1I - iIiii1i
 o00OOoOo0 = {
 "draw" : O0 ,
 "recordsTotal" : iiiI111I ,
 "recordsFiltered" : iiiI111I ,
 "data" : OOO ,
 'start' : iIioOOOoooOOOOoo
 }
 return json . dumps ( o00OOoOo0 )
@ bp . route ( '/face_allowselected' , methods = [ 'POST' ] )
@ login_required
def web_face_allowselected ( ) :
 if 32 - 32: Iii1i % OOoOoo000O00 - ooo0O0oO00 - OOoOoo000O00 - iIiii1i % IiIIii11Ii
 if 50 - 50: Iii1i / o0o0ooo00oo + ooo0oOoooOOO0
 if 4 - 4: I11iiIi11i1I . OOoOoo000O00 % iII11II1Iiiii
 ii1 = request . form . get ( "selecteddoor" )
 if 31 - 31: Ii % iII11II1Iiiii / Ooo0Ooo
 oo0O = request . form . get ( "selecteduser" )
 if 95 - 95: iII11II1Iiiii + OOoOoo000O00 . iII11II1Iiiii % iII11II1Iiiii / I11iiIi11i1I / ooo0O0oO00
 if 40 - 40: Ii - i1i1i1111I
 if 8 - 8: ooo0oOoooOOO0 % Iii1i
 if 68 - 68: IiIIii11Ii . I1I % IiIIii11Ii / I1Ii1I1
 if len ( ii1 ) == 0 or len ( oo0O ) == 0 :
  return "OK"
  if 42 - 42: Iii1i
 ii1 = ii1 . split ( "," )
 ii1 = [ int ( x ) for x in ii1 ]
 ii1 . sort ( )
 oo0O = oo0O . split ( "," )
 oo0O = [ int ( x ) for x in oo0O ]
 oo0O . sort ( )
 if 19 - 19: OooOoo * iIiii1i . i1i1i1111I + Ooo0Ooo + iII11II1Iiiii
 if 13 - 13: IiIIii11Ii + I1Ii1I1 / iI1iII1I1I1i
 vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName ,
 "Upload Devices count={}-Users count={}" . format ( len ( ii1 ) ,
 len ( oo0O ) ) ) )
 if 82 - 82: IiIIii11Ii * ooo0O0oO00 / o0o0ooo00oo * OOoOoo000O00
 if 29 - 29: I1Ii1I1 % iIII - iIII * I1Ii1I1 / Iii1i * iII11II1Iiiii
 if 51 - 51: I1Ii1I1 . IiIIii11Ii % ooo0oOoooOOO0 % iII11II1Iiiii * Oo
 O0oo = o0ooOOo ( doorDst = ii1 , userDst = oo0O , opMode = 'btnAddPass_Click' )
 if 82 - 82: IiIIii11Ii
 if 58 - 58: Ii1I111
 iiIIi1iiII1Ii = ""
 if O0oo [ "updateConFailed" ] :
  OO0OoO00 = """Devices with communication failure:"""
  vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 OO0OoO00 , O0oo [ "updateConFailed" ] ) )
  if 98 - 98: I1Ii1I1 / i1i1i1111I - iIII . IiIIii11Ii . Oo + i1i1i1111I
  OO0OoO00 = OO0OoO00 + ( "," . join ( x for x in O0oo [ "uploadFailedDeviceInfo" ] ) )
  iiIIi1iiII1Ii = "" . join ( [ iiIIi1iiII1Ii , "\r\n" , OO0OoO00 ] )
 if O0oo [ "errphoto_1" ] :
  OO0OoO00 = """Non-compliant photos: """
  vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 OO0OoO00 , O0oo [ "updateConFailed" ] ) )
  vwAppConfig . vwlog ( O0oo [ "errphoto_1" ] )
  OO0OoO00 = OO0OoO00 + ( "," . join ( x for x in O0oo [ "errphoto_1" ] ) )
  iiIIi1iiII1Ii = "" . join ( [ iiIIi1iiII1Ii , "\r\n" , OO0OoO00 ] )
 if O0oo [ "errphoto_2" ] :
  OO0OoO00 = """Duplicate photos between two individuals: """
  vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 OO0OoO00 , O0oo [ "updateConFailed" ] ) )
  vwAppConfig . vwlog ( O0oo [ "errphoto_2" ] )
  OO0OoO00 = OO0OoO00 + ( "," . join ( x for x in O0oo [ "errphoto_2" ] ) )
  iiIIi1iiII1Ii = "" . join ( [ iiIIi1iiII1Ii , "\r\n" , OO0OoO00 ] )
 if len ( iiIIi1iiII1Ii ) > 0 :
  return iiIIi1iiII1Ii
 return "OK"
 if 44 - 44: I1Ii1I1 - i1i1i1111I
 if 71 - 71: IiIIii11Ii
@ bp . route ( '/face_disallowselected' , methods = [ 'POST' ] )
@ login_required
def web_face_disallowselected ( ) :
 ii1 = request . form . get ( "selecteddoor" )
 oo0O = request . form . get ( "selecteduser" )
 if 77 - 77: Iii1i - I1Ii1I1 - iI1iII1I1I1i % Ii / Oo
 if 43 - 43: iI1iII1I1I1i / ooo0O0oO00
 if len ( ii1 ) == 0 or len ( oo0O ) == 0 :
  return "OK"
  if 93 - 93: Ii1I111 % iIII * ooo0oOoooOOO0 + Ii . iII11II1Iiiii - ooo0O0oO00
 ii1 = ii1 . split ( "," )
 ii1 = [ int ( x ) for x in ii1 ]
 ii1 . sort ( )
 oo0O = oo0O . split ( "," )
 oo0O = [ int ( x ) for x in oo0O ]
 oo0O . sort ( )
 vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName ,
 "Deleted Users count={} from Devices count={}" . format ( len ( ii1 ) ,
 len ( oo0O ) ) ) )
 if 63 - 63: OOoOoo000O00 . Iii1i
 O0oo = o0ooOOo ( doorDst = ii1 , userDst = oo0O , opMode = 'disallowselected_Click' )
 if 55 - 55: iIII
 if O0oo [ "updateConFailed" ] :
  OO0OoO00 = """Devices with communication failure:"""
  vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 OO0OoO00 , O0oo [ "updateConFailed" ] ) )
  if 85 - 85: I11iiIi11i1I % Oo / I1I . iIII / I11iiIi11i1I . Oo
  OO0OoO00 = OO0OoO00 + ( "," . join ( x for x in O0oo [ "uploadFailedDeviceInfo" ] ) )
  return OO0OoO00
 return "OK"
 if 40 - 40: I11iiIi11i1I - Ii1I111 * ooo0O0oO00 . Ooo0Ooo
 if 24 - 24: OOoOoo000O00 - IIiIIiIi11I1 / Ii
def OOoO0oo00 ( sn , conid , wgcondata ) :
 if 13 - 13: OOoOoo000O00
 if 70 - 70: ooo0oOoooOOO0 % Ii % iIiii1i - iI1iII1I1I1i
 if 69 - 69: iII11II1Iiiii - I11iiIi11i1I / i1i1i1111I + Ii - iII11II1Iiiii % iIiii1i
 iiiiiiiIi = sn
 if 88 - 88: OooOoo / Ii1I111 % i1i1i1111I + i1i1i1111I
 OOO0Oo0000 = 8090
 ooo000oo = 2
 IIIII1I11I = False
 iIi111 = "12345678"
 try :
  oO0oo0OO = http . client . HTTPConnection ( host = iiiiiiiIi , port = OOO0Oo0000 , timeout = 3 )
  oOOOO00 = "/person/delete"
  if 13 - 13: iIII / IIiIIiIi11I1
  if 100 - 100: iI1iII1I1I1i + i1i1i1111I % I1I
  o0O0Oo0o = "pass={}&id={}" . format ( iIi111 , 0x7FFFFFF0 )
  I1Ii11iiiiiii = { "Content-type" : "application/x-www-form-urlencoded" , "Accept" : "application/json" }
  if 59 - 59: OOoOoo000O00
  oO0oo0OO . timeout = ooo000oo
  oO0oo0OO . request ( "POST" , oOOOO00 , o0O0Oo0o , I1Ii11iiiiiii )
  II1I1i1 = oO0oo0OO . getresponse ( )
  iI1IiI1 = II1I1i1 . read ( )
  oO0oo0OO . close ( )
  try :
   OO00 = json . loads ( iI1IiI1 . decode ( "utf-8" ) )
   II = OO00 [ 'result' ]
   if 7 - 7: I1I % ooo0oOoooOOO0
   IIIII1I11I = True
  except Exception as OOOOO0o0o0O00 :
   vwAppConfig . wglog ( OOOOO0o0o0O00 )
   II = None
   IIIII1I11I = False
 except Exception as oOo0Oo :
  vwAppConfig . wglog ( oOo0Oo )
  II = None
  IIIII1I11I = False
  if 83 - 83: I1I * Ii1I111
 if IIIII1I11I :
  wgcondata . uploadedSNConnectedOK . append ( sn )
  wgcondata . uploadedIdConnectedOK . append ( conid )
  wgcondata . recvsnpri . append ( conid )
 else :
  wgcondata . uploadedSNFailed . append ( sn )
  if 84 - 84: Iii1i % Iii1i * OooOoo - I1Ii1I1
  if 77 - 77: ooo0oOoooOOO0
def O00OOOOOOoOO0 ( sn , wgcondata ) :
 if 67 - 67: iII11II1Iiiii - Iii1i . OOoOoo000O00 % o0o0ooo00oo % o0o0ooo00oo
 OoOoOO0OOO00 = wgcondata . selectedUser4Face
 iiiiiiiIi = sn
 if 84 - 84: OooOoo / ooo0oOoooOOO0 % Ii
 OOO0Oo0000 = 8090
 oO0oo0OO = http . client . HTTPConnection ( host = iiiiiiiIi , port = OOO0Oo0000 , timeout = 3 )
 ooo000oo = 3
 IIIII1I11I = True
 iIi111 = "12345678"
 Oo0o0OOOOOO0 = 0
 if wgcondata . faceOpertateMode == 3 :
  try :
   if 5 - 5: iII11II1Iiiii * IiIIii11Ii / ooo0oOoooOOO0 * ooo0O0oO00 * I11iiIi11i1I
   oOOOO00 = "/setTime"
   if 86 - 86: iIII % ooo0O0oO00 / I1Ii1I1
   if 38 - 38: I11iiIi11i1I
   if 17 - 17: ooo0O0oO00 + IiIIii11Ii / i1i1i1111I * OOoOoo000O00 / iIII / iI1iII1I1I1i
   if 43 - 43: iII11II1Iiiii + IIiIIiIi11I1 + Oo
   if 61 - 61: iII11II1Iiiii
   I1i1I = int ( round ( time . time ( ) * 1000 ) )
   o0O0Oo0o = "pass={}&timestamp={}" . format ( iIi111 , I1i1I )
   I1Ii11iiiiiii = { "Content-type" : "application/x-www-form-urlencoded" , "Accept" : "application/json" }
   if 68 - 68: Ii - OooOoo / I1I
   oO0oo0OO . timeout = ooo000oo
   oO0oo0OO . request ( "POST" , oOOOO00 , o0O0Oo0o , I1Ii11iiiiiii )
   II1I1i1 = oO0oo0OO . getresponse ( )
   iI1IiI1 = II1I1i1 . read ( )
   if 44 - 44: IIiIIiIi11I1 % IiIIii11Ii / I1Ii1I1 * i1i1i1111I
   if 63 - 63: I1Ii1I1 * Ii + Iii1i
   try :
    OO00 = json . loads ( iI1IiI1 . decode ( "utf-8" ) )
    II = OO00 [ 'result' ]
    if 58 - 58: I1Ii1I1 / I1Ii1I1 % I11iiIi11i1I
   except Exception as OOOOO0o0o0O00 :
    vwAppConfig . wglog ( OOOOO0o0o0O00 )
    II = None
    IIIII1I11I = False
  except Exception as oOo0Oo :
   vwAppConfig . wglog ( oOo0Oo )
   II = None
   IIIII1I11I = False
 elif wgcondata . faceOpertateMode == 4 :
  if 98 - 98: OooOoo
  try :
   if 79 - 79: iI1iII1I1I1i * iI1iII1I1I1i - Ooo0Ooo - Iii1i
   oOOOO00 = "/person/delete"
   if 5 - 5: OOoOoo000O00 / IiIIii11Ii . I1I % Iii1i . ooo0oOoooOOO0
   o0O0Oo0o = "pass={}&id={}" . format ( iIi111 , - 1 )
   I1Ii11iiiiiii = { "Content-type" : "application/x-www-form-urlencoded" , "Accept" : "application/json" }
   if 29 - 29: iIII + Oo / iIiii1i - iIII % i1i1i1111I / Ii
   oO0oo0OO . timeout = ooo000oo
   oO0oo0OO . request ( "POST" , oOOOO00 , o0O0Oo0o , I1Ii11iiiiiii )
   II1I1i1 = oO0oo0OO . getresponse ( )
   iI1IiI1 = II1I1i1 . read ( )
   if 39 - 39: iIiii1i - iIiii1i % IiIIii11Ii
   if 56 - 56: IiIIii11Ii / OOoOoo000O00 - I1Ii1I1 / Iii1i - ooo0oOoooOOO0 / OooOoo
   try :
    OO00 = json . loads ( iI1IiI1 . decode ( "utf-8" ) )
    II = OO00 [ 'result' ]
    if 28 - 28: iII11II1Iiiii . I1Ii1I1 % OOoOoo000O00 . Ii * Ii1I111 - ooo0O0oO00
   except Exception as OOOOO0o0o0O00 :
    vwAppConfig . wglog ( OOOOO0o0o0O00 )
    II = None
    IIIII1I11I = False
  except Exception as oOo0Oo :
   vwAppConfig . wglog ( oOo0Oo )
   II = None
   IIIII1I11I = False
   if 80 - 80: o0o0ooo00oo
 else :
  for i1I11iI1 in OoOoOO0OOO00 :
   iii1iIIIi1II = i1I11iI1 [ "CardNO" ]
   i11iII1i11I11 = i1I11iI1 [ "Name" ]
   I11 = i1I11iI1 [ "PhotosNormal" ]
   IiI = i1I11iI1 [ "id" ]
   i1iI1I = iii1iIIIi1II
   o0 = i1I11iI1 [ "Delete" ]
   if I11 == 1 or I11 == 0 :
    try :
     if Oo0o0OOOOOO0 % 20 == 1 :
      oO0oo0OO . close ( )
      if 64 - 64: I11iiIi11i1I * IiIIii11Ii
      if 31 - 31: Iii1i
      if 86 - 86: Oo
     oOOOO00 = "/person/delete"
     if 74 - 74: OooOoo - iIiii1i . Oo . ooo0oOoooOOO0 + iIII - Ii1I111
     o0O0Oo0o = "pass={}&id={}" . format ( iIi111 , IiI )
     I1Ii11iiiiiii = { "Content-type" : "application/x-www-form-urlencoded" , "Accept" : "application/json" }
     if 60 - 60: Oo
     oO0oo0OO . timeout = ooo000oo
     oO0oo0OO . request ( "POST" , oOOOO00 , o0O0Oo0o , I1Ii11iiiiiii )
     II1I1i1 = oO0oo0OO . getresponse ( )
     iI1IiI1 = II1I1i1 . read ( )
     if 23 - 23: iIII
     if 47 - 47: iI1iII1I1I1i + Oo * Ii . OooOoo . I1Ii1I1 * IiIIii11Ii
     try :
      OO00 = json . loads ( iI1IiI1 . decode ( "utf-8" ) )
      II = OO00 [ 'result' ]
      if 46 - 46: Ii1I111 % i1i1i1111I * IiIIii11Ii + I1Ii1I1
     except Exception as OOOOO0o0o0O00 :
      vwAppConfig . wglog ( OOOOO0o0o0O00 )
      II = None
      IIIII1I11I = False
      if 15 - 15: IIiIIiIi11I1 - Ooo0Ooo + I11iiIi11i1I * iI1iII1I1I1i
     if not IIIII1I11I :
      break
     wgcondata . recvsnpri . append ( IiI )
     Oo0o0OOOOOO0 = Oo0o0OOOOOO0 + 1
     if 84 - 84: OooOoo . Ii
     if 21 - 21: iI1iII1I1I1i
     if o0 :
      continue
     if wgcondata . faceOpertateMode == 2 :
      continue
      if 76 - 76: IIiIIiIi11I1 % o0o0ooo00oo / OOoOoo000O00 - o0o0ooo00oo
     oOOOO00 = "/person/create"
     if 4 - 4: OooOoo * I11iiIi11i1I - iI1iII1I1I1i . Ii - Ii1I111 . IiIIii11Ii
     if 2 - 2: iIiii1i * iII11II1Iiiii * iII11II1Iiiii * IiIIii11Ii / iIiii1i % o0o0ooo00oo
     if 13 - 13: ooo0oOoooOOO0 * OOoOoo000O00 - Ooo0Ooo * OooOoo
     if 72 - 72: Iii1i . I1Ii1I1 * I11iiIi11i1I % I1Ii1I1 - i1i1i1111I
     OOOo0 = '{{"id":"{}","idcardNum":"{}","name":"{}"}}' . format ( IiI , i1iI1I , i11iII1i11I11 )
     o0O0Oo0o = "pass={}&person={}" . format ( iIi111 , OOOo0 )
     o0O0Oo0o = o0O0Oo0o . encode ( 'utf-8' )
     if 29 - 29: Ooo0Ooo * ooo0oOoooOOO0 - IIiIIiIi11I1 . iII11II1Iiiii - IIiIIiIi11I1
     if 12 - 12: IiIIii11Ii - I11iiIi11i1I . Iii1i * Oo
     if 52 - 52: ooo0O0oO00 . Iii1i % o0o0ooo00oo . o0o0ooo00oo
     if 82 - 82: ooo0O0oO00 % IIiIIiIi11I1 / IiIIii11Ii
     I1Ii11iiiiiii = { "Content-type" : "application/x-www-form-urlencoded" , "Accept" : "application/json" }
     if 47 - 47: ooo0oOoooOOO0
     oO0oo0OO . timeout = ooo000oo
     oO0oo0OO . request ( "POST" , oOOOO00 , o0O0Oo0o , I1Ii11iiiiiii )
     II1I1i1 = oO0oo0OO . getresponse ( )
     iI1IiI1 = II1I1i1 . read ( )
     if 59 - 59: o0o0ooo00oo % I11iiIi11i1I % OOoOoo000O00
     if 92 - 92: Oo . ooo0oOoooOOO0 * IiIIii11Ii . OOoOoo000O00
     try :
      OO00 = json . loads ( iI1IiI1 . decode ( "utf-8" ) )
      II = OO00 [ 'result' ]
      if 82 - 82: iIiii1i % Oo + Ii
     except Exception as OOOOO0o0o0O00 :
      vwAppConfig . wglog ( OOOOO0o0o0O00 )
      II = None
      if 22 - 22: iI1iII1I1I1i / Ii1I111 . I1I % I1I
      IIIII1I11I = False
      if 16 - 16: IIiIIiIi11I1 / IiIIii11Ii / iI1iII1I1I1i . Ii
     if not IIIII1I11I :
      break
      if 82 - 82: Oo % IIiIIiIi11I1 - iII11II1Iiiii * OooOoo % Iii1i - iIiii1i
     if I11 == 0 :
      continue
      if 95 - 95: ooo0O0oO00
     oOOOO00 = "/face/create"
     if 56 - 56: iIiii1i - iII11II1Iiiii / OooOoo / Ooo0Ooo . o0o0ooo00oo
     iIi = "{}{}.{}" . format ( vwAppConfigParam . wgcloudphotodir , i1iI1I , "jpg" )
     if 78 - 78: Ooo0Ooo % o0o0ooo00oo - ooo0oOoooOOO0
     OOOooO0 = I1I11i ( iIi )
     if OOOooO0 is None :
      i1I11iI1 [ "PhotosNormal" ] = 0
      continue
     OOOooO0 = OOOooO0 . replace ( "/" , "%2F" )
     OOOooO0 = OOOooO0 . replace ( "+" , "%2B" )
     o0O0Oo0o = "pass={}&personId={}&faceId=&imgBase64={}" . format ( iIi111 , IiI ,
 OOOooO0 )
     oO0oo0OO . request ( "POST" , oOOOO00 , o0O0Oo0o , I1Ii11iiiiiii )
     II1I1i1 = oO0oo0OO . getresponse ( )
     iI1IiI1 = II1I1i1 . read ( )
     if 90 - 90: iIII % ooo0O0oO00 * ooo0O0oO00 + I1I * I1I / o0o0ooo00oo
     if 92 - 92: OOoOoo000O00 * OooOoo * I1Ii1I1
     try :
      OO00 = json . loads ( iI1IiI1 . decode ( "utf-8" ) )
      II = OO00 [ 'result' ]
      if 65 - 65: IiIIii11Ii * Oo * ooo0O0oO00 + iII11II1Iiiii - iII11II1Iiiii
      if II == 0 :
       if 'msg' in OO00 :
        if OO00 [ 'msg' ] == 'Face already registered' :
         i1I11iI1 [ "PhotosNormal" ] = - 2
        elif OO00 [ 'msg' ] == 'FaceSDK failed to extract features from the photo' :
         i1I11iI1 [ "PhotosNormal" ] = - 1
        else :
         i1I11iI1 [ "PhotosNormal" ] = - 1
         if 86 - 86: ooo0O0oO00 - iI1iII1I1I1i + iIiii1i . Iii1i . OooOoo - Ii
     except Exception as OOOOO0o0o0O00 :
      vwAppConfig . wglog ( OOOOO0o0o0O00 )
      II = None
      IIIII1I11I = False
      if 86 - 86: I1I
      if 35 - 35: Ii1I111 + OooOoo
     if not IIIII1I11I :
      break
    except Exception as OOOOO0o0o0O00 :
     pass
     print ( OOOOO0o0o0O00 )
     IIIII1I11I = False
     if 8 - 8: I1I + Ii % IIiIIiIi11I1 + o0o0ooo00oo . ooo0O0oO00 * ooo0oOoooOOO0
     if 96 - 96: Ooo0Ooo % iIiii1i / iIII * Ii * Ooo0Ooo - iI1iII1I1I1i
 oO0oo0OO . close ( )
 if 88 - 88: Ii % Ii1I111 . I1I
 if IIIII1I11I :
  wgcondata . uploadedSNOK . append ( sn )
  vwAppConfig . wglog ( "uploadSingleController faces {} end OK" . format ( sn ) )
  if 80 - 80: OOoOoo000O00 / ooo0O0oO00 % o0o0ooo00oo * I1I
 else :
  wgcondata . uploadedSNFailed . append ( sn )
  vwAppConfig . wglog ( "uploadSingleController faces {} end Failed" . format ( sn ) )
 if not IIIII1I11I :
  return None
 else :
  return True
  if 100 - 100: iIII / I1Ii1I1 - i1i1i1111I * I1Ii1I1 / iIiii1i * Oo
  if 49 - 49: iI1iII1I1I1i
def Oo0O ( userDst ) :
 if 1 - 1: OooOoo - OooOoo . IiIIii11Ii
 if 77 - 77: o0o0ooo00oo
 O0Oo0O0oo0o = [ ]
 try :
  if 65 - 65: ooo0O0oO00 - ooo0O0oO00
  if 52 - 52: OOoOoo000O00
  if 29 - 29: IiIIii11Ii * IiIIii11Ii
  if 47 - 47: o0o0ooo00oo / I11iiIi11i1I % ooo0O0oO00
  iIIi111ii1II = [ ]
  if 15 - 15: ooo0O0oO00 + iIII * iIiii1i . OOoOoo000O00
  if 66 - 66: I11iiIi11i1I - iIII . I1I * iIiii1i + i1i1i1111I
  if 13 - 13: ooo0O0oO00 % Iii1i
  i1i1Iii111I1 = userDst
  iIooo = vwAppConfigParam . sql_in_batch_size
  if 23 - 23: i1i1i1111I % ooo0oOoooOOO0 % Ii1I111
  for O0OOOoO0o in range ( 0 , len ( i1i1Iii111I1 ) , iIooo ) :
   i1i1iI1iI1I1i = i1i1Iii111I1 [ O0OOOoO0o : O0OOOoO0o + iIooo ]
   if 37 - 37: Ooo0Ooo - Iii1i * I1Ii1I1 - ooo0O0oO00
   if 29 - 29: Ooo0Ooo * ooo0O0oO00
   iIi111iIi1III = db . session . query ( TBConsumer . f_ConsumerID , TBConsumer . f_CardNO ,
 TBConsumer . f_ConsumerName ) . filter ( TBConsumer . f_CardNO . isnot ( None ) ) . filter (
 TBConsumer . f_ConsumerID . in_ ( i1i1iI1iI1I1i ) )
   if 38 - 38: iIII / OOoOoo000O00 * ooo0O0oO00 . OooOoo % Ii . Iii1i
   oo000O = iIi111iIi1III . all ( )
   iIIi111ii1II . extend ( oo000O )
  O0Oo0O0oo0o = iIIi111ii1II
 except Exception as I1iiii1Iiii1 :
  print ( I1iiii1Iiii1 )
  pass
  if 73 - 73: ooo0O0oO00
 return O0Oo0O0oo0o
 if 60 - 60: i1i1i1111I % i1i1i1111I + Oo + iII11II1Iiiii / IiIIii11Ii - OOoOoo000O00
 if 17 - 17: ooo0oOoooOOO0 * iIII . i1i1i1111I % IiIIii11Ii / IIiIIiIi11I1 - IiIIii11Ii
 if 79 - 79: iII11II1Iiiii + iII11II1Iiiii / OOoOoo000O00 % iI1iII1I1I1i + Iii1i / IiIIii11Ii
 if 32 - 32: iI1iII1I1I1i * Ii1I111
def o0ooOOo ( doorDst , userDst , opMode , bUploadAllUser = False ) :
 if 47 - 47: IiIIii11Ii * I11iiIi11i1I
 OOO0oo0 = WGControllerPri2023 ( )
 if 78 - 78: Ii1I111
 if 18 - 18: Ii1I111 / i1i1i1111I * i1i1i1111I * iIiii1i . Iii1i
 o0OoOOo00OoO00 = ""
 for iIIIIiII in doorDst :
  o0OoOOo00OoO00 += str ( iIIIIiII ) + ","
 o0OoOOo00OoO00 += '0'
 I1i1i11 = ""
 if userDst :
  for iIIIIiII in userDst :
   I1i1i11 += str ( iIIIIiII ) + ","
 I1i1i11 += '0'
 if 22 - 22: IIiIIiIi11I1 / I1Ii1I1 / iII11II1Iiiii % OooOoo * I11iiIi11i1I
 O0Oo0O0oo0o = [ ]
 if userDst :
  O0Oo0O0oo0o = Oo0O ( userDst )
  if 46 - 46: ooo0oOoooOOO0
  if 98 - 98: i1i1i1111I / OOoOoo000O00 + Ii / I1I
  if 67 - 67: I11iiIi11i1I - Ii - Ii
  if 84 - 84: iIiii1i . Ii1I111 * Ii1I111
 iIi111iIi1III = db . session . query ( TBThirdpartynetdevice . f_DeviceId , TBThirdpartynetdevice . f_DeviceIP ,
 TBThirdpartynetdevice . f_DeviceName ) . filter (
 TBThirdpartynetdevice . f_DeviceId . in_ ( doorDst ) )
 OOO0OO = iIi111iIi1III . all ( )
 for iIIIIiII in OOO0OO :
  OoO000oOO0 = iIIIIiII . f_DeviceIP
  if OoO000oOO0 not in OOO0oo0 . uploadedSN :
   III11i1IIi1I = iIIIIiII . f_DeviceId
   OOO0oo0 . uploadedSN . append ( OoO000oOO0 )
   OO0o0oOoo = threading . Thread ( target = OOoO0oo00 , args = ( OoO000oOO0 , III11i1IIi1I , OOO0oo0 ) )
   OO0o0oOoo . start ( )
 IiiiI = time . time ( )
 if 78 - 78: ooo0oOoooOOO0 . IiIIii11Ii - Oo * I11iiIi11i1I - I1I - iII11II1Iiiii
 while time . time ( ) < IiiiI + 3 :
  if len ( OOO0oo0 . uploadedSNConnectedOK ) + len ( OOO0oo0 . uploadedSNFailed ) == len ( OOO0oo0 . uploadedSN ) :
   break
  time . sleep ( 0.1 )
  if 21 - 21: Iii1i - Ii / iII11II1Iiiii / I1Ii1I1 % iIiii1i / Ii
  if 74 - 74: I1Ii1I1 . Ii1I111
  if 24 - 24: o0o0ooo00oo - Iii1i % iIII * I1I . IIiIIiIi11I1
 OoO0 = 0
 i11Ii11II11 = False
 if 9 - 9: Ooo0Ooo - OooOoo
 if 14 - 14: I1I
 if bUploadAllUser :
  i11Ii11II11 = True
  if 67 - 67: iI1iII1I1I1i * o0o0ooo00oo / I1Ii1I1 . o0o0ooo00oo - o0o0ooo00oo
 OoOoOO0OOO00 = [ ]
 o0 = 0
 OOO0oo0 . faceOpertateMode = 1
 if opMode == 'disallowselected_Click' :
  o0 = 1
  OOO0oo0 . faceOpertateMode = 2
 if opMode == 'btnadjusttime_Click' :
  OOO0oo0 . faceOpertateMode = 3
 if opMode == 'btnClear_Click' :
  o0 = 1
  OOO0oo0 . faceOpertateMode = 4
 iI1 = [ ]
 if OOO0oo0 . faceOpertateMode == 1 :
  if 17 - 17: Iii1i % iI1iII1I1I1i * iI1iII1I1I1i % Ii + iIiii1i
  if 55 - 55: Ooo0Ooo - OOoOoo000O00
  IIIi = os . listdir ( vwAppConfigParam . wgcloudphotodir )
  iI1 = [ os . path . splitext ( f ) [ 0 ] for f in IIIi if f . lower ( ) . endswith ( '.jpg' ) ]
 for i1I11iI1 in O0Oo0O0oo0o :
  iii1iIIIi1II = i1I11iI1 . f_CardNO
  i11iII1i11I11 = i1I11iI1 . f_ConsumerName
  I1IIii11i11 = i1I11iI1 . f_ConsumerID
  i1i1IIIi = 0
  if str ( iii1iIIIi1II ) in iI1 :
   i1i1IIIi = 1
   if 20 - 20: iII11II1Iiiii * Ii1I111 + iI1iII1I1I1i % iII11II1Iiiii
  OoOoOO0OOO00 . append ( {
 "id" : I1IIii11i11 ,
 "CardNO" : iii1iIIIi1II ,
 "Name" : i11iII1i11I11 ,
 "PhotosNormal" : i1i1IIIi ,
  "Delete" : o0
 } )
 OOO0oo0 . selectedUser4Face = OoOoOO0OOO00
 if 47 - 47: Ooo0Ooo + iI1iII1I1I1i / ooo0O0oO00 % I1Ii1I1 - OOoOoo000O00
 if len ( OOO0oo0 . uploadedSNConnectedOK ) > 0 :
  for O0O0O0 in range ( len ( OOO0oo0 . uploadedSNConnectedOK ) ) :
   if 18 - 18: ooo0oOoooOOO0 . I1Ii1I1 - I1I . Ooo0Ooo % ooo0O0oO00 + o0o0ooo00oo
   OoO000oOO0 = OOO0oo0 . uploadedSNConnectedOK [ O0O0O0 ]
   OO0o0oOoo = threading . Thread ( target = O00OOOOOOoOO0 ,
 args = ( OoO000oOO0 , OOO0oo0 ) )
   OO0o0oOoo . start ( )
  OoO0 = len ( OOO0oo0 . selectedUser4Face )
  if 90 - 90: Ii * Ooo0Ooo / Iii1i * OooOoo . o0o0ooo00oo - iI1iII1I1I1i
  if 12 - 12: Ii1I111
  I1i = time . time ( ) + vwAppConfigParam . uploadpri_timeout_second + ( OoO0 * 60 / 2100 )
  while time . time ( ) < I1i :
   time . sleep ( 0.5 )
   if len ( OOO0oo0 . recvsnpri ) > 0 :
    OOO0oo0 . recvsnpri . clear ( )
    if 93 - 93: o0o0ooo00oo - iIiii1i * o0o0ooo00oo + Ii
    Iii11Iii1 = time . time ( ) + vwAppConfigParam . uploadpri_timeout_second
    if Iii11Iii1 > I1i :
     I1i = Iii11Iii1
   if len ( OOO0oo0 . uploadedSNOK ) + len ( OOO0oo0 . uploadedSNFailed ) == len ( OOO0oo0 . uploadedSN ) and len (
 OOO0oo0 . uploadedSNOK_Delete ) + len (
 OOO0oo0 . uploadedSNFailed_Delete ) == len ( OOO0oo0 . uploadedSN_Delete ) :
    break
    if 66 - 66: ooo0oOoooOOO0 * I1Ii1I1 % Ii * ooo0oOoooOOO0 + Iii1i
    if 21 - 21: Ii1I111
    if 100 - 100: Ooo0Ooo + iII11II1Iiiii - iIiii1i / Iii1i
 iIi111iIi1III = db . session . query ( TBController . f_ControllerID , TBController . f_ControllerSN , TBDoor . f_DoorNO ,
 TBDoor . f_DoorID ) . join ( TBDoor ,
 TBDoor . f_ControllerID == TBController . f_ControllerID )
 iI111IIIi1 = iIi111iIi1III . all ( )
 if 25 - 25: iII11II1Iiiii - Ii1I111 . iI1iII1I1I1i / iIiii1i
 iIIi1I11I1 = [ ]
 OOoOO0O0oOo = [ ]
 o0o00oOO = [ ]
 oOoOoO00Oo0oO = [ ]
 for O0Oo0 in doorDst :
  o0OoOOo00OoO00 += str ( O0Oo0 ) + ","
  for iIIIIiII in iI111IIIi1 :
   OoO000oOO0 = iIIIIiII . f_ControllerSN
   if 88 - 88: I1I - ooo0oOoooOOO0
   if 95 - 95: I1I + ooo0oOoooOOO0
   if O0Oo0 == iIIIIiII . f_DoorID :
    iIiiii11I1i = - 1
    try :
     iIiiii11I1i = OOO0oo0 . uploadedSNOK . index ( OoO000oOO0 )
    except :
     iIiiii11I1i = - 1
     if 98 - 98: I11iiIi11i1I . o0o0ooo00oo + I11iiIi11i1I + Ii1I111 % I11iiIi11i1I
    if iIiiii11I1i >= 0 :
     iIIi1I11I1 . append ( O0Oo0 )
     if 24 - 24: Ooo0Ooo + iII11II1Iiiii / Ii / iI1iII1I1I1i % I11iiIi11i1I
    else :
     try :
      iIiiii11I1i = OOO0oo0 . uploadedSNConnectedOK . index ( OoO000oOO0 )
     except :
      iIiiii11I1i = - 1
     if iIiiii11I1i < 0 :
      o0o00oOO . append ( O0Oo0 )
     else :
      oOoOoO00Oo0oO . append ( O0Oo0 )
 I1iIi11I = [ ]
 o0IiII1Ii1IiI = [ ]
 OoOoOO0OOO00 = OOO0oo0 . selectedUser4Face
 for i1I11iI1 in OoOoOO0OOO00 :
  if 61 - 61: OOoOoo000O00 + I11iiIi11i1I / I1I - OOoOoo000O00 - OOoOoo000O00
  if 52 - 52: I1Ii1I1 - OooOoo % iII11II1Iiiii
  I11 = i1I11iI1 [ "PhotosNormal" ]
  if 88 - 88: Ii1I111 . ooo0oOoooOOO0
  if 72 - 72: I1I - OooOoo / Iii1i - I1Ii1I1
  if 54 - 54: iIiii1i / IiIIii11Ii % iIII - Ii1I111
  if not ( I11 == 1 or I11 == 0 ) :
   i11iII1i11I11 = i1I11iI1 [ "Name" ]
   if I11 == - 2 :
    o0IiII1Ii1IiI . append ( i11iII1i11I11 )
   else :
    I1iIi11I . append ( i11iII1i11I11 )
 if len ( I1iIi11I ) == 0 :
  I1iIi11I = None
 if len ( o0IiII1Ii1IiI ) == 0 :
  o0IiII1Ii1IiI = None
 I1iiI1iI1 = None
 if len ( OOO0oo0 . uploadedSNFailed ) > 0 :
  I1iiI1iI1 = [ ]
  for iIIIIiII in OOO0OO :
   OoO000oOO0 = iIIIIiII . f_DeviceIP
   if OoO000oOO0 in OOO0oo0 . uploadedSNFailed :
    OO00OOo = iIIIIiII . f_DeviceName
    I1iiI1iI1 . append ( OO00OOo )
 if len ( OOO0oo0 . uploadedSNConnectedOK ) > 0 :
  o00o000 = [ ]
  for O0O0O0 in range ( len ( OOO0oo0 . uploadedSNConnectedOK ) ) :
   if 84 - 84: iIII / IiIIii11Ii + iIiii1i * IIiIIiIi11I1 - i1i1i1111I
   OoO000oOO0 = OOO0oo0 . uploadedSNConnectedOK [ O0O0O0 ]
   o00o000 . append ( OoO000oOO0 )
  O0oo0OO00 = {
 "jsonrpc" : "2.0" ,
 "method" : "ExternFunctions" ,
 "params" : [
 {
 "FunctionName" : "ClearFaceReaderLog" ,
 "FaceReaderIP" : o00o000
 }
 ] ,
 "id" : 4001
 }
  IIIII1I11I = vwAppConfig . sendByHttpWithMsg ( O0oo0OO00 )
  if 74 - 74: i1i1i1111I . IiIIii11Ii / IiIIii11Ii / IiIIii11Ii
  if 84 - 84: Ii1I111 * Ooo0Ooo % Ii1I111
  if 57 - 57: iII11II1Iiiii * IIiIIiIi11I1 % iI1iII1I1I1i
  if 22 - 22: OooOoo . ooo0oOoooOOO0
  if 85 - 85: i1i1i1111I * I1Ii1I1 / Ooo0Ooo
  if 14 - 14: i1i1i1111I
  if 61 - 61: Iii1i . iIiii1i - Oo . o0o0ooo00oo + OooOoo
  if 11 - 11: iIII - ooo0oOoooOOO0 / iIII * OooOoo - iIiii1i / I1Ii1I1
  if 4 - 4: OOoOoo000O00
  if 42 - 42: ooo0O0oO00 - ooo0O0oO00 + OooOoo - ooo0O0oO00
  if 23 - 23: IIiIIiIi11I1 % iII11II1Iiiii * iIiii1i - ooo0O0oO00 * iIII
  if 45 - 45: ooo0oOoooOOO0 % IIiIIiIi11I1 . OOoOoo000O00 + iI1iII1I1I1i
  if 34 - 34: Iii1i + Iii1i
  if 67 - 67: iIII + I11iiIi11i1I
  if 69 - 69: I11iiIi11i1I
  if 97 - 97: Iii1i + iIII - ooo0oOoooOOO0 % Iii1i
  if 71 - 71: iI1iII1I1I1i / iI1iII1I1I1i % Ooo0Ooo
  if 32 - 32: Ooo0Ooo * Ooo0Ooo
  if 29 - 29: iI1iII1I1I1i . ooo0oOoooOOO0 * iIiii1i
 return { "updateConOK" : OOO0oo0 . uploadedSNOK , "updateConFailed" : OOO0oo0 . uploadedSNFailed ,
 "doorID_OK" : iIIi1I11I1 ,
 "doorID_NotConnected" : o0o00oOO , "doorID_Fail" : oOoOoO00Oo0oO ,
 "errphoto_1" : I1iIi11I , "errphoto_2" : o0IiII1Ii1IiI ,
 "uploadFailedDeviceInfo" : I1iiI1iI1
 }
 if 98 - 98: Ii1I111 * ooo0O0oO00 + iI1iII1I1I1i + i1i1i1111I / I1Ii1I1
 if 18 - 18: IIiIIiIi11I1 . IIiIIiIi11I1 % Ii1I111
@ bp . route ( '/face_clearselected' , methods = [ 'POST' ] )
@ login_required
def web_face_clearselected ( ) :
 if 90 - 90: I1I - Iii1i + Ii / Iii1i % I1Ii1I1
 ii1 = request . form . get ( "selecteddoor" )
 if 14 - 14: OooOoo + IIiIIiIi11I1 * Iii1i
 if len ( ii1 ) == 0 :
  return "OK"
  if 30 - 30: OooOoo
 ii1 = ii1 . split ( "," )
 ii1 = [ int ( x ) for x in ii1 ]
 ii1 . sort ( )
 if 2 - 2: IiIIii11Ii / iIII - OOoOoo000O00 - IIiIIiIi11I1
 vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName ,
 "Cleared all user information Devices count={}" . format ( len ( ii1 ) ) ) )
 if 90 - 90: IiIIii11Ii
 O0oo = o0ooOOo ( doorDst = ii1 , userDst = None , opMode = 'btnClear_Click' )
 if 11 - 11: Ii1I111 . Ooo0Ooo
 iiIIi1iiII1Ii = ""
 if O0oo [ "updateConFailed" ] :
  OO0OoO00 = """Devices with communication failure:"""
  vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 OO0OoO00 , O0oo [ "updateConFailed" ] ) )
  if 10 - 10: I1Ii1I1 - Ii1I111 / Iii1i - ooo0oOoooOOO0 . Ooo0Ooo
  OO0OoO00 = OO0OoO00 + ( "," . join ( x for x in O0oo [ "uploadFailedDeviceInfo" ] ) )
  iiIIi1iiII1Ii = "" . join ( [ iiIIi1iiII1Ii , "\r\n" , OO0OoO00 ] )
 if len ( iiIIi1iiII1Ii ) > 0 :
  return iiIIi1iiII1Ii
 return "OK"
 if 99 - 99: Ii / IIiIIiIi11I1 / Oo * iIiii1i
 if 86 - 86: Ooo0Ooo - iIII
@ bp . route ( '/face_adjusttimeselected' , methods = [ 'POST' ] )
@ login_required
def web_face_adjusttimeselected ( ) :
 ii1 = request . form . get ( "selecteddoor" )
 if len ( ii1 ) == 0 :
  return "OK"
  if 42 - 42: Ii * ooo0O0oO00
 ii1 = ii1 . split ( "," )
 ii1 = [ int ( x ) for x in ii1 ]
 ii1 . sort ( )
 vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName ,
 "Time calibration Devices count={}" . format ( len ( ii1 ) ) ) )
 if 67 - 67: Ii1I111
 O0oo = o0ooOOo ( doorDst = ii1 , userDst = None , opMode = 'btnadjusttime_Click' )
 if 62 - 62: I1I + Ii + I1I * ooo0oOoooOOO0 . iI1iII1I1I1i * IiIIii11Ii
 if 2 - 2: iII11II1Iiiii + Oo
 iiIIi1iiII1Ii = ""
 if O0oo [ "updateConFailed" ] :
  OO0OoO00 = """Devices with communication failure:"""
  vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 OO0OoO00 , O0oo [ "updateConFailed" ] ) )
  if 51 - 51: Ii . iII11II1Iiiii
  OO0OoO00 = OO0OoO00 + ( "," . join ( x for x in O0oo [ "uploadFailedDeviceInfo" ] ) )
  iiIIi1iiII1Ii = "" . join ( [ iiIIi1iiII1Ii , "\r\n" , OO0OoO00 ] )
  if 89 - 89: o0o0ooo00oo * OOoOoo000O00 / ooo0oOoooOOO0 . I1Ii1I1
 if len ( iiIIi1iiII1Ii ) > 0 :
  return iiIIi1iiII1Ii
 return "OK"
# dd678faae9ac167bc83abf78e5cb2f3f0688d3a3
