Skip to content

Commit

Permalink
auto update repository name + stop Internet checking + autoupdate at 3AM
Browse files Browse the repository at this point in the history
  • Loading branch information
isra67 committed Sep 29, 2017
1 parent bac94c3 commit 07c0613
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions indoor.ini
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ masterpwd = 1
buttonfactory = button_factory
app_log = debug
sip_log = debug
update_repo = production
tunnel_flag = 0
app_upd = button_app_upd
autoupdate = 0
Expand Down
1 change: 1 addition & 0 deletions my_lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
'app_log': 'error',
'tunnel_flag': False,
'autoupdate': 1,
'update_repo': 'production',
'sip_log': 'error' }
dict_about = {'app_name': 'Indoor 2.0',
'app_ver': '2.0.0.0',
Expand Down
Binary file modified my_lib/config.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions my_lib/itools.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ def get_info(cmd):
# ##############################################################################

def getINet():
"check the Internet connection"
return True ### stop checking

info = '0'

try: info = get_info('./checkinet.sh')
Expand Down
Binary file modified my_lib/itools.pyc
Binary file not shown.
23 changes: 17 additions & 6 deletions pjindoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ def __init__(self, **kwargs):

self.infinite_event = Clock.schedule_interval(self.infinite_loop, 6.9)
Clock.schedule_interval(self.info_state_loop, 12.)
Clock.schedule_interval(self.auto_update_loop, 3600)

Clock.schedule_once(self.checkNetStatus, 5.)
Clock.schedule_once(lambda dt: send_command('./diag.sh init'), 15)
Expand Down Expand Up @@ -1234,6 +1235,16 @@ def infinite_loop(self, dt):
procs[idx] = self.displays[idx].initPlayer()


# ###############################################################
def auto_update_loop(self,dt):
"auto update ar 3:00AM"

h = datetime.datetime.now().hour
if h == 3:
Logger.info('%s:' % whoami())
App.get_running_app().appUpdateWorker()


# ###############################################################
def checkNetStatus(self, dt=20):
"test ETH status"
Expand All @@ -1245,11 +1256,13 @@ def checkNetStatus(self, dt=20):
sendNodeInfo('[***]IPADDR: %s' % s[3])
except: s = []

if netlink.netstatus > 0: netlink.netstatus = getINet()
if netlink.netstatus > 0: netlink.netstatus = 1 if getINet() else -1

docall_button_global.btntext = '' if self.lib else 'No Licence'
docall_button_global.btntext = docall_button_global.btntext if len(s) >= 8 else 'Network ERROR'
docall_button_global.btntext = docall_button_global.btntext if netlink.netstatus > 0 else 'ETH ERROR'
if netlink.netstatus == -1: docall_button_global.btntext = 'Internet ERROR'

if '127.0.0.1' == config.get('system', 'ipaddress') and len(s) > 8:
Logger.error('%s: network ipaddress %r' % (whoami(), s))

Expand All @@ -1267,8 +1280,6 @@ def checkNetStatus(self, dt=20):
Logger.error('%s: config %r' % (whoami(), config))
# docall_button_global.btntext = 'ERROR'

# Clock.schedule_once(self.checkNetStatus, 24.)


# ###############################################################
def reinitbackgroundtasks(self):
Expand Down Expand Up @@ -2390,9 +2401,9 @@ def appUpdateWorker(self):
# send_command('./appdiff.sh')
i2 = get_info('../app/appdiff.sh')
i1 = get_info('./appdiff.sh')
else:
MyAlertBox(titl='WARNING', txt='Success.\n\nApplication is going to restart!\n\nPress OK',
cb=self.popupClosed, ad=False).open()
# else:
# MyAlertBox(titl='WARNING', txt='Success.\n\nApplication is going to restart!\n\nPress OK',
# cb=self.popupClosed, ad=False).open()


# ###############################################################
Expand Down
2 changes: 1 addition & 1 deletion runme.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def update(self):
self.getSDcard()
self.getUptime()
self.getNetwork()
self.getINet()
# self.getINet()
self.getAudio()
self.getTunnel()
self.getNodeServer()
Expand Down

0 comments on commit 07c0613

Please sign in to comment.